[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 20000223: ncgen and assigning values to global attributes



Tom and Erick,

> >To: address@hidden
> >From: tomw <address@hidden>
> >Subject: ncgen assigning values to global attributes
> >Organization: .
> >Keywords: 200002231421.HAA00157

In the above message, Tom wrote:

> I'm hoping someone there can tell me the answer to Erick's question
> (he's with the NWS in HNL).  I could not find anything like his
> "proposal" in the documentation, but thought I'd better ask anyway. 
> Thanks!
> 
> tom
> 
> 
> -------- Original Message --------
> Subject: Re: [Fwd: AreaToNetCDF and longitude convention.]
> Date: Wed, 23 Feb 2000 00:33:54 -1000
> From: Erick Tabisola <address@hidden>
> To: tomw <address@hidden>
> References: <address@hidden>
> 
> > Hello Tom,
> 
> Erick Again,  I have a quick question for you.
> 
> I am able to get a CDL file and compile it with C and create an
> executable file which will generate a NetCDf file.
> 
> The "global attributes" have to be written in the CDL before I do the
> ncgen.  If it is not I will not see the
> attributes when I do an ncdump ... of course.
> 
> Do you know of any way where I can  enter the attributes as argument??
> 
> for example
> 
> 1- I do the : ncgen -c on "example.cdl" to create example.c
> 
> 2- I do the: cc -Aa -o exampleC example.c  -I<path>/netcdf-3.4/include
> -L<path>netcdf-3.4/lib  \ -lnetdf , to create the exampleC executable.
> 
> 3- when I run the "exampleC": ./exampleC
> -it outputs the .nc file with the attributes.
> 
> I would like to do basically the same thing but : ./exampleC  arg[1]
> arg[2] arg[3] ...arg[n]
> -where the arguments will fill in the attributes
> 
> -so  with the ncdump below the arguments were:
> ./exampleC Mercator  2.  0.  -157.300003051758  28.6397247314453 ...ect
> 
> >
> >
> >                 // global attributes:
> >                 :projName = "MERCATOR" ;
> >                 :projIndex = 2. ;
> >                 :rotation = 0. ;
> >                 :centralLat = 0. ;
> >                 :centralLon = -157.300003051758 ;
> >                 :lat00 = 28.6397247314453 ;
> >                 :lon00 = 167.36311340332 ;
> >                 :latNxNy = 11.8790702819824 ;
> >                 :lonNxNy = 147.618927001953 ;
> >                 :latDxDy = 20.4962291717529 ;
> >                 :lonDxDy = 157.5 ;
> >                 :dxKm = 1.8705952167511 ;
> >                 :dyKm = 1.87124788761139 ;
> >                 :history = "NetCDF encoded on 18 Feb 2000 16:57:27
> > GMT";
> >                 :version = "0.8" ;

The only way that I know how to do this is to modify the C file created by
the ncgen utility to do what you want.

Regards,
Steve Emmerson   <http://www.unidata.ucar.edu>