[ncl-talk] Problem with "cd_calendar"

Alan Brammer abrammer at albany.edu
Wed Nov 11 14:28:28 MST 2015


relatively simple to use. 

Using the original email as an example:

str_time = "10/05/2014 06:00:00"
time_format = "%N/%D/%Y %H:%M:%S”   ;;; same codes as cd_string 
time_format at units = "minutes since 2014-10-05 06:00:00”

time = cd_inv_string(str_time, time_format)







> On 11 Nov 2015, at 15:35, Mary Haley <haley at ucar.edu> wrote:
> 
> Yes, by all means feel free to send it along, and we will add it to the next release.
> 
> Thanks,
> 
> --Mary
> 
> 
> On Wed, Nov 11, 2015 at 10:59 AM, Alan Brammer <abrammer at albany.edu <mailto:abrammer at albany.edu>> wrote:
> 
> Mary, 
> 
>  A while back I adapted cd_string to work in reverse cd_inv_string.  Pass it a string and the string format and it converts to a cd time.   Would you be interested in including this functionality in future releases?  
> 
> I use the function quite a bit and it helps save a ton of time and  lines parsing out the strings and then converting etc. 
> 
> Alan.   
> 
> 
> 
> 
>> On 11 Nov 2015, at 11:01, Mary Haley <haley at ucar.edu <mailto:haley at ucar.edu>> wrote:
>> 
>> You need to use cd_inv_calendar:
>> 
>> http://www.ncl.ucar.edu/Document/Functions/Built-in/cd_inv_calendar.shtml <http://www.ncl.ucar.edu/Document/Functions/Built-in/cd_inv_calendar.shtml>
>> 
>> Some of the examples on the above page should help you.
>> 
>> To get the required year, month, day, hour, minutes, and seconds arrays, you will need to parse the "time" array in the same fashion that you parsed the CSV file.
>> 
>> For example:
>> 
>>   month = str_get_field(time,1,"/")
>>   day   = str_get_field(time,2,"/")
>>   year  = str_get_field(time,3,"/ ")  ; note the use of both '/' and ' ' as delimiters
>> 
>> --Mary
>> 
>> On Wed, Nov 11, 2015 at 8:25 AM, Amadou Coulibaly <mpapin24 at gmail.com <mailto:mpapin24 at gmail.com>> wrote:
>> Dear NCL users,
>> 
>> I am trying to use cd_calendar for my dataset to be able to plot daily timeseries. But I have a problem converting my Timstamp, which is in the format 10/05/2014 06:00:00, mm/dd/yyyy hh:MM:ss. I want to use it in the format time at units = "minuts since 2014-10-05 06:00:00" with dates = cd_calendar(Time, 0) as specifying in my script (readcsv.ncl). Please, find attached a sample of my data and script.
>> 
>> 
>> How to solve this issue?
>> 
>> Best regards 
>> 
>> -- 
>>  COULIBALY   AMADOU   
>> PhD  Student  on  West  African  Climate  System (WACS)
>> FUTA - Federal  University  of  Technology of Akure, Nigeria
>> 
>> Visiting Student - University of Cologne, Germany
>> Institute of Geophysics and Meteorology
>> Pohligstr. 3 / Office 3.102
>> D-50969 Köln
>> 
>> Project: WASCAL (West African Science Service Centre on Climate Change and Adapted Land Use) 
>> Phone:(+234) 810 795 2836 <tel:%28%2B234%29%20810%20795%202836> /(+223) 65 67 27 57 <tel:%28%2B223%29%2065%2067%2027%2057> /(+226) 64 57 37 27 <tel:%28%2B226%29%2064%2057%2037%2027> /+49 15218352574 <tel:%2B49%2015218352574>
>> 
>> E-mail: mpapin24 at gmail.com <mailto:mpapin24 at gmail.com> / coulibalya68 at yahoo.com <mailto:coulibalya68 at yahoo.com> 
>> 
>> "The time is always right to do right": Nelson Mandela
>> 
>> "Character is like a tree and reputation like a shadow.  The shadow is what we think of it; the tree is the real thing" : Abraham Lincoln
>> 
>> "Do what you can, with what you have, where you are" Theodore Roosevelt
>> 
>>  
>> 
>>  
>> 
>>  
>> 
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>> 
>> 
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151111/9af512d0/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cd_inv_string.ncl
Type: application/octet-stream
Size: 4268 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151111/9af512d0/attachment.obj 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151111/9af512d0/attachment-0001.html 


More information about the ncl-talk mailing list