[ncl-talk] write wrf output variables to a separate netcdf file

Barry Lynn barry.h.lynn at gmail.com
Thu Mar 16 01:16:51 MDT 2017


Hi:

I don't have a moment to look at what you did, but what I write below may
help.

Change the filename and variables to the ones you want.

You can substitute for the "0" any time variable you want. I think you can
set it to -1 to get all times.

  filename="wrfinput_d02.nc"
  a = addfile(filename,"r")
  t2 =wrf_user_getvar(a,"T2",0)
  printVarSummary(t2)
  xlat2d=wrf_user_getvar(a,"XLAT",0)
  xlon2d=wrf_user_getvar(a,"XLONG",0)

system("rm -f file_for_you.nc")
fout = addfile("file_for_you.nc","c")
fout->t2  = t2
fout->xlat      = xlat
fout->xlong     = xlong



On Thu, Mar 16, 2017 at 4:24 AM, Wang,Yu <wangyu8722 at ufl.edu> wrote:

> Dear NCL users,
>
>
> I am trying to use ncl to extract one variable from wrf output to a
> separate netcdf files for further analysis. I was trying to modify the
> script here provided by the UCAR website. http://www.ncl.ucar.
> edu/Applications/netcdf4.shtml. So I have created a script attached with
> this email. However, I am having an error as below:
>
>
> fatal:Number of dimensions in parameter (2) of (filedimdef) is (2), (1)
> dimensions were expected
> fatal:["Execute.c":8575]:Execute: Error occurred at or near line 58 in
> file wrf_op_1.ncl
>
> I understand this is showing a mismatching dimension, in this case is the
> lat and lon. The example case is a one dimension netcdf file for its lat
> and lon, but my file should have 2d for lat and lon. Is there a different
> way of doing what I am doing?
>
> Hope someone could provide some help.
>
> Best,
>
> Yu
>
> Reading and writing NetCDF-4 - ncl.ucar.edu
> <http://www.ncl.ucar.edu/Applications/netcdf4.shtml>
> www.ncl.ucar.edu
> NCL Home> Application examples> File IO || Data files for some examples.
> Example pages containing: tips | resources | functions/procedures Reading
> and writing NetCDF-4
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>


-- 
Barry H. Lynn, Ph.D
Senior Lecturer,
The Institute of the Earth Science,
The Hebrew University of Jerusalem,
Givat Ram, Jerusalem 91904, Israel
Tel: 972 547 231 170
Fax: (972)-25662581

C.E.O, Weather It Is, LTD
Weather and Climate Focus
http://weather-it-is.com
Jerusalem, Israel
Local: 02 930 9525
Cell: 054 7 231 170
Int-IS: x972 2 930 9525
US 914 432 3108
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170316/0c09e240/attachment.html 


More information about the ncl-talk mailing list