[ncl-talk] NCL wrf_contour use for multiple files

Wang,Yu wangyu8722 at ufl.edu
Mon Jun 27 10:26:06 MDT 2016


Thank you so much for your help.


Best,


Jade

________________________________
From: Bill Ladwig <ladwig at ucar.edu>
Sent: Friday, June 24, 2016 2:05:18 PM
To: Wang,Yu
Cc: NCL
Subject: Re: [ncl-talk] NCL wrf_contour use for multiple files

Hi Jade,

Attached is an updated version of the NCL script.  Using NCL 6.4.0, it was actually crashing while doing the calculation, before it got to the wrf_contour line, so I'm not sure why you weren't seeing that crash as well.  After fixing that error, I got the error that you reported.  Here's what happened:

For the first crash, you have a total of 24 times, but you actually need 25 times (missing the 2005-08-25_12:00:00 time) in order to calculate the final hour.  You might want to redo the model run to include this time if you need that final hour, because otherwise that final hour needs to be excluded since you have nothing to subtract from.  We needed to adjust the end of the calculation to not jump over the array bounds in the calculation.

The second problem, with the list index out of bounds error for 'a[it]' is due to the script expecting one file per list index.  This isn't the case for your data.  You only have 2 data files, so you only need to increment the data file index at a time index of 12.  The correction is the use a[it/times_per_file] or a[it/12].

Hope this helps,

Bill

On Wed, Jun 15, 2016 at 10:57 AM, Bill Ladwig <ladwig at ucar.edu<mailto:ladwig at ucar.edu>> wrote:
Hi Jade,

Are you able to send me the two data files and your copy of the NCL script?  I'm not seeing why this isn't working for you, or why it's failing where it's failing.  Based on the script and the text in your original post, it's failing after it prints 2005-08-25_05:00:00, which would indicate it's still working on the first file, since it would have printed 2005-08-25_06:00:00 when it started the second file.

Here are the instructions for FTPing the files (taken from http://www.ncl.ucar.edu/report_bug.shtml#HowToFTP):


You can ftp larger datasets and files to:

ftp ftp.cgd.ucar.edu<http://ftp.cgd.ucar.edu/>
anonymous
<use your email address for the password>
cd incoming
put ...
put ...
.
.
.
quit


Note that for security reasons, you cannot list the contents of this directory, and neither can we. We need to know the exact names of the files in order to retrieve them.


After the file is uploaded, you can send a message directly to me with the filename (or reply to ncl-talk if you wish).  From there, we can try to get you a fix for your problem.

Thanks,

Bill



On Wed, Jun 15, 2016 at 10:04 AM, Wang,Yu <wangyu8722 at ufl.edu<mailto:wangyu8722 at ufl.edu>> wrote:
Hi Bill,

Thank you so much for your suggestion. Here are some of the screenshot of my file.
First I have addfiles of these two files:
[cid:37031a61-6b37-45b5-96d6-420ea4f1ab68]
Then I printed all times:
[cid:ef05eaba-261d-4e70-a95d-15d217a6633a]
[cid:403a76c4-5318-4235-84e0-0f48bd2cfde8]
My loop looks like below:
[cid:5ae5fc2d-46df-485c-a2a6-4fb1721a6fc5]
And here is the ncdump -h results:
[cid:bc85c89e-a66d-48f8-8fc8-f669a4d2c82e]
I think the error (out of range) I get is at line from the loop:
> contour_psl = wrf_contour(a[it],wks,slp(it,:,:),opts_psl) when it = 12

Hope this information can help me better solve this problem. Thank you so much for all your help.

Best,

Jade



________________________________
From: Bill Ladwig <ladwig at ucar.edu<mailto:ladwig at ucar.edu>>
Sent: Wednesday, June 15, 2016 11:36:37 AM
To: Wang,Yu; NCL

Subject: Re: [ncl-talk] NCL wrf_contour use for multiple files

Hi Jade,

Please include ncl-talk in your replies so that it posts to the email list.  The error you're getting is most likely due to 'it' being out of the bounds for your 'a' list variable.  This leads me to believe there aren't actually 12 timesteps in that second file.  Have you looked at the file?  Never assume it's what you think it is, always check.  Please do an 'ncdump -h wrfout_d01_2005-08-25_06:00:00' and report back the result.  Until I know what's really in that second file, it's hard to guess what might be going wrong.  Also, if you can print the 'times' result from 'times = wrf_user_getvar(a, "times", -1)', that would be helpful too.

Thanks,

Bill

On Tue, Jun 14, 2016 at 6:29 PM, Wang,Yu <wangyu8722 at ufl.edu<mailto:wangyu8722 at ufl.edu>> wrote:

Thank you so much for your help.


I think I will put my question in a different way maybe it is more clear.


I have two nc files wrfout_d01_2005-08-25_00:00:00 and wrfout_d01_2005-08-25_06:00:00, each of them have 12 time steps, whic means they have 30 minutes interval. I put them together using a addfiles command. And using a timestep of 2 to loop over to calculate the hourly precipitation tendency by using a later time minus an earlier one, for example, using the 5th time step (2005-08-25_02:00:00) of the first file minus the 3rd time step (2005-08-25_01:00:00) to calculate the tendency between 01Z to 02Z.


When I was trying to plot the tendency from 2005-08-25_05:00:00 (which is the 11th time step of the first file as well as the 11th of the addfiles resulted list) to 2005-08-25_06:00:00(which is the 3rd time step of the second file, and the 13th time step of the addfiles list) using the line below:

> contour_psl = wrf_contour(a[it],wks,slp(it,:,:),opts_psl)

And get the error of fatal:ListSelect: Index out of range.


If this still does not make any sense. Could you give me some suggestion about how to use wrf_contour to plot the difference between the last time step of one wrf output file and the first time step of the second file? Can it be done or I have to use some other functions.


Hope this explain better of my question.


Thanks again for your help.


Best,


Jade

________________________________
From: Bill Ladwig <ladwig at ucar.edu<mailto:ladwig at ucar.edu>>
Sent: Tuesday, June 14, 2016 6:21:11 PM
To: Wang,Yu
Cc: ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>; wrfhelp at ucar.edu<mailto:wrfhelp at ucar.edu>
Subject: Re: [ncl-talk] NCL wrf_contour use for multiple files

Hi Jade,

Can you do an "ncdump -h wrf_file" or an ncl_filedump and report back the number of times for each file?  With WRF, sometimes the last file has less times than the other files.  In this case, it might be only 1.  With a tend_int greater than 1, you might be jumping past the last time.  Without seeing the data, it's hard to say.

Bill

On Tue, Jun 14, 2016 at 2:53 PM, Wang,Yu <wangyu8722 at ufl.edu<mailto:wangyu8722 at ufl.edu>> wrote:

Dear ncl_talk and wrfhelp,

Hope everything goes well with everyone.

I am having a problem with ncl when I wanted to plot hourly precipitation tendencies multiple files. I used the example from the wrf website as below
http://www2.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/Examples/PRECIP/wrf_Precip_multi_files.ncl. All I did is to change the input file. I have 2 domain 1 files, including 6 hours with 30 mins interval in each file. The script works perfectly when it was processing the first file as below:

(0)     Working on time: 2005-08-25_01:00:00
(0)     Working on time: 2005-08-25_02:00:00
(0)     Working on time: 2005-08-25_03:00:00
(0)     Working on time: 2005-08-25_04:00:00
(0)     Working on time: 2005-08-25_05:00:00
But when it get to calculate the next hour which should use both files, the script starts to have trouble and give me an error of
fatal:ListSelect: Index out of range
fatal:["Execute.c":8575]:Execute: Error occurred at or near line 89 in file wrf_Precip_multi_files.ncl
Is this because of my output file or there is something I should change in the script?

Hope some one can provide some help. I would really appreciate any help. Thank you so much.

Best,

Jade


_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk





-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160627/3d2d0588/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: times.JPG
Type: image/jpeg
Size: 17328 bytes
Desc: times.JPG
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160627/3d2d0588/attachment.jpe 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: times_result.JPG
Type: image/jpeg
Size: 39207 bytes
Desc: times_result.JPG
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160627/3d2d0588/attachment-0001.jpe 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: loop.JPG
Type: image/jpeg
Size: 42491 bytes
Desc: loop.JPG
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160627/3d2d0588/attachment-0002.jpe 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file.JPG
Type: image/jpeg
Size: 13336 bytes
Desc: file.JPG
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160627/3d2d0588/attachment-0003.jpe 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ncdump 08-25 00.JPG
Type: image/jpeg
Size: 21984 bytes
Desc: ncdump 08-25 00.JPG
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160627/3d2d0588/attachment-0004.jpe 


More information about the ncl-talk mailing list