[ncl-talk] DSSAT input preparation from WRF output

Mary Haley haley at ucar.edu
Mon May 11 20:09:06 MDT 2015


I don't know anything about the DSSAT format, but to see how to read WRF
variables, visit the NCL/WRF pages:

http://www.ncl.ucar.edu/Applications/wrf.shtml

Any one of these links shows various ways for reading data from a WRF file.

As a quick example, you can either read a variable directly:

a     = addfile("wrfout_xxxxx.nc","r")
rainc = a->RAINC

"rainc" will contain all the data and the metadata.

or you can use the "wrf_user_getvar" function, which calculates specific
diagnostics by reading required WRF variables and doing the specified
calculation.

http://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_user_getvar.shtml

If you want to stay in the Python world, then you can use PyNIO to read a
WRF output variable.  The syntax is different than NCL:

import Nio as nio
a     = nio.open_file("wrfout_xxxx.nc")
rainc = a.variables['RAINC']      # this is a NioVariable with metadataT[:]
to access values
# rainc = a.variables['RAINC'][:]  # this is a numpy array with the actual
values.

You can learn more about PyNIO at http://www.pyngl.ucar.edu/Nio.shtml

There may be some WRF PyNIO/PyNGL examples at:
http://www.pyngl.ucar.edu/gallery.shtml
<http://www.pyngl.ucar.edu/Nio.shtml>
I can't check at the moment because the NCAR websites are down due to
semi-annual maintenance.

--Mary


On Mon, Apr 13, 2015 at 5:15 AM, Raja Sivaranjan <rajasivaranjan92 at gmail.com
> wrote:

> Dear all,
>
> I need to prepare weather file for DSSAT model from wrf output. Rainfall,
> Min and Max temperature, solar radiation and weed speed are variable i need
> to extract. I'm using python for handling netcdf file which very difficult
> to work with big file. I did some coding to convert wrf output to DSSAT
> weather file format. Now i want to learn NCL, since it is more powerful to
> work with nc files.
>
> Below are the things i need to do in NCL:
>
> 1. Extract variables such as  Rainfall, Min and Max Temperature, solar
> radiation and weed speed for required time
> 2. Write the extracted variable in DSSAT format.
>
> Things i have done in python:
>
> 1. convert wrfnc to excel
> 2. excel to Dssat format.
>
> Can anyone help me out in this.
>
>
>
> _______________________________________________
> ncl-talk mailing list
> 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/20150512/3d0c884e/attachment.html 


More information about the ncl-talk mailing list