[ncl-talk] lonPivot

Alan Brammer abrammer at albany.edu
Wed Sep 2 11:56:12 MDT 2015


​See my edits to your script below.

Note:  In making the lon monotonic you may have to move you're pivot point
outside of the typical 0-360 or -180-180 range.   The return lons below
range 72.5-431.5.  NCL should handle these fine for plotting etc. but if
you want to pivot around 30E, then choose 360+30.


p.s. Unless mentioned otherwise try and keep ncl-talk cc'd so other people
can assist and people can find the thread if they have a similar problem.​


On Wed, Sep 2, 2015 at 1:41 PM, clotilde dubois <
clotilde.dubois at mercator-ocean.fr> wrote:

>
> ; ===========================================
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
> load "make_lon_monotonic.ncl"
> ; ===========================================
>

 f     = addfile ("sst_equa_ano.nc","r")
;  scale = 1.e6                                  ; scale factor
chi   = f->tn(:,0,0:359)                                ; get chi

lon       = f->nav_lon(0,0:359)
print("Is the input lon monotonic?  0 = No")
print(isMonotonic(lon))
print( lon(107:108) )   ;;; This should show you that the lon are not
monotonic. They cross the dateline at

;;;;;;;;;;;    Therefore use my function to make them monotonic.

lon = make_lon_monotonic(lon)
print("Lon Rearranged Should now be monotonic" )
print("Is the input lon monotonic? 0=No  ")
print(isMonotonic( lon))

lon at units = "degrees_east"
lon!0="lon"
lon&lon = lon

chi!0="time"
chi!1="lon"


;;;;  chi at lon = lon   ;;; This is incorrect and strong recommended against.
chi&lon=lon

;; chi&lon at units = "degrees_east"  Did this already, don't need to do
again.

print(isMonotonic(chi&lon))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150902/0a80b6e5/attachment.html 


More information about the ncl-talk mailing list