# set region subtlety (and point correlation script)

Ferret Users:

I've encountered a problem using set region that makes me uneasy.
Should these two lines,

set region /y=35N:45N
let sst_np = sst[GX=xax_np,y=@AVE]

not give the same numerical results as these:

let sst_np = sst[GX=xax_np,y=35N:45N@AVE]

?? I avoided the latter because I thought it was harder on memory, no?

Well they give different results in the following script

Rob Scott

(hopefully someone may find it useful for doing point correlations)

! Description: get the point correlation of 1D SST field
!-------------------------------------------------------

define axis/x=140E:130W:1/units=longitude/edges xax_np

!-------------------------------------------------------
! the following gets the wrong answer
!-------------------------------------------------------

set region /y=35N:45N
let sst_np = sst[GX=xax_np,y=@AVE]

!-------------------------------------------------------
! but this would make it work:
!            **     let sst_np = sst[GX=xax_np,y=35N:45N@AVE]   **
!-------------------------------------------------------

!-------------------------------------------------------
! keep q fixed:
! move p in zonal direction, find acvf = <p q>
!-------------------------------------------------------
let q = sst_np[x=145W]
!-------------------------------------------------------
! setup NetCDF file to hold the answer
!-------------------------------------------------------
let dummy = x[GX=xax_np]
let/title="SST Autocovariance" acvf = (1/0) * x[GX=xax_np]
save/clobber/file=sst_acvf.cdf acvf
!-------------------------------------------------------
! for all p points, get acvf
! save to NetCDF (use RESHAPE to get it on the right grid)
! save to ASCII (for comparison)
!-------------------------------------------------------
repeat/k=1:5 (let p = sst_np[i=`k`]; go variance; \
LET acvf = reshape(covar,dummy[i=`k`]) ; \
SAVE/APPEND/FILE=sst_acvf.cdf acvf)

```--

Program in Atmospheric and Oceanic Sciences
P.O. Box CN710, Sayre Hall
Princeton, NJ 08544-0710
USA

Tel: 609-452-6519                    o__    ____
Fax: 609-987-5063                    _,>/'_  -----
E-mail: rscott@princeton.edu        (_) \(_) ------```