NetCDF issue?

Jennifer Adams jma at COLA.IGES.ORG
Mon Mar 17 09:54:16 EDT 2008

Hi, Matt -- Please see comments inline...

On Mar 16, 2008, at 9:40 PM, Matt Alonso wrote:

> Hello folks,
> I've been silent on this list for a while so let me start by saying
> thank you to all the developers and all the users for their hard
> work in getting Grads 2.0 out the door.
> The issue I am having could very well be as a result of my own
> ignorance but I am unable to find the solution.  The issue comes
> about when I am trying to display a time series of WaveWatch 3 data
> with more than one NetCDF data file (they all have the same spatial
> attributes) open at a time.  Here is some environment information:
> -64bit machine running HostGIS linux (for all intents and purposes
> it is a slightly modified version of slackware)
> -GrADS 2.0.a1
Did you build GrADS from source on this machine?

> -NetCDF files are all generated with wgrib2 v0.1.7.1 using the
> command "wgrib2_v0.1.7.1 wna.t<fcst time>.grib.grib2 -netcdf <fcst
> time>.nc" (the executable is pointing to the correct wgrib2)
Looks like you have converted grib2 into netcdf -- one file per
forecast time. Is that right?

> The problem comes about when I am attempting to display time series
> of several runs by setting the lat and lon to constants, setting
> the time equal to all time periods in the file ('set t 1 61'), and
> displaying the values from particular files by looping over all the
> files via 'set dfile <file number>'.  When the script runs I get
> the following output:
> NetCDF Error (gancgrid, nc_get_vara_double): NetCDF: Start+count
> exceeds dimension bound
There are some bugs in the gancgrid() routine in 2.0.a1 that I
believe have been fixed for the next release. The gancgrid() routine
is designed for speeding up the I/O from OPeNDAP servers, but it can
work for non-pdef non-templated local netcdf files too. The non-
templated condition for calling gancgrid() is what's missing in
2.0.a1 plus some other bug fixes in the subroutine itself.

You can bypass the gancgrid() routine by changing one line of code in
gaio.c (lines 212-216) and re-compiling:

   /*   if (!strncmp(pgrid->pfile->name,"http://",7)) { */
   if ((!strncmp(pgrid->pfile->name,"http://",7)) || ((pfi->ncflg==1)
&& (pfi->ppflag==0))) {
     rc = gancgrid(gr,gru,id,jd,d,dx);
     return (rc);

If you un-comment out the first line and comment out the second --
i.e., call gancgrid only for opendap data sets -- then the I/O should

However, it sounds like you are also making a mistake in the way you
are templating your netcdf files. If you have one file per forecast
time, you can aggregate them into one data set (with XDFOPEN and
OPTIONS TEMPLATE) so there's no need to have each time step be in a
separate data set. Also, when you call the smth9() function, which
dimensions are varying?


> Data Request Error:  Error for variable 'ugrd_surface'
> Operation Error:  Error from mag function
>   Error ocurred at column 1
> DISPLAY error:  Invalid expression
>   Expression = smth9(mag(ugrd_surface,vgrd_surface)*1.9)
> The command being run is "d smth9(mag(ugrd_surface,vgrd_surface)
> *1.9)" (although it seems to occur for any and all variables) and
> the above error only occurs when attempting to display data for any
> file other than #1.  If I manually set all the dimension data (lat,
> lon, etc) for one file at a time and then close that file and open
> the next in the series it works fine.  What am I doing wrong?
> Thanks in advance for all of your help and please let me know if
> any more information is needed.
> Cheers,
> Matt

Jennifer M. Adams
4041 Powder Mill Road, Suite 302
Calverton, MD 20705
jma at

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the gradsusr mailing list