newbie: trying to print ann average vertical profile numbers at specific lat, lon for monthly gridded binary file

Steve Piper scpiper at UCSD.EDU
Mon Sep 29 12:06:11 EDT 2008


Arlindo - thanks for the info!
Steve

Dr. Stephen C. Piper
Carbon Dioxide Research Group
Scripps Institution of Oceanography
La Jolla, CA 92093-0244
tel: 858-534-4230 ext 15
fax: 858-534-8814



On Sep 26, 2008, at 5:22 PM, Arlindo da Silva wrote:

> On Fri, Sep 26, 2008 at 5:43 PM, Steve Piper <scpiper at ucsd.edu> wrote:
> Hi,
>
> I just started using Grads.  Great program!
>
> I would like to write out in ascii, the annual average vertical
> profile at
> all 9 levels at a specified location (lat and lon) in
> the grid for variable bioa.
>
> Let's say your specific location is (45N,90W), then
>
> ga-> set lon -90
> ga-> set lat 45
>
> Next let's select all vertical levels
>
> ga-> set z 1 9
>
> To get ASCII output for the annual mean of variable bio:
>
> ga-> set gxout print
> ga-> d ave(bioa,t=1,t=12)
>
> To have this saved to a file see this recipe:
>
>    http://cookbooks.opengrads.org/index.php?title=Recipe-002:_Saving_GrADS_variable_data_to_a_text_file
>
>  Good Luck,
>
>         Arlindo
>
>
>
>
> I am reading a gridded data file that was written with Fortran
> statement declaration
>
>    real x(72,44,9,12,26)     ! lon, lat, levels, months, variables
>
> My ctl file is:
>
>     DSET      /Users/piper/Grads-test/CSU.gurney.L1.mmean.le.3D
>   *    fortran sequential file  c(72,44,9,12,26)
>  *                                lon lat lev month tracer
>   *     sequential means fortran binary with record length integers
> in record
>   *     otherwise would use stream or direct access
>   *     SUN is big-endian (had to swap to make it so with zz.f)
>  *   OPTIONS big_endian for SUN, mac powerpc?
>     OPTIONS sequential
>  *  input file is from little_endian machine
>     OPTIONS little_endian
>     TITLE     CSU Gurney 3D monthly output for T3L1
>     UNDEF    1.e36
>     XDEF     72 linear   -180 5
>     YDEF     44 linear -86 4
>     ZDEF       9 levels 1000 925 850 700 500 400 300 200 100
>    * would like to use middle of every 365 calendar month - this is
> close
>     TDEF       12 linear 16jan94 1mo
>     VARS      26
>         fos90  9  -1,20  fos90
>  *          -1 = non-standard binary, 20 = var and time reordered
>         fos95  9  -1,20  fos95
>         bioa   9  -1,20  bioa
>         dum    9 -1,20   dum
>         bio1   9  -1,20  bio1
>         bio2   9  -1,20  bio2
>         bio3   9  -1,20  bio3
>         bio4   9 -1,20   bio4
>         bio5   9 -1,20   bio5
>         bio6   9 -1,20   bio6
>         bio7   9 -1,20   bio7
>         bio8   9 -1,20   bio8
>         bio9   9 -1,20   bio9
>         bio10   9 -1,20  bio10
>         bio11   9 -1,20  bio11
>         oce1   9 -1,20   oce1
>         oce2   9 -1,20   oce2
>         oce3   9 -1,20   oce3
>         oce4   9 -1,20   oce4
>         oce5   9 -1,20   oce5
>         oce6   9 -1,20   oce6
>         oce7   9 -1,20   oce7
>         oce8   9 -1,20   oce8
>         oce9   9 -1,20   oce9
>         oce10   9 -1,20  oce10
>         oce11   9 -1,20  oce11
>     ENDVARS
>
>
> set lon -180 180    # default is 0 360 when I issue q dim
> set lat -86 86    # this was the default
> set lev 1000 100   # default was 1000
> set t 1 12              # default was t 1
>
> q dim
>
> Default file number is: 1
> X is varying   Lon = -180 to 180   X = 1 to 73
> Y is varying   Lat = -86 to 86   Y = 1 to 44
> Z is varying   Lev = 1000 to 100   Z = 1 to 9
> T is varying   Time = 00Z16JAN1994 to 00Z16DEC1994  T = 1 to 12
> E is fixed     Ens = 1  E = 1
>
> Not sure how to produce annual average array newbioa(72,44,9) from
> bioa(72,44,9,12)
>
> Tried this:
>
> define newbioa =  ave(bioa,t=1,t=12)
>
> It gives 108 lines (=9 x 12) of output stating
> Averaging.  dim = 3, start = 1, end =12
>
> ga-> q dim
> Default file number is: 1
> X is varying   Lon = -180 to 180   X = 1 to 73
> Y is varying   Lat = -86 to 86   Y = 1 to 44
> Z is varying   Lev = 1000 to 100   Z = 1 to 9
> T is varying   Time = 00Z16JAN1994 to 00Z16DEC1994  T = 1 to 12
> E is fixed     Ens = 1  E = 1
>
> d gr2stn(newbioa,60.75,89.38)
> Operation error: Invalid dimension environment
> Too many varying dimensions
>
> set t 1
>
> ga-> q dim
> Default file number is: 1
> X is varying   Lon = -180 to 180   X = 1 to 73
> Y is varying   Lat = -86 to 86   Y = 1 to 44
> Z is varying   Lev = 1000 to 100   Z = 1 to 9
> T is fixed     Time = 00Z16JAN1994  T = 1
> E is fixed     Ens = 1  E = 1
>
> d gr2stn(newbioa,60.75,89.38)
> Operation error: Invalid dimension environment
> Looping dimension does not vary
>
> Not sure why the gr2stn statements do not work.  Help?
> Am I on the right track?
>
> Thanks!
>
> Steve
>
>
>
> --
> Arlindo da Silva
> dasilva at alum.mit.edu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20080929/6f62d6d3/attachment.html 


More information about the gradsusr mailing list