[gradsusr] write in netcdf format

lpasmanoranjan lpasmanoranjan at gmail.com
Mon Nov 25 21:12:55 EST 2019


Yes!
t2 is the temperature at 2 meter height and has just one level. So “q file”
command shows correctly, which is:

u   11  t,z,y,x  u
t2   0  t,y,x     t2

But my question was why t2 is NOT showing UNDEFINED values at any level?
The values of t2 is showing same value at every level.
e.g. “d t2(lev=1000)”, “d t2(lev=925)”, ...., “d t2(lev=100)”, all shows
same values.

As per your suggestion, I kept the shape of each variable same. Now “q
file” shows the below:

u   11  t,z,y,x     u
t2  11  t,z,y,x     t2

Here t2 showing actual values at level 1000 and UNDEFINED values at other
level. So problem solved. But it is Increasing data-file size unnecessarily
due to 11 levels for t2. Also “q file” shows t2 has 11 levels, which is
really strange.

I think we need to go with this.

Thanks for your help.

Mano

On Mon, Nov 25, 2019 at 18:38 M.Mahakur <mmahakur at tropmet.res.in> wrote:

> thanks..
> i guess you have written both in same shapes..
> but i do not understand why two in these two lines you sent in this email
> looks different...
> t2 0 ....
>
> meaning t2 just one level...
>
> you may check both nc files using ncdump utility..
>
>
> ----- Original Message -----
> From: lpasmanoranjan <lpasmanoranjan at gmail.com>
> To: GrADS Users Forum <gradsusr at gradsusr.org>
> Sent: Mon, 25 Nov 2019 09:48:16 +0530 (IST)
> Subject: Re: [gradsusr] write in netcdf format
>
> Dear Mahakur
> You solved my problem. Thank you once again.
>
> Still one small doubt. I used “cdo merge u.nc t2.nc out.nc”
>
> After opening out.nc in grads, “q file” command shows:
> u   11  t,z,y,x  u
> t2   0  t,y,x     t2
>
> Here t2 has only one level. Let’s say 1000. But t2 is showing same values
> at all 11 levels. I should show undefined values at other 10 levels.
>
> Do you have any comment on this?
>
> Mano
>
> On Mon, Nov 25, 2019 at 11:49 M.Mahakur <mmahakur at tropmet.res.in> wrote:
>
> >
> >
> > not possible with grads.. each variables' netcdf you can later merge
> using
> > cdo..
> >
> > ----- Original Message -----
> > From: lpasmanoranjan <lpasmanoranjan at gmail.com>
> > To: GrADS Users Forum <gradsusr at gradsusr.org>
> > Sent: Mon, 25 Nov 2019 07:05:37 +0530 (IST)
> > Subject: Re: [gradsusr] write in netcdf format
> >
> > Hello Mahakur,
> > Many thanks. It worked perfectly fine. I have one more question. Can’t I
> > extend it to more than one variable, e.g. u, v, t2 in one netcdf file?
> >
> > Mano
> >
> > On Sat, Nov 23, 2019 at 16:37 M.Mahakur <mmahakur at tropmet.res.in> wrote:
> >
> > > You can set sdfwrite with option -3dz, if your grads is 2.1.a2+
> > > Please see the online doc, I have pasted the relevant lines here..
> > >
> > >
> > > The -3dz,-3dt,-rt and -re options are available in version 2.1.a2+.
> > >
> > > set sdfwrite <-3dz or -3dt or -4d or -5d> <-rt or -re> <-flt or -dbl>
> > > <-nc3 or -nc4> <-chunk> <-zip> *fname*
> > >
> > > where
> > >
> > > *fname*    output filename (required)
> > >
> > > The following six optional arguments are not enabled by default; each
> new
> > > call to set sdfwrite
> > > <http://cola.gmu.edu/grads/gadoc/gradcomdsetsdfwrite.html> will turn
> > them
> > > off if they are not included. The default behavior is to write out a
> > > variable with the same number of varying dimensions as the defined
> > variable
> > > and with no record (unlimited) dimension.
> > > -3dt
> > >
> > >    forces the output data file to have at least 3 coordinate dimensions
> > >       (lon, lat, and time)
> > >
> > >
> > > -3dz
> > >
> > >    forces the output data file to have at least 3 coordinate dimensions
> > >       (lon, lat, and lev)
> > >
> > >
> > > -4d
> > >
> > >    forces the output data file to have at least 4 coordinate dimensions
> > >       (lon, lat, lev, and time)
> > >
> > >
> > > -4e
> > >
> > >    forces the output data file to have at least 4 coordinate dimensions
> > >       (lon, lat, time, and ens)
> > >
> > >
> > > -5d
> > >
> > >    forces the output data file to have 5 coordinate dimensions (lon,
> lat,
> > >       lev, time, and ens)
> > >
> > >
> > > -rt
> > >
> > >    sets the T axis as the record (unlimited) dimension
> > >
> > >
> > > -re
> > >
> > >    sets the E axis as the record (unlimited) dimension
> > >
> > >
> > > ------------------------------
> > > *From: *"lpasmanoranjan" <lpasmanoranjan at gmail.com>
> > > *To: *"GrADS Users Forum" <gradsusr at gradsusr.org>
> > > *Sent: *Saturday, November 23, 2019 11:49:48 AM
> > >
> > > *Subject: *Re: [gradsusr] write in netcdf format
> > >
> > > Dear Jha and Dash,
> > > CDO does not work!! I am getting the following error:
> > >
> > > $> cdo -f nc import_binary data.ctl data.nc
> > > Open Error: Unknown keyword in description file
> > > --> The invalid description file record is:
> > > --> pdef 38 28 lcc 46.00 5.00 19.00 14.00 30.00 60.00 5.00 60000.
> 60000.
> > > The data file was not opened.
> > > cdo import_binary (Abort): Open failed!
> > >
> > >
> > > Dear Mahakud,
> > > As per your suggestion, I can save only one variable at one level with
> x
> > > and y varying. How about varying the Z-dimension?
> > >
> > > Thank you Jha, Dash and Mahakur for your prompt suggestions.
> > >
> > >
> > > On Sat, 23 Nov 2019 at 15:02, M.Mahakur <mmahakur at tropmet.res.in>
> wrote:
> > >
> > >> replace newvars=vars
> > >> with
> > >> newvars=u (for example)
> > >>
> > >> you can write only one variable in a single netCDF.
> > >>
> > >> ------------------------------
> > >> *From: *"Itesh Dash" <itesh.dash at gmail.com>
> > >> *To: *"GrADS Users Forum" <gradsusr at gradsusr.org>
> > >> *Sent: *Saturday, November 23, 2019 10:58:53 AM
> > >> *Subject: *Re: [gradsusr] write in netcdf format
> > >>
> > >> Use cdo to convert. Simple and easy. Follow the link below.
> > >>
> > >> https://code.mpimet.mpg.de/boards/1/topics/213
> > >>
> > >>
> > >>
> > >>
> > >> On Sat, Nov 23, 2019, 11:02 AM lpasmanoranjan <
> lpasmanoranjan at gmail.com
> > >
> > >> wrote:
> > >>
> > >>> Dear Users,
> > >>> I have a dataset (.DAT format with a .ctl file). I would like to
> write
> > >>> it in netcdf format. My dataset have multiple variables with various
> > level.
> > >>> Following are the details in my .ctl file:
> > >>>
> > >>> xdef  100 linear 55   0.2
> > >>> ydef  200 linear 60   0.2
> > >>> zdef   11 levels 1000 925 900 850 700 500 300 200 150 100 50
> > >>> tdef  120 linear 00Z15May2012     1hr
> > >>> VARS   5
> > >>> U             11 0  x-wind component (m s-1)
> > >>> V             11 0  y-wind component (m s-1)
> > >>> W             11  0  z-wind component (m s-1)
> > >>> Q2             1  0  QV at 2 M (kg kg-1)
> > >>> T2             1  0  TEMP at 2 M (K)
> > >>> My grads script to write my data in netcdf format is:
> > >>>
> > >>> 'open data.ctl'
> > >>> 'set time 00z15May2012 23z20May2012'
> > >>> 'set gxout fwrite'
> > >>> 'define newvars=vars'
> > >>> 'set sdfwrite data.nc'
> > >>> 'sdfwrite newvars
> > >>> 'quit'
> > >>>
> > >>> This script is not working.
> > >>> Any help please??
> > >>>
> > >>> Thank you in advance.
> > >>> Kind Regards,
> > >>> Mano
> > >>> _______________________________________________
> > >>> gradsusr mailing list
> > >>> gradsusr at gradsusr.org
> > >>> http://gradsusr.org/mailman/listinfo/gradsusr
> > >>>
> > >>
> > >> _______________________________________________
> > >> gradsusr mailing list
> > >> gradsusr at gradsusr.org
> > >> http://gradsusr.org/mailman/listinfo/gradsusr
> > >> _______________________________________________
> > >> gradsusr mailing list
> > >> gradsusr at gradsusr.org
> > >> http://gradsusr.org/mailman/listinfo/gradsusr
> > >>
> > >
> > >
> > > --
> > > Kind Regards,
> > > Mano
> > >
> > > _______________________________________________
> > > gradsusr mailing list
> > > gradsusr at gradsusr.org
> > > http://gradsusr.org/mailman/listinfo/gradsusr
> > > _______________________________________________
> > > gradsusr mailing list
> > > gradsusr at gradsusr.org
> > > http://gradsusr.org/mailman/listinfo/gradsusr
> > >
> > --
> > Kind Regards,
> > Mano
> >
> >
> > _______________________________________________
> > gradsusr mailing list
> > gradsusr at gradsusr.org
> > http://gradsusr.org/mailman/listinfo/gradsusr
> >
> --
> Kind Regards,
> Mano
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
-- 
Kind Regards,
Mano
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gradsusr.org/pipermail/gradsusr/attachments/20191126/aa5f5982/attachment.html>


More information about the gradsusr mailing list