[Thread Prev][Thread Next][Index]

Re: your mail : extracting data at given points



Hi Ansley,
            Yes, you are right, SAMPLEXY works fine for irregular axis
if it is not flagged as MODULO. Actually it was SAMPLEIJ which fails for
irregular axis/axes even when the axis/axes are not flagged as MODULO.
I came to this when tried SAMPLEIJ as an alternative for SAMPLEXY : while  
we have to sample "only on" grid points and one axis is irregular and 
MODULO (the querry from Jagadish few days back). The solution is to define
a regular "index" axis so that the I or/and J indices remains the same as 
in the original grid, define an intermediate variable defined over this 
regular axis, then use this intermediate variable for sampling (since i 
or/and j positions remains same, we will get the data sampled at the 
desired points itself).

 Here is an example....

 With Regards 

 Jaison 

!-----sampleij_irreg.jnl-----------------
\ cancel mode verify

! create some data defined on an "irregular" axis (say ..X)

   let xdata = XSEQUENCE({0,5,10,15,20,25,30,40,50,60,70,80,90})
   define axis/x/from_data xirreg=xdata 
   define axis/y=1:13:1    yreg
   let var = x[gx=xirreg]/10 + y[gy=yreg]/10 

   LET ipts = XSEQUENCE({2,9,13})   
   LET jpts = XSEQUENCE({3,4,12})   
  
   LET var_ij = SAMPLEIJ(var,ipts, jpts)

   list var_ij

   list/nohead var[i=2,j=3], var[i=9,j=4], var[i=13,j=12]

! failed !!!! what about regular axis ?? just do @ASN to a regular
!    abstract axis so that the "i" index remains the same (1 to 13).

    define axis/x=1:13:1 xreg
    let var_reg = var[gx=xreg@ASN]
    
    LET var_reg_ij =  SAMPLEIJ(var_reg,ipts, jpts)

    list var_reg_ij

!----end of sampleij_irreg.jnl------------------

 

On Tue, 23 Nov 2004, Ansley Manke wrote:

> Hi Sudheer and Jaison,
> The SAMPLEXY function works fine if the data is on irregular axes, but it
> does have the restriction that if the axis is MODULO then it must be 
> REGULAR.
> (I imagine this restriction could be lifted with some clever 
> programming, but we
> have not yet made the function that smart.)
> 
> Ansley
> 
> Jaison Kurian wrote:
> 
> >Hi Sudheer,
> >            You can use SAMPLEXY function to sample a variable 
> >at desired lat-lon locations. From the usermanual 
> >(Ch3 Sec2.3.34.  SAMPLEXY )
> >
> >   SAMPLEXY(DAT_TO_SAMPLE,XPTS,YPTS) Returns data sampled at a 
> >   set of (X,Y) points, using linear interpolation. 
> >  
> >   SAMPLEXY is a "grid-changing" function; its output grid is 
> >   different from the input arguments.  Therefore it is best 
> >   to use explicit limits on the first argument rather than a 
> >   SET REGION command.
> >
> > I think SAMPLEXY works well only for regular (equaly spaced)
> >X & Y axis (especially if the LONGITUDE axis is flagged as 
> >MODULO). Anyway if you are planning to use Levitus Climatology
> >you don't have to worry about this. 
> >
> > Please have a look at the example given below.
> >
> > Hope this helps
> >
> > With Regards 
> >
> > Jaison
> >
> >...........samplexy_lev.dat...........
> >LAT   LON
> >===   ===
> > 9.0  68.4
> >10.2  72.6
> > 8.5  70.2
> > 7.2  65.5
> >...............................
> >!---------samplexy_lev.jnl-----------
> >
> >! open climatology dataset
> >
> >      set data levitus_climatology
> >
> >! open ascii file containing lat-lon points
> >!    use "/SKIP" to skip header lines if any
> >
> >      file/skip=2/var="lat,lon"  samplexy_lev.dat
> >
> >! do the sampling using SAMPLEXY function
> >
> >      let temp_lev = SAMPLEXY(temp[d=1], lon[d=2], lat[d=2])
> >
> >      list/k=1:5 temp_lev
> >
> >! assign proper title and units if you are saving this to a file
> >
> >      set var/title="Temperature Extracted from Levitus Climatology"/\
> >               units="^oC"  temp_lev
> >      set var/title="Latitude  of data points"/units=latitudes  lat
> >      set var/title="Longitude of data points"/units=longitudes lon
> > 
> >      sp rm -f samplexy_lev.nc
> >      save/file=samplexy_lev.nc/append temp_lev
> >      save/file=samplexy_lev.nc/append lon,lat
> >
> >!-----------------------------------------------
> >
> >
> >
> >On Tue, 23 Nov 2004, Sudheer Joseph wrote:
> >
> >  
> >
> >>Dear Users ,
> >>                 Is there any way to extract data from a netcdf file at 
> >>specicifed( irregular) lat lon positions read from a file,
> >>essentially I needed the following
> >>file/var= lat,lon      ll.dat
> >>get temperature data from levitus data.cdf @  lat log
> >>
> >>is there a method to get this data form the specified lat  lon
> >>thanks,
> >>sudheer
> >>
> >>***************************************
> >>Dr. Sudheer Joseph
> >>Indian National Centre for Ocean Information Services
> >>Gajularamaram B.O., IDA Jeedeemetla S.O.
> >>Via Pragathi Nagar, Kukatpally, Hyderabad
> >>Pin:5000 55
> >>Tel:+91-40-23044600(R)
> >>Tel:+91-40-9440832534(Mobile)
> >>Tel:+91-40-25503595(O)
> >>Fax:+91-40-25503596(O)
> >>E-mail:sjo@rediffmail.com;
> >>callsjo@yahoo.com;
> >>sjo@incois.gov.in.
> >>Web- http://oppamthadathil.tripod.com
> >>***************************************
> >>
> >>_________________________________________________________________
> >>NRIs - Free money transfer to India. Fly to India for free!  
> >>http://acm.bridgeovertw.com/hdfc/qr/landingpage/sep04/index.htm?sitecode=610|394 
> >>Apply Now.
> >>
> >>    
> >>
> >
> >  
> >
> 

-- 
___________________________________________________

    Jaison Kurian                           
    Centre for Atmospheric and Oceanic Sciences
    Indian Institute of Science
    B A N G A L O R E   560 012
    Ph: +91-80-3942505
        +91-80-3600450
    Fax:+91-80-3600865
___________________________________________________



[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement