[ncl-talk] Coordinate Subscripting

Adam Phillips asphilli at ucar.edu
Sun Jan 20 12:58:02 MST 2019


Hi Jalal,
When error messages start happening that question your data or coordinate
variable it is best to use print statements to examine your data. Add this
after your cd_calendar call:
print(prc_reorder&time)

Does the time look like what you would expect? Are there any times that are
the same? etc.

Hopefully that will help you find what is wrong. If you have further
questions let ncl-talk know.
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>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190120/b7f3ec72/attachment.html>


More information about the ncl-talk mailing list