Subject: Re: NetCDF with GrADS
From: Ana Gusmao (angusmao@model.iag.usp.br)
Date: Tue Feb 02 1999 - 12:54:43 MST
To change everything from netcdf to binary form "readable" by grads.
So we created this "gs" for grads. I hope it will transform "any"
of ccm ouput in netcdf format generated by ccm2nc into a binary archive
that is easily read by grads.
The receipt is:
sdfopen name.nc
q file
testenew.gs (the script down below)
close 1
open name.ctl
.
.
.
The imporatant thing is to create a correct ctl file .
The "q file" /"query file" comand will help with this.
I hope it helps
Regards
Ana
=========================================================
*********************************************************
* This script transforms the netcdf output of CCM 3.6
* generated by ccm2nc into a BINARY FILE. This program
* uses the ctl file created by netcdf into the output.
*
* MACHINE : SGI, IEEE, 64 bits
*
* GRADS VERS.: 1.7 Beta9
*
* DATE: 01/02/1999
*
**********************************************************
nvar=1
while(nvar<23)
_niv=nvar+6
*
* Checking the lines "niv" of the ctl included into the netcdffile
* of ccm generated using the utility "ccm2nc"
*
'q file'
say _niv
* Putting the number of levels (niv) into aux1 and aux2
var=sublin(result,_niv)
aux1=subwrd(var,1)
aux2=subwrd(var,2)
* Checking
say aux1
say aux2
'q pos'
if(aux2=0);aux2=1;endif
nt=1
while(nt<aux2+1)
'set z 'nt''
'set fwrite ccmbin.dat'
'set gxout fwrite'
'd 'aux1''
'disable fwrite'
nt=nt+1
*
*This is a trick if you don't use the set gxout contour
* fwrite is not going to work as you expect to
*
'set gxout contour'
'!cat <file name1>.dat >> <filename2>.dat'
endwhile
nvar=nvar+1
endwhile
===================================================
I hope it helps in something ...
Ana Maria Gusmao
University of Sao Paulo, Brasil
CAIXA POSTAL 67035/9
(055) (011) -8184661 -room
-8184714 -fax
On Mon, 25 Jan 1999, Brian Eaton wrote:
> In the netCDF files produced by ccm2nc the time coordinate is determined by
> the current day and seconds variables (NDCUR,NSCUR) in the integer header
> record, and has a value of type double which is equal to NDCUR +
> NSCUR/86400. The units string has the value "days since yyyy:mm:dd
> hh:mm:ss" where the date and time come from the base date and seconds
> variables (NBDATE,NBSEC) in the integer header record. The smallest time
> increment possible is of course 0.0 if the CCM history file contains more
> than one time samples that have identical values of (NDCUR,NSCUR) in their
> integer header records. The next smallest increment would be .00001157
> days which is 1 second.
>
> Hope that helps.
> Brian
>
> Brian Eaton
> NCAR, Climate Modelling Section
> P.O.Box 3000
> Boulder, CO 80307
> eaton@ucar.edu
>
>
> >
> > I used the ccm2nc program to convert a CCM history tape to NetCDF
> > format (DJFdata.nc). When I attempted to read it into GrADS 1.7 (using
> > the sdfopen command), the following error message was printed:
> >
> > Scanning self-describing file: DJFdata.nc
> > Found 72 data variables in SDF file.
> > Time unit has too small an increment for use with GrADS (min. 1 minute)
> >
> > Presumably the unit is seconds. Has anyone run into this problem before?
> > It seems like either the ccm2nc program should have some kind of relevant
> > option, or GrADS, but I don't know which. Any help would be appreciated.
> >
> > Bill Campbell
> > UMD Dept. of Meteorology
> >
> >
>
>
This archive was generated by hypermail 2b27 : Thu Jun 01 2000 - 09:26:51 MDT