Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

Re: [netcdfgroup] convert Arc Ascii to cdl format for ultimate conversion to netCDF file

 
Hi June,

I am no CDL expert, but unless you think you'll be adding more rainfall
grids to a temporal stack, you can omit the "time" dimension and the
corresponding "time" variable. You still should have "lat" and "lon"
variables defined along the "lat" and "lon" dimensions, to contain your
coordinate vectors.

So, something like:

netcdf foo {    // example netCDF specification in CDL

dimensions:
lat = 603, lon = 603;

variables:
  int     lat(lat), lon(lon);
  float   prec(lat,lon);
  lat:units = "meters";
  lon:units = "meters";
  prec:units = "millimeters";
  prec:valid_range = 0., 5000.;
  prec:_FillValue = -9999.;
 
data:
  lat   = -5139928.000, -5138737.375, ... , -4421981.125;
  lon   =  2474118.750,  2475309.375, ... ,  3192065.625;
  prec  = -9999.00, -9999.00, ... // or whatever your values
}

Again, this is just a hint on the variable format, I do not use cdl
myself.
I do not know if cdl requires a CR after each line of 603 rainfall
values.
I assume that all cells in one column have the same X (row:Y).

Regards,

Sjur K :-)



> -----Original Message-----
> From: netcdfgroup-bounces@xxxxxxxxxxxxxxxx 
> [mailto:netcdfgroup-bounces@xxxxxxxxxxxxxxxx] On Behalf Of June Yeung
> Sent: 29 mai 2008 02:29
> To: netcdfgroup@xxxxxxxxxxxxxxxx
> Subject: [netcdfgroup] convert Arc Ascii to cdl format for 
> ultimate conversion to netCDF file
> 
> Hi, I am trying to convert an Arc Ascii file to a netCDF 
> file.  From searching on forums and other online searches, I 
> found that I can convert the ascii file to a cdl file and 
> then use ncgen to convert the cdl file to a netCDF.  However, 
> I am stuck on the conversion from (arc) ascii to cdl.  My 
> file is as follows:
> 
> ncols 603
> nrows 603
> xllcorner 2474118.750000
> yllcorner -5139928.000000
> cellsize 1190.6250000000
> NODATA_value -99
> -99.00 -99.00 -99.00 -99.00 -99.00 -99.00 -99.00 -99.00 
> -99.00 -99.00 -99.00 -99.00 -99.00 ...
> ....
> 
> I know that a cdl file should look something like this:
> netcdf foo {    // example netCDF specification in CDL
> 
> dimensions:
> lat = 10, lon = 5, time = unlimited;
> 
> variables:
>   int     lat(lat), lon(lon), time(time);
>   float   z(time,lat,lon), t(time,lat,lon);
>   double  p(time,lat,lon);
>   int     rh(time,lat,lon);
> 
>   lat:units = "degrees_north";
>   lon:units = "degrees_east";
>   time:units = "seconds";
>   z:units = "meters";
>   z:valid_range = 0., 5000.;
>   p:_FillValue = -9999.;
>   rh:_FillValue = -1;
> 
> data:
>   lat   = 0, 10, 20, 30, 40, 50, 60, 70, 80, 90;
>   lon   = -140, -118, -96, -84, -52;
> }
> 
> 
> I know that in this case, time is not one of my variables.  I 
> just have a grid of rainfall data.  Could anyone provide 
> guidance on what should go under the "variables" section?  
> Your help would be greatly appreciated. 
> 
> Thanks so much,
> June
> 
> --
> June Yeung, PH.D. Candidate
> Department of Civil and Environmental Engineering 
> Environmental Engineering and Water Resources Program 
> Princeton University
> 
> Office: Equad E-223 (609-258-4727)
> Lab:    Equad C-329 (609-258-6383) 
> Mobile: 609-423-5338
> 
> 
> _______________________________________________
> netcdfgroup mailing list
> netcdfgroup@xxxxxxxxxxxxxxxx
> For list information or to unsubscribe,  visit: 
> http://www.unidata.ucar.edu/mailing_lists/ 
> 


 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Community Programs   Unidata is a member of the UCAR Community Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690