[ncl-talk] RH calculation (wrfout file)
Bill Ladwig
ladwig at ucar.edu
Wed Mar 21 10:33:24 MDT 2018
Hi Mehdi,
First, you should use example 2 from that link if you are working with
WRF-ARW data, since wrf_user_getvar handles all of the variable extraction
for you and reduces the code to only a few lines. Since newer versions of
NCL now implicitly load everything (no need for the load statements at the
top), to get RH you just do:
a = *addfile* <https://www.ncl.ucar.edu/Document/Functions/Built-in/addfile.shtml>("your
WRF file name","r")
>
> time = 0
> rh = *wrf_user_getvar* <https://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_user_getvar.shtml>(a,"rh",time) ; calculate RH
>
>
Replace the "your WRF file name" with the actual name of your WRF file.
Second, whether you use wrf_rh or wrf_user_getvar, the result returned is
just an NCL variable. If you want this placed in to a new file, you need to
do that yourself. In the example 1 that you used, it's only printing the
variable summary for RH, which is what you've copied and pasted above.
The easiest way to write to a file is shown in this example:
https://www.ncl.ucar.edu/Applications/method_1.shtml
In reality, if you just want to compute RH and write it to a file, it's
only a few lines of code:
infile = *addfile*
> <https://www.ncl.ucar.edu/Document/Functions/Built-in/addfile.shtml>("your
> WRF file name","r")
outfile = *addfile*
<https://www.ncl.ucar.edu/Document/Functions/Built-in/addfile.shtml>("rh_out.nc"
,"c") ; open output netCDF file
>
> time = 0
rh = *wrf_user_getvar*
> <https://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_user_getvar.shtml>(infile,"rh",time)
> ; calculate RH
> outfile->RH = rh
Hope this helps,
Bill
On Wed, Mar 21, 2018 at 8:53 AM, mehdi darvishi <mehdidarvishi at yahoo.com>
wrote:
> *Dear all,*
>
> *I have recently installed ncl-6.3.0 and am not familair with weather
> software and data at all. For my work, I just need to calculate RH% from a
> wrfout file. After typing ncl in the command line, I followed the
> instructions in this link
> https://www.ncl.ucar.edu/Document/Functions/Built-in/wrf_rh.shtml
> <https://www.ncl.ucar.edu/Document/Functions/Built-in/wrf_rh.shtml>*
>
> *and then the following massage appeared:*
>
>
>
>
>
>
>
>
>
>
>
>
> *Variable: RHType: floatTotal Size: 114376 bytes 28594
> valuesNumber of Dimensions: 4Dimensions and sizes: [Time | 1] x
> [bottom_top | 29] x [south_north | 34] x [west_east | 29]Coordinates:
> Number Of Attributes: 2 units : % description : Relative
> HumidityHave I done it right? When I looked at the current working
> directory, I could not find any file related to the RH. I thought that
> maybe the RH file has been added to the wrfout file as a subsetdata with
> the RH variable, but it was not there. My question is that the RH file has
> been created or not? if so, where can I find it. Sorry for the 0-level
> question and thank you for your help.*
>
> *Regards,*
>
> *Mehdi*
>
> _______________________________________________
> 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/20180321/0e452cba/attachment.html>
More information about the ncl-talk
mailing list