[Thread Prev][Thread Next][Index]

Re: SAMPLEXY funtion agian



Hi Jagadish,
              External function SAMPLEXY needs the "MODULO" axis of the 
variable (if any) to be a "regular" one (ie. uniformly spaced). For 
example your script will work for Levitus climatology, using "show axis" 
command to know the axis properties....

  yes? use levitus_climatology
  yes? show axis XAXLEVITR     ! longitude (x) axis for variables temp & 
salt
   name       axis              # pts   start                end
   XAXLEVITR LONGITUDE          360mr   20.5E                19.5E(379.5)
     Axis span (to cell edges) = 360 (modulo length = axis span)
  yes?

  pts is given as 360mr : here m ==> modulo & r ==> regular

  For your dataset, it will be "***mi". 
  
  You can regrid the variable to a regular longitude axis and then use 
the new variable as the source data for sampling (see the example below).

Hope this helps 

With regards

Jaison

Example : 
---------

   ! create an "irregular" & MODULO longitude axis

   let xdata = XSEQUENCE({0,5,10,15,20,25,30,40,50,60,70,80,90,100})
   define axis/x/units=longitudes/MODULO/from_data xax=xdata 
   show axis xax

   ! create some data defined over this axis

   define axis/y=-30:30:1/units=latitudes yax 
   define axis/z=0:500:25/units=meters/DEPTH zax
   let var = sin(x[gx=xax]/100 + y[gy=yax]/100 + z[gz=zax]/50)

   ! do the sampling

       LET xlon = 34.5 + I[I=1:50] ! define the slant line
       LET dely = 24./49
       LET ylat = 24.5 - dely*i[i=1:50] + dely
!   IF we do the sampling now ..it will fail...try it out by
!      uncommenting the following line..
!       LET slantsalt = samplexy(var,xlon,ylat) ; fill slantsalt

!   So let us regrid the variable to a regular axis   

    define axis/x=0:100:10/units=longitudes/MODULO xregular
    show axis xregular

    let var_reg = var[gx=xregular]  
    LET slantsalt = samplexy(var_reg[y=-10:10,x=10:40],xlon,ylat)
    fill slantsalt
!----------------------------------


On Sun, 17 Oct 2004, jagadish karmacharya wrote:

>  Dear Ansley, 
>  SAMPLEXY funtion works fine for the examples you mentioned but it did not work with my data. I used following commands which generate the following error: 
> 
> yes? LET xlon=82+I[I=1:6]
> yes? LET dely = 24./49
> yes? LET ylat = 24.5 - dely*i[i=1:6] + dely
> yes? PLOT/VS/LINE/SYM=27 xlon,ylat  ! gives slanted line
> 
> yes? LET slanttk = samplexy(tk[x=80:90,y=20:25,L=1],xlon,ylat)
> yes?  FILL slanttk
> Bailing out of external function "samplexy":
>         cannot handle MODULO axis that is not regular
>  **ERROR: : error in external function
> 
>  I wonder what caused the error.
> 
> thanking you in advance
> 
> jagadish
> 
> ps : my dataset
> 
> yes? show data
>      currently SET data sets:
>     1> ./ATMJJAS-DAILYAVG.CDF  (default)
>  name     title                             I         J         K         L
>  U        Zonal Wind                       1:63      1:66      1:18      1:122
>  V        Meridional Wind                  1:63      1:66      1:18      1:122
>  TK       Temperature                      1:63      1:66      1:18      1:122
>  QD       Mixing Ratio                     1:63      1:66      1:18      1:122
>  QC       Cloud Mixing Ratio               1:63      1:66      1:18      1:122
>  MSE      Moist Static Energy              1:63      1:66      1:18      1:122
>  RH       Relative Humidity                1:63      1:66      1:18      1:122
>  HGT      Geopotential Height              1:63      1:66      1:18      1:122
>  PS       Surface Pressure                 1:63      1:66      ...       1:122
>  RT       Total Precip                     1:63      1:66      ...       1:122
>  TGRND    Ground Temperature               1:63      1:66      ...       1:122
>  SMT      Total Soil Water                 1:63      1:66      ...       1:122
>  RB       Base Flow                        1:63      1:66      ...       1:122
> 
> 
> Ansley Manke <ansley.b.manke@noaa.gov> wrote: Hello Jagadish,
> There is an example which does this kind of thing in the 
> Users Guide.  Look up "SAMPLEXY, function definition".
> The X axis of the plot that is made has just a count of points, 
> 1 for the first point, 2 for the second point and so on.  Here 
> is the example from the Users Guide, which shows how to define
> a set of points along a line.  You could also define them as lists as I
> did in the previous email.  This example has depth vs location; time 
> vs location would be analogous.
>  
>   USE ocean_atlas_annual
>   LET xlon = 234.5 + I[I=1:50]       ! define the slant line
>   LET dely = 24./49
>   LET ylat = 24.5 - dely*i[i=1:50] + dely
> 
>   LET slantsalt = samplexy(salt[x=200:300,y=0:30],xlon,ylat)
>   FILL/LEVELS=(33.2,35.2,0.1)/VLIMITS=0:4000 slantsalt 
> 
> Ansley
> 
> 
> 
> 
> 		
> ---------------------------------
> Do you Yahoo!?
> vote.yahoo.com - Register online to vote today!

-- 
___________________________________________________

    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