[ncl-talk] tc not getting recognized in version 6.3.0
Mary Haley
haley at ucar.edu
Mon Jul 10 15:09:00 MDT 2017
Muhammad,
Sorry for the slow response. I'm currently at a conference.
If you want to change WRFUserARW.ncl to look for "TH" instead of "T", then
I suggest the following steps. WRFUserARW.ncl is an NCL script that you can
edit to make whatever changes you want, but you should always do this from
your own directory, and not from where WRFUserARW.ncl resides in
$NCARG_ROOT/lib/ncarg/nclscripts/wrf/.
Here are the steps I recommend:
[1] Copy $NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl to your own
directory
, and call it (for example), "wrf_user_getvar_mod.ncl"
[2] Edit wrf_user_getvar_mod.ncl and remove all functions and procedures
except for the "wrf_user_getvar" function. You can find the beginning of
this function by searching for this line:
undef("wrf_user_getvar")
Remove everything before the undef line (and leave the undef line there).
Remove everything after this line:
end
The "end" statement will be on a line by itself, and likely with NO spaces
before it. You can also find the "end" statement by looking for the next
"undef" statement. The "end" statement will be shortly before the "undef"
statement.
[3] I highly recommend renaming the "wrf_user_getvar" function to something
slightly different, like "wrf_user_getvar_mod". You should change all
references to "wrf_user_getvar" to "wrf_user_getvar_mod" just to be
consistent.
Step #3 is optional, but highly recommended, so that you can keep the
original "wrf_user_getvar" intact.
[4] Search for "tc" in the "wrf_user_getvar_mod" function. You should see
an "if" statement that looks like this:
if( any( variable .eq. (/"tk","tc"/) ) ) then
Shortly after this "if" statement, you should see the reference to "T". It
will look like this:
T = _get_wrf_var(file_handle,"T",time)
or four statements like this:
T = nc_file->T
T = file_handle[:]->T
T = nc_file->T(time_in,:,:,:)
T = file_handle[:]->T(time_in,:,:,:)
You need to change the "T" on the *right* side of the "=" to "TH". For
example:
T = _get_wrf_var(file_handle,"TH",time)
or:
T = nc_file->TH
T = file_handle[:]->TH
T = nc_file->TH(time_in,:,:,:)
T = file_handle[:]->TH(time_in,:,:,:)
[5] Save this file, and then open up your own script in an editor. Load
this new script right *after* you load WRFUserARW.ncl:
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
load "./wrf_user_getvar_mod.ncl"
[6] If you renamed this modified function, then you will need to edit your
"wrf_user_getvar" call to use whatever new name you chose.
[7] Run your script to see if it now works.
By the way I've updated "wrf_user_getvar" for the next release of NCL to
print out a more meaningful error message if you don't have the required
variables on the file.
--Mary
On Mon, Jul 10, 2017 at 11:56 AM, Dennis Shea <shea at ucar.edu> wrote:
> If the variable is on the file(s) and it is named 'TH' , there is no need
> to use 'wrf_user_getvar'
>
> dirw = "./"
> filw = system("cd "+dirw+" ; ls wrfout_d0*")
> pthw = dirw*filw
> print(pthw)
>
> fwrf = addfiles(pthw, "r")
> t = fwrf[:]->TH
> printVarSummary(t)
>
> On Sun, Jul 9, 2017 at 8:10 PM, Muhammad Omer Mughal <
> m.mughal1 at postgrad.curtin.edu.au> wrote:
>
>> Hi Mary
>>
>>
>> Thanks for the reply and comments.
>>
>>
>> I found out that the WRF variable T has been renamed to TH in my WRF
>> configuration and the wrfout_d0* now contain TH instead of T. Is there a
>> way to change T to TH in
>>
>> $NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl
>>
>>
>> or do I have to recompile and rerun WRF ?
>>
>>
>>
>> Muhammad Omer Mughal
>> MSc BSc Mechanical Engineering
>> PhD Research Scholar
>> Remote Sensing and Satellite Research Group
>> Department of Imaging and Applied Physics
>> Curtin University
>>
>> Curtin University
>> Tel | +61 8 9266 7962
>> Fax | +61 8 9266 2377
>> Mobile | 0470 237 525
>>
>> Email | m.mughal1 at postgrad.curtin.edu.au <m.lynch at curtin.edu.au>
>> Web | http://curtin.edu.au
>>
>> Curtin University is a trademark of Curtin University of Technology.
>> CRICOS Provider Code 00301J (WA), 02637B (NSW)
>>
>>
>> ------------------------------
>> *From:* Mary Haley <haley at ucar.edu>
>> *Sent:* Friday, 7 July 2017 12:03:59 AM
>> *To:* Muhammad Omer Mughal
>> *Cc:* ncl-talk at ucar.edu
>> *Subject:* Re: [ncl-talk] tc not getting recognized in version 6.3.0
>>
>> Hi Muhammad,
>>
>> Important things to note about wrf_user_getvar:
>>
>> - You can only use this function on WRF-ARW data.
>>
>> - You must call this function with the file pointer from opening the WRF
>> output file:
>>
>> f =
>>
>> addfile("wrfout_d01_2008-09-29_20:30:00.nc","r")
>>
>>
>> tc = wrf_user_getvar(f,"tc",-1)
>>
>> If you continue to have problems, please provide the relevant code where
>> you call wrf_user_getvar
>> along with
>> the exact error message, so we can debug this.
>>
>>
>> Thanks,
>>
>> --Mary
>>
>>
>>
>> On Wed, Jul 5, 2017 at 8:02 PM, Muhammad Omer Mughal <
>> m.mughal1 at postgrad.curtin.edu.au> wrote:
>>
>>> Hi all
>>>
>>>
>>> I am using wrf_user_getvar function I am using temperature variable tc
>>> but its not getting recognized for some reason. Can any one suggest a
>>> solution
>>>
>>>
>>>
>>> Muhammad Omer Mughal
>>> MSc BSc Mechanical Engineering
>>> PhD Research Scholar
>>> Remote Sensing and Satellite Research Group
>>> Department of Imaging and Applied Physics
>>> Curtin University
>>>
>>> Curtin University
>>> Tel | +61 8 9266 7962
>>> Fax | +61 8 9266 2377
>>> Mobile | 0470 237 525
>>>
>>> Email | m.mughal1 at postgrad.curtin.edu.au <m.lynch at curtin.edu.au>
>>> Web | http://curtin.edu.au
>>>
>>> Curtin University is a trademark of Curtin University of Technology.
>>> CRICOS Provider Code 00301J (WA), 02637B (NSW)
>>>
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> 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/20170710/b553eb57/attachment.html
More information about the ncl-talk
mailing list