defining new array - repost

Mariusz Pagowski Mariusz.Pagowski at NOAA.GOV
Wed Apr 27 13:55:55 EDT 2005


Thanks Arindam for response.

However, the trick with assigning additional dimension
to the variable won't work - because I read a netcdf file
and z dimension is not defined. I still cannot find a way
how to declare/assign values to a daily array in a time loop
going over hours  e.g.

nreacs=721
incrt=24
tt=0
while(tt <= nrecs-incrt)
tt=tt+incrt
'd rainncacc(t='%tt%')-rainncacc(t='%tt-incrt%')'
endwhile

displays fine but I need to assign values

rainncacc(t='%tt%')-rainncacc(t='%tt-incrt%') to an array

for further manipulation. Any expression of sort
rainncacc(t='%tt%')-rainncacc(t='%tt-incrt%') gets an error
message that: Function not found: rainncacc

Thanks a lot,
Mariusz


On Wed, 27 Apr 2005, Arindam Chakraborty wrote:

> hi Mariusz,
>         the trick is to introduce an additional dimension to the
> hourly rainfall data. And the assumption is that the variable
> has a free dimension (may be level in this case) and you have only
> one variable in this file (this later assumption may not be required if
> some other tricks are applied). Well, assuming these you may
> try applying the followings:
>
> View your time series as two dimensional. The z-dimension is hrs
> and t-dimension is days. Means, if you have 100 days (2400 time
> points in total), you need to write the control file as
> ....
> zdef 24 linear 1 1
> tdef 100 linear 1jan1998 1dy
> vars 1
> var 24 99 rainfall
> endvars
>
> This is the control file which points to the actual time series of
> your data. The next trick is to write another control file which will
> point to the same data file but with a shifted time coordinate. This
> is to make the subtraction sitting at the same time coordinate. This
> 2nd control file will read
> ....
> zdef 24 linear 1 1
> tdef 100 linear 31dec1997 1dy * starts 1 day early
> vars 1
> var 24 99 rainfall
> endvars
>
> Notice the shift here. The actual rainfall of 1jan98 will be viewed by
> the 2nd file as for 31dec97. And actual rainfall of 2jan98 will be
> viewed as for 1jan98, and so on. Now we can make the subtraction.
>
> 'open 1st_file.ctl' * 'actual'
> 'open 2nd_file.ctl' * dummy
> 'set horizontal dimensions'
> 'set t 1 99'
> 'set z 1' * z = 1 is the 1st hour
> 'd var.2 - var'
>
>
> Hope this works out.
> ----------------------------
>  ARINDAM CHAKRABORTY
>  Department of Meteorology
>  Florida State University
>  Tallahassee, FL-32306, USA
>  Tel: +001-850-6443524 (Off)
>       +001-850-5758550 (Res)
>  Fax: +001-850-6449642
> ____________________________
>
> On Wed, 27 Apr 2005, Mariusz Pagowski wrote:
>
> > Hello,
> > Sorry for the respost - I forgot to name the subject in the
> > header of my previous mail.
> >
> > In Grads I read a file with model hourly accumulated precipitation
> > and store data in "hourly"   array.
> > I want to convert hourly accumulated to daily totals. and later process
> > it further. In fortran it would  look like that:
> >
> > real daily  :: (nx,ny,30)
> > real hourly :: (nx,ny,721)
> >
> > daily(1)=hourly(25)-hourly(1)
> > ....
> > daily(30)=hourly(721)-hourly(697)
> >
> > After different tries with a define I ran out of ideas
> > how to declare a daily array and assign daily precip as above
> > in the fortran code.
> >
> > I would very much appreciate help.
> > Thanks,
> > Mariusz
> >
> > ___
> >
> > Mariusz Pagowski
> > NOAA Research-Forecast Systems Laboratory*,
> > 325 Broadway FSL/FS1, Boulder, CO 80305-3328
> > Tel: (303)497-6443, Fax: (303)497-7262
> > e-mail: Mariusz.Pagowski at noaa.gov
> >
> > *In collaboration with
> > Cooperative Institute for Research in the Atmosphere (CIRA),
> > Colorado State University
> > __________________________________________________________________
> >
>

___

Mariusz Pagowski
NOAA Research-Forecast Systems Laboratory*,
325 Broadway FSL/FS1, Boulder, CO 80305-3328
Tel: (303)497-6443, Fax: (303)497-7262
e-mail: Mariusz.Pagowski at noaa.gov

*In collaboration with
Cooperative Institute for Research in the Atmosphere (CIRA),
Colorado State University
__________________________________________________________________



More information about the gradsusr mailing list