[Thread Prev][Thread Next][Index]

Re: How to extract length of axis to a symbol?



Hi Mike,
The "RETURN="  construct is useful for this kind of thing.
Define a variable which is the t-values of your axis, and then
get the start and end of that

DEFINE AXIS/T=($TMIN):($TMAX):7200/UNITS=seconds TNEW
let tpts = t[gt=tnew]

let a = `tpts, return=lstart`
let b = `tpts, return=lend

let npts =  b-a + 1
list npts        ! Here's what you want

Ansley Manke



"McCann, Mike" wrote:

> Quick question, I hope...
>
> After defining an axis, e.g.:
>
> DEFINE AXIS/T=($TMIN):($TMAX):7200/UNITS=seconds TNEW
>
> How do I get the number of points in the axis and assign
> the number to a symbol?
>
> (This is for a go file that I'm writing to combine separate
> mooring deployment netCDF files into a single netCDF file
> that contains all the data on a single grid.)
>
> Thanks in advance,
> Mike
>
> --
> Mike McCann   (mccann@mbari.org)
> Group Leader, Information Applications Group
> Monterey Bay Aquarium Research Institute
> 7700 Sandholdt Road
> Moss Landing, CA 95039-9644
> Voice: (831) 775-1769   Fax: (831) 775-1646 http://www.mbari.org/rd/iag.htm
>
> > -----Original Message-----
> > From: Steve Hankin [mailto:hankin@pmel.noaa.gov]
> > Sent: Thursday, March 15, 2001 6:14 PM
> > To: Andrew Wittenberg
> > Cc: ferret_users
> > Subject: Re: How to extract file name to symbol?
> >
> >
> > Hi Andrew,
> >
> > There will be a clean solution to this in Ferret V5.3 where
> > you will have
> >
> >     `my_var,return=dset`      - to get the data set name
> >     `my_var,return=dsetnum`   - to get the data set number
> >     `my_var,return=dsetpath`  - to get the full data set name&path
> >
> > In V5.22 the following kludge will capture the data set name
> > and title as
> > symbols
> >
> >      use coads_climatology
> >      plot/set sst[i=1,j=1,l=1]
> >      !show symbols   ! the whole list of 'em
> >      show symbol LAB($LABNUM_DATITL)
> >      show symbol LAB($LABNUM_DSET)
> >
> > The kludge needed to get the full path is uglier. I think
> > you'd have to do
> > something like
> >
> >      use coads_climatology
> >      list sst[i=1,j=1,l=1]
> >      list/clobber/file=out.dat sst[i=1,j=1,l=1]
> >      sp head -5 out.dat | tail -1 | sed 's/^.*DATA SET:/DEFINE SYMBOL
> >      dpath/' >out.jnl
> >      go out.jnl
> >      show symbol dpath
> >
> > Incidentally, V5.3 also has a way to grab the output of any
> > Unix command as a
> > string variable. But that's just frustrating knowledge at
> > this point, isn't
> > it!
> >
> >     - steve
> >
> > ============================================
> >
> > Andrew Wittenberg wrote:
> >
> > > Does anyone know how to get the complete file name
> > corresponding to a
> > > dataset number, and place it in a string symbol?  Ferret
> > will display the
> > > info with, e.g.,
> > >
> > > yes? show data/brief 4
> > >      currently SET data sets:
> > >     4> /net/atw/dynamic/predict/cz/diags/diag439/climatology.nc
> > >
> > > but I can't figure out how to get hold of that file name so
> > I can use it
> > > in a script.  Is it stored in an internal ppl symbol
> > somewhere?  Or is
> > > there any way to send the output of "show data" to a file?
> > >
> > > Thanks for any help you can give,
> > >
> > > Andrew
> > >
> > >
> > ----------------------------------------------------------------------
> > > Andrew Wittenberg          Program in Atmospheric and
> > Oceanic Sciences
> > > andyw@splash.princeton.edu                Sayre Hall,
> > Forrestal Campus
> > >                                                   Princeton
> > University
> > >                                               Princeton, NJ
> > 08544-0710
> > >
> > ----------------------------------------------------------------------
> >
> > --
> >
> >                 |  NOAA/PMEL               |  ph. (206) 526-6080
> > Steve Hankin    |  7600 Sand Point Way NE  |  FAX (206) 526-6744
> >                 |  Seattle, WA 98115-0070  |  hankin@pmel.noaa.gov
> >
> >

--
Ansley Manke  Pacific Marine Environmental Laboratory  Seattle WA  (206)526-6246




[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement