[Wrf-users] Saving one variable from a wrfout file to a separate netcdf file.

Nikhil Garg nikhilgarg.gju at gmail.com
Mon Apr 9 21:09:14 MDT 2018


hi, there is a whole lot of messages on cdo mailing lists about cdo’s
inability to work with wrf output because of the way wrf writes files. This
has something to do with the latitude, longitude or more specifically how
Grid is defined in  wrf. You need to regrid wrf output on a stencil grid to
get it to work with cdo or grads. You can find how a ctl file for grads
should be written to read files if you can get the grads netcdf thing to
work.



On Tue, 10 Apr 2018 at 12:23 pm, Lyndz <olagueralyndonmark429 at gmail.com>
wrote:

> Dear WRF-experts,
>
> I am trying to calculate cloud top temperature from a raw wrfout file and
> save it as a separate netcdf file that can be processed by GRADS and CDO.
>
>
> Here is the script that I am using:
>
> a = addfile("wrfout_d01_2013-08-16_00_00_00.nc","r")
>
> ctt   = wrf_user_getvar(a,"ctt",-1)    ; Time X Lat X Lon
>
> Lat = wrf_user_getvar(a,"XLAT",0)
> Lon = wrf_user_getvar(a,"XLONG",0)
>
> printVarSummary(ctt)
>
> system("/bin/rm -f test.nc")   ; remove any pre-existing file
>    ncdf = addfile("test.nc" ,"c")  ; open output netCDF file
>    fAtt               = True            ; assign file attributes
>    fAtt at title         = "Cloud Top Temperature degC"
>    fAtt at source_file   =  "wrfoutfile"
>    fAtt at Conventions   = "None"
>    fAtt at creation_date = systemfunc ("date")
>    fileattdef( ncdf, fAtt )            ; copy file attributes
>    filedimdef(ncdf,"time",-1,True)
>
> ncdf->ctt = ctt
> ncdf->Lat = Lat
> ncdf->Lon = Lon
>
>
>
> *Problem*
> *[1] *The output file cannot be read by GRADS/CDO. Am I missing something
> important when writing out the variable?
>
> *[2]* Any suggestion on how to do this correctly?
>
>
> I'll appreciate any help.
>
> Sincerely,
>
>
>
> *Lyndon Mark P. Olaguera*
> PhD Student
> Laboratory of Climatology
> Department of Geography
> Faculty of Urban Environmental Science
> Minami-Osawa Campus
> Tokyo Metropolitan University
> Hachioji Tokyo, Japan
>
> _______________________________________________
> Wrf-users mailing list
> Wrf-users at ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/wrf-users
>
-- 
Regards

Nikhil

*****************************************
When the present determines the future, but the approximate present does
not approximately determine the future - Edward Lorenz
*****************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/wrf-users/attachments/20180410/71586184/attachment.html>


More information about the Wrf-users mailing list