[ncl-talk] lonPivot

Alan Brammer abrammer at albany.edu
Wed Sep 2 10:47:48 MDT 2015


Following up from offline communication.

The lons are non-monotonic which is evident in the printVarSummary.  This
is a problem for lonPivot.
I made a quick function to make longitudes monotonic again attached below,
with some examples lines below.
Not extensively tested but seemed to work with what I threw at it.



load "./make_lon_monotonic.ncl"
;;;; ;;;; ;;;; ;;;; ;;;; ;;;; ;;;; ;;;; ;;;; ;;;; ;;;; ;;;; ;;;;
;;;;   Recreation of lon values from chi.nc
lon = lonGlobeF(360, "lon", "longitude", "degrees_east")
lon = lonPivot(lon, 73)  ;;  Lets pivot at 73.
lon&lon = where(lon&lon.gt.360, lon&lon-360, lon&lon) ;; Wrap values so
they are within <360
printVarSummary(lon)
;;;;   Recreation of lon values from chi.nc
;;;; ;;;; ;;;; ;;;; ;;;; ;;;; ;;;; ;;;; ;;;; ;;;; ;;;; ;;;; ;;;;



print(isMonotonic(lon&lon))
print("Adjust lons so that they are monotonic")
lon&lon = make_lon_monotonic(lon&lon)  ;;  Adjust lon so that it is
monotonic. order not chagned, just add/subtract 360
;;
;;  chi&lon = make_lon_monotonic(chi&lon)


printVarSummary(lon)
print(isMonotonic(lon&lon))  ;; Success hopefully.
printMinMax(lon&lon,0)




On Wed, Sep 2, 2015 at 11:42 AM, Alan Brammer <abrammer at albany.edu> wrote:

> When you get these errors with specific line numbers and the file it
> occurred in, you could go and look at that line and see whats going on.
>
> This is line 6574 that I see.
>     indP = ind(xlon.eq.xlon({pivotLon}))  ; must be exact
>
> What value of pivotlon are you passing to the function ?
>
> Are your longitudes monotonic?
>
> print( isMonotonic(chi&lon) )
>
> https://www.ncl.ucar.edu/Document/Functions/Contributed/isMonotonic.shtml
>
>
>
> On Wed, Sep 2, 2015 at 11:03 AM, clotilde dubois <
> clotilde.dubois at mercator-ocean.fr> wrote:
>
>>
>>
>>
>> Dear ncl-users,
>>
>>
>> I am trying to use the function lonFlip, but i keep having the following
>> message (see below). Whereas I have no problem to use the lonFlip
>> function. Do you have any idea why it is not working?
>>
>> Best regards,
>>
>> Clotilde Dubois
>>
>>
>>
>>  Copyright (C) 1995-2015 - All Rights Reserved
>>  University Corporation for Atmospheric Research
>>  NCAR Command Language Version 6.3.0
>>  The use of this software is governed by a License Agreement.
>>  See http://www.ncl.ucar.edu/ for more details.
>>
>> Variable: chi
>> Type: float
>> Total Size: 191520 bytes
>>             47880 values
>> Number of Dimensions: 2
>> Dimensions and sizes:    [time | 133] x [lon | 360]
>> Coordinates:
>>             lon: [72.5..71.5]
>> Number Of Attributes: 1
>>   _FillValue :    -9e+33
>> fatal:NclOneDValGetClosestIndex: Non-monotonic coordinate value being
>> used, can't complete coordinate subscript
>> fatal:Could not obtain coordinate indexes, unable to perform subscript
>> fatal:["Execute.c":8575]:Execute: Error occurred at or near line 6574 in
>> file $NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl
>>
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150902/60e067f8/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: make_lon_monotonic.ncl
Type: application/octet-stream
Size: 795 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150902/60e067f8/attachment.obj 


More information about the ncl-talk mailing list