[gradsusr] How to use template option for .nc file (there is no .ctl, file)

Hoop hoop at colorado.edu
Fri Apr 8 09:41:08 EDT 2016


Mano,

I think the issue is that your variable and dimension names are all
upper-case, and GrADS has this bad habit of lower-casing everything.
I'm not even sure if you can get around this with a full-open DDF.
My best advice would be to use the ncrename command from NCO to make
lower-case-only names for everything.

Thanks,
-Hoop

On 04/07/16 22:51, lpasmanoranjan wrote:
> Dear Hoop,
> It seems my datasets are not proper. I think the time dimension. Because
> I am getting same error messegae. I replaced the sdfopent.gs
> with new sdfopent2.gs.
>
> I am getting the following message:
> sdfopent2 /home/data/pre/01/pre_1995-01-01_00.nc
> pre_1995-01-01_%h2.nc 24
> 00z01jan1995 1hr
> Defaulting optional DDF arg to out.ddf
> netCDFfile= /home/data/pre/01/pre_1995-01-01_00.nc
> Template= pre_1995-01-01_%h2.nc
> NumTimes= 24
> Time1= 00z01jan1995
> Tstep= 1hr
> DDF= out.ddf
> *gadsdf: Time dimension time is not an SDF dimension.*
> SDF Descriptor file out.ddf was not successfully opened & parsed.
> Scanning Descriptor File:  out.ddf
> gadsdf: Time dimension time is not an SDF dimension.
> SDF Descriptor file out.ddf was not successfully opened & parsed.
>
> SET Error:  No files open yet
> SET Error:  No files open yet
>
> On 8 April 2016 at 13:27, Hoop <hoop at colorado.edu> wrote:
>
>     Mano,
>
>     Here's another alternative.  I've written a different version of
>     sdfopent.gs, called sdfopent2.gs, for the one time step per file
>     case.  It takes more arguments:
>
>     sdfopent netCDFpath Template NumTimes FirstTime TimeStepSize [DDF]
>     Where:
>     netCDFpath is full path to netcdf file
>     Template is the template (full path or relative)
>     NumTimes is the number of timesteps in the netCDF file
>     FirstTime is the first time value; E.G., 00z01Jan1979
>     TimeStepSize is the size of the time step, E.G., 1hr or 1dy or 1mo
>     DDF is optional name of DDF file created.
>
>     I've attached this script.
>
>     -Hoop
>
>
>     On 04/07/16 18:13, lpasmanoranjan wrote:
>
>         Dear Hoop,
>         Thank you very much for providing a possible solution. I will go
>         into it
>         and tell you.
>
>         I had tried a lot by changing script and writing descriptor file
>         etc..
>         But could not solve that. But I had thought to convert each .nc
>         file to
>         grads form.
>
>         I will come back here soon.
>
>         Thanks and kind regards,
>
>         On Friday 8 April 2016, Hoop <hoop at colorado.edu> wrote:
>
>              I've not heard back from Mano, but an outside-of-GrADS solution
>              has occurred to me, although I'm unsure of its
>         practicality.  One
>              could use the ncrcat command from the NetCDF operators
>         (nco.sf.net)
>              to combine the files into one for GrADS.
>
>              -Hoop
>
>              On 04/05/16 00:08, Hoop wrote:
>
>                  Mano,
>
>                  I'm not sure, but I think it might be the one time step
>         in each file
>                  thing.  If I recall correctly (and it hasn't changed),
>         GrADS kind of
>                  depends (at least, in the sdfopen case) on there being
>         at least two
>                  time steps in each file.  It reads (or read, at least)
>         the first two
>                  time steps in a file to learn what time step size is.
>         But, there's
>                  hope, even it turns out I'm right about this point.
>
>                  So, the sdfopent.gs script wrote a DDF
>                  (out.ddf, apparently).  We
>                  just need to make sure the TDEF line in that file is
>         correct.
>                  Please
>                  share that part of out.ddf, and I may need to suggest a
>         modification
>                  to it.  If that's the case, then you could just
>         re-start GrADS after
>                  modifying it, and then entering "xdfopen out.ddf" at
>         the initial
>                  GrADS prompt.
>
>                  Thanks,
>                  -Hoop
>
>                  On 04/04/16 21:09, lpasmanoranjan wrote:
>
>                      Dear Hoop,
>                      Thank you so much for your prompt reply. I did a
>         mistake
>                      when I copied
>                      to gmail. But the message was same.  ncdump gives
>         the following
>
>                      ga-> !ncdump -h
>         /home/data/pre/1995/01/pre_1995_01_01_00.nc
>                      netcdf pre_1995_01_01_00.nc {
>                      dimensions:
>                            LON = 3223 ;
>                            LAT = 4943 ;
>                            TIME = 1 ;
>                      variables:
>                            double LON(LON) ;
>                                LON:units = "degrees_east" ;
>                                LON:long_name = "Longitude" ;
>                            double LAT(LAT) ;
>                                LAT:units = "degrees_north" ;
>                                LAT:long_name = "Latitude" ;
>                            double TIME(TIME) ;
>                                TIME:units = "seconds since 1970-01-01
>         00:00:00
>                      +0:00" ;
>                                TIME:long_name = "Time" ;
>                            short PRE(TIME, LAT, LON) ;
>                                PRE:long_name = "60-minutes precipitation" ;
>                                PRE:units = "1e-3 meter" ;
>                                PRE:missing_value = -32768s ;
>                                PRE:scale_factor = 0.01f ;
>                                PRE:add_offset = 0.f ;
>
>
>                      On 5 April 2016 at 11:48, Hoop <hoop at colorado.edu
>         <mailto:hoop at colorado.edu>> wrote:
>
>                           Mano,
>
>                           I'm confused.  Why does the path to your first
>         file
>                      have a space inside
>                           of it?  You have:
>
>                           /home/data/pre/1995/01/ pre_1995_01_01.nc
>         <http://pre_1995_01_01.nc>
>
>                           Shouldn't it be:
>
>                           /home/data/pre/1995/01/pre_1995_01_01.nc
>         <http://pre_1995_01_01.nc>
>
>                           If that doesn't solve it, please send the
>         output from
>                      running
>                           "ncdump -ht " on the first file.  If you are not
>                      familiar with
>                           ncdump, it is part of the standard NetCDF
>         suite from
>                      Unidata:
>
>         http://www.unidata.ucar.edu/software/netcdf/
>
>                           Thanks,
>                           -Hoop
>
>
>                           On 04/04/16 20:20, lpasmanoranjan wrote:
>
>                               Dear Hoop,
>                               Thank you very much for your reply. I
>         tried it for
>                      2 files after
>                               saving
>         sdfopent.gs <http://sdfopent.gs> in my scripts directory. But
>                               getting
>                               the following error.
>
>
>                               My data directory: /home/data/pre/1995/01/
>                               Number of Times: 2 (pre_1995_01_01.nc
>         <http://pre_1995_01_01.nc> and
>         pre_1995_01_02.nc <http://pre_1995_01_02.nc>)
>                               (Kindly Note: each file has only one time
>         data, so
>                      I changed the
>                               deltahr
>                               = 1 in the sdfopent.gs
>         <http://sdfopent.gs> script
>                      at line 150)
>
>                               Now I used the following command and got the
>                      subquent messages.
>
>                               ga-> sdfopent /home/data/pre/1995/01/
>         pre_1995_01_01.nc <http://pre_1995_01_01.nc>
>                               pre_1995_01_%h2.nc <http://h2.nc> 2
>                               Defaulting optional DDF arg to out.ddf
>                               yr1=1995.
>                               netCDFfile= /home/data/pre/1995/01/
>         pre_1995_01_01.nc <http://pre_1995_01_01.nc>
>                               Template= pre_1995_01_%h2.nc <http://h2.nc>
>                               NumTimes= 2
>                               Time1= 00Z01JAN1995
>                               Tstep= 1hr
>                               DDF= out.ddf
>                               gadsdf: Time dimension time is not an SDF
>         dimension.
>                               SDF Descriptor file out.ddf was not
>         successfully
>                      opened & parsed.
>                               Scanning Descriptor File:  out.ddf
>                               gadsdf: Time dimension time is not an SDF
>         dimension.
>                               SDF Descriptor file out.ddf was not
>         successfully
>                      opened & parsed.
>
>                               SET Error:  No files open yet
>                               SET Error:  No files open yet
>
>                               I must be doing some mistake, can anybody
>         please
>                      help me to sort
>                               this
>                               problem. Thank you so much.
>
>                               On 5 April 2016 at 02:23, Hoop
>         <hoop at colorado.edu <mailto:hoop at colorado.edu>>
>                      wrote:
>
>                                    Mano,
>
>                                    The standard script library:
>
>         http://cola.gmu.edu/grads/gadoc/library.html
>
>                                    includes the script sdfopent.gs
>         <http://sdfopent.gs>.  It
>                               takes two additional
>                                    arguments beyond the one for
>         sdfopen.  The
>                      second argument
>                                    is a template, like
>         "pre_%y4_%m2_%d2.nc <http://d2.nc>",
>                               and the
>                                    third is
>                                    a count of time steps in the entire
>         series.
>                      The first argument
>                                    would be the first path in the time
>         series.  See:
>
>         ftp://cola.gmu.edu/grads/scripts/sdfopent.gs
>
>                                    -Hoop
>
>                                    On 04/04/16 10:00,
>         gradsusr-request at gradsusr.org
>         <mailto:gradsusr-request at gradsusr.org>>
>                               wrote:
>                                     > Date: Mon, 4 Apr 2016 18:27:49 +0900
>                                     > From: lpasmanoranjan
>         <lpasmanoranjan at gmail.com <mailto:lpasmanoranjan at gmail.com>>
>                                     > Subject: [gradsusr] How to use
>         template
>                      option for .nc
>                               file (there is
>                                     >       no      .ctl file)
>                                     > To: GrADS Users Forum
>         <gradsusr at gradsusr.org <mailto:gradsusr at gradsusr.org>>
>                                     >
>                                     > Dear Users,
>                                     > I am having a problem in viewing the
>                      following dataset as
>                                    template option.
>                                     > I have hourly dataset in .nc as
>         following:
>                                     >
>                                     > 1995/01/pre_1995_01_01.nc
>         <http://pre_1995_01_01.nc>
>                                     > 1995/01/pre_1995_01_02.nc
>         <http://pre_1995_01_02.nc>
>                                     > 1995/01/pre_1995_01_03.nc
>         <http://pre_1995_01_03.nc>
>                                     > 1995/01/pre_1995_01_04.nc
>         <http://pre_1995_01_04.nc>
>                                     > 1995/01/pre_1995_01_05.nc
>         <http://pre_1995_01_05.nc>
>                                     > 1995/01/pre_1995_01_06.nc
>         <http://pre_1995_01_06.nc>
>                                     > and so on for 10 years
>                                     >
>                                     > *All individual datasets can be
>         viewed in
>                      grads with
>                               sdfopen command*
>                                     >
>                                     > Can anybody please help me how to use
>                      template option.
>                                     >
>                                     > Thank you for any kind of help or
>                      suggestion in this regard.
>                                     >
>                                     > Kind Regards
>                                     > Mano
>
>         _______________________________________________
>                                    gradsusr mailing list
>         gradsusr at gradsusr.org <mailto:gradsusr at gradsusr.org>
>         http://gradsusr.org/mailman/listinfo/gradsusr
>                               --
>                               Kind Regards,
>                               Mano
>                      --
>                      Kind Regards,
>                      Mano
>                      --
>                      Kind Regards,
>                      Mano
>         --
>         Kind Regards,
>         Mano
>
>
>
>
> --
> Kind Regards,
> Mano


More information about the gradsusr mailing list