[ncl-talk] Coordinate Subscripting

Md. Jalal Uddin dmjalal90 at gmail.com
Fri Jan 25 01:39:35 MST 2019


Thanks for the tip!

On Wed, Jan 23, 2019 at 2:36 AM Adam Phillips <asphilli at ucar.edu> wrote:

> Hi Jalal,
> I just wrote this short test to see if I could reproduce your error, as I
> suspect you have repeating times in your time coordinate variable:
> ncl 0> a = (/3.4,2.1,1.,3./)
> ncl 1> a!0 = "time"
> ncl 2> a&time = (/19980101,19980102,19980102,19980103/)
> ncl 3> print(a({19980103}))
> 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":8635]:Execute: Error occurred at or near line 3
>
> That says to me that you need to look very closely at your time coordinate
> variable as I recommended before:
> prc_reorder&time = cd_calendar(time, -2)
> print(prc_reorder&time)
> I suspect you will find at least one instance of a repeating time. If you
> do have multiple times on the same day, you can try this to create times in
> the format of YYYYMMDDHH:
> prc_reorder&time = cd_calendar(time, -3)
> plot = gsn_csm_contour_map(wks,prc_reorder({1998042200},:,:),res)
> Adam
>
>
>
>
>
> On Fri, Jan 18, 2019 at 6:16 PM Md. Jalal Uddin <dmjalal90 at gmail.com>
> wrote:
>
>> Hi Adam,
>>
>> Thanks for your kind help. I tried to follow your instructions; however,
>> I am getting the following errors.
>>
>> 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":8637]:Execute: Error occurred at or near line 54 in
>> file subs_time.ncl
>>
>> 54 line:
>>  plot = gsn_csm_contour_map(wks,prc_reorder({19980501},:,:),res)
>>
>> When I used yours suggestion like plot =
>> gsn_csm_contour_map(wks,prc_reorder({19980422},:,:),res), I got the same
>> problem.
>>
>> Any suggestions, please?
>>
>> Jalal
>>
>> On Sat, Jan 19, 2019 at 3:19 AM Adam Phillips <asphilli at ucar.edu> wrote:
>>
>>> Hi Jalal,
>>> Within your script you are calling cd_calendar, and then subsequently
>>> calling day_of_year.
>>> time at units = "days since 1998-1-1 12:00:00"
>>> utc_date = cd_calendar(time, -5)
>>> dyear = day_of_year(utc_date(:,0),utc_date(:,1),utc_date(:,2))
>>>
>>> day_of_year will return numbers ranging from 1-365, and thus the values
>>> can repeat if you have multiple years. This is not the type of array that
>>> should be used for coordinate subscripting. I would recommend calling
>>> cd_calendar, but retrieving the values in YYYYMMDD format, then assign this
>>> array as a coordinate variable to your prc_reorder array:
>>> delete(prc_reorder&time)   ; may not be needed
>>> prc_reorder&time = cd_calendar(time, -2)
>>>
>>> then you should be able to use the following coordinate subscripting to
>>> plot:
>>> plot = gsn_csm_contour_map(wks,prc_reorder({19980422},:,:),res)
>>>
>>> Hope that helps. If you have any further questions let ncl-talk know.
>>> Adam
>>>
>>>
>>>
>>> On Wed, Jan 16, 2019 at 11:11 PM Md. Jalal Uddin <dmjalal90 at gmail.com>
>>> wrote:
>>>
>>>> Hi all,
>>>>
>>>> I used cd_calendar to convert utc_date and day_of_year to find the day
>>>> of year. Now, I want to subscript the time coordinate and plot. Could
>>>> anyone help me? Please find the script in the attached.
>>>>
>>>> Variable: time
>>>> Type: double
>>>> Total Size: 22776 bytes
>>>>             2847 values
>>>> Number of Dimensions: 1
>>>> Dimensions and sizes: [time | 2847]
>>>> Coordinates:
>>>>             time: [ 120..6939]
>>>> Number Of Attributes: 5
>>>>   standard_name : time
>>>>   long_name : Time
>>>>   units : days since 1998-1-1 12:00:00
>>>>   calendar : standard
>>>>   axis : T
>>>>
>>>> Best regards,
>>>> Jalal
>>>>
>>>> --
>>>> *Md. Jalal Uddin*
>>>> MSc in Applied Meteorology (English Language)
>>>> Nanjing University of Information, Science and Technology, China
>>>> B.Sc. in Disaster Management (Hons.)
>>>> Patuakhali Science and Technology University, Bangladesh.
>>>> Cell: +8613260859092, +8801792052662
>>>> Web: www.dmjalal90.weebly.com
>>>> Facebook: jalal.hossen.39
>>>> LinkedIn: https://bd.linkedin.com/in/md-jalal-uddin-80a026b0
>>>> Twitter: dmjalal90
>>>> Skype: dmjalal90
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at ucar.edu
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>>
>>>
>>> --
>>> Adam Phillips
>>> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
>>> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>>>
>>> <http://www.cgd.ucar.edu/staff/asphilli>
>>>
>>
>>
>> --
>> *Md. Jalal Uddin*
>> MSc in Applied Meteorology (English Language)
>> Nanjing University of Information, Science and Technology, China
>> B.Sc. in Disaster Management (Hons.)
>> Patuakhali Science and Technology University, Bangladesh.
>> Cell: +8613260859092, +8801792052662
>> Web: www.dmjalal90.weebly.com
>> Facebook: jalal.hossen.39
>> LinkedIn: https://bd.linkedin.com/in/md-jalal-uddin-80a026b0
>> Twitter: dmjalal90
>> Skype: dmjalal90
>>
>
>
> --
> Adam Phillips
> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>
> <http://www.cgd.ucar.edu/staff/asphilli>
>


-- 
*Md. Jalal Uddin*
MSc in Applied Meteorology (English Language)
Nanjing University of Information, Science and Technology, China
B.Sc. in Disaster Management (Hons.)
Patuakhali Science and Technology University, Bangladesh.
Cell: +8613260859092, +8801792052662
Web: www.dmjalal90.weebly.com
Facebook: jalal.hossen.39
LinkedIn: https://bd.linkedin.com/in/md-jalal-uddin-80a026b0
Twitter: dmjalal90
Skype: dmjalal90
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190125/7b69f486/attachment.html>


More information about the ncl-talk mailing list