[ncl-talk] About local time (UTC+9)

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Thu Feb 16 20:32:07 MST 2017


Great.  Sorry I got off on the wrong track earlier.

--Dave


On Thu, Feb 16, 2017 at 8:11 PM, isakhar sakhar isakhar <
isakhar.inside13 at gmail.com> wrote:

> Dear Mr.Dave and Mr.Rick
>
> It's working. It's solved now.
>
> Thank you very much.
>
> Best regards,
> Soares
>
> On Fri, Feb 10, 2017 at 4:20 AM, Dave Allured - NOAA Affiliate <
> dave.allured at noaa.gov> wrote:
>
>> Soares,
>>
>> Never mind about those print statements.  This problem was already
>> solved.  Please follow the instructions in this message:
>>
>> http://mailman.ucar.edu/pipermail/ncl-talk/2016-September/006863.html
>>
>> --Dave
>>
>>
>> On Thu, Feb 9, 2017 at 10:15 AM, Dave Allured - NOAA Affiliate <
>> dave.allured at noaa.gov> wrote:
>>
>>> Oops, my mistake.  Can you please tell me whether the input file
>>> contains numeric time coordinates, or only character time coordinates?  It
>>> is much easier to calculate offset times if the numeric time coordinates
>>> are already calculated.
>>>
>>> Right after addfile, try printFileVarSummary (in, "U").  If tjhat does
>>> not work, try printFileVarSummary (in, "UU").  The first subscript in the
>>> variable gets you the name of the time dimension.
>>>
>>> Then try printFileVarSummary (in, "TIME") where you replace TIME with
>>> the actual name of the time dimension.  Then please show us the output from
>>> only that command.
>>>
>>> If that does not work, you can try manually searching for a numeric time
>>> coordinate.  print (in) shows you a summary of all variables in the file.
>>> Scroll through that list by pressing the space bar until you get to the
>>> end.  Look for a variable with "time" in the name; a numeric type such as
>>> double, float, or integer; and units attribute like "days since" or "hours
>>> since".  Then show the complete printed description for that variable.
>>>
>>> --Dave
>>>
>>>
>>> On Wed, Feb 8, 2017 at 8:47 PM, isakhar sakhar isakhar <
>>> isakhar.inside13 at gmail.com> wrote:
>>>
>>>> Dear Mr.Dave
>>>>
>>>> By following your instruction I get complete output as in attachment
>>>> (output.script.txt).
>>>>
>>>> Best regards,
>>>> Soares
>>>>
>>>>
>>>> On Thu, Feb 9, 2017 at 10:42 AM, Dave Allured - NOAA Affiliate <
>>>> dave.allured at noaa.gov> wrote:
>>>>
>>>>> Also I see another problem.  In these two lines which I just sent,
>>>>> make sure you have ASCII straight double quotes (") in the script before
>>>>> you run it.  I think I sent you curly double quotes (UTF-8) by mistake.
>>>>>
>>>>>     time_numeric = cd_inv_string (times, "%Y%N%D%H%M")
>>>>>     offset_times = cd_string (time_numeric, "%Y%N%D%H%M" )
>>>>>
>>>>> --Dave
>>>>>
>>>>>
>>>>> On Wed, Feb 8, 2017 at 6:29 PM, Dave Allured - NOAA Affiliate <
>>>>> dave.allured at noaa.gov> wrote:
>>>>>
>>>>>> Soares,
>>>>>>
>>>>>> Please insert this right below "ntimes = dimsizes(times)":
>>>>>>
>>>>>>     print (times(0:2))
>>>>>>     time_numeric = cd_inv_string (times, “%Y%N%D%H%M”)
>>>>>>     print (time_numeric(0:2))
>>>>>>
>>>>>>     offset = -9    ; hours
>>>>>>     time_numeric = time_numeric - offset
>>>>>>     offset_times = cd_string (time_numeric, “%Y%N%D%H%M” )
>>>>>>     print (offset_times(0:2))
>>>>>>     exit
>>>>>>
>>>>>> Then run it and show us the complete output, including all normal and
>>>>>> error messages.
>>>>>>
>>>>>> --Dave
>>>>>>
>>>>>>
>>>>>> On Wed, Feb 8, 2017 at 5:18 PM, isakhar sakhar isakhar <
>>>>>> isakhar.inside13 at gmail.com> wrote:
>>>>>>
>>>>>>> Dear Mr.Rick
>>>>>>>
>>>>>>> That is I mean, I want to use the ntimes to call cd_string because
>>>>>>> of my wrfout file is in UTC but I want to get the output result in UTC+9.
>>>>>>> I have active load above my script but it does not change anything.
>>>>>>>
>>>>>>> Any help will appreciate,
>>>>>>>
>>>>>>> Regards,
>>>>>>> Soares
>>>>>>>
>>>>>>> On Wed, Jan 25, 2017 at 11:29 PM, Rick Brownrigg <brownrig at ucar.edu>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I'm not sure what you are trying to do, but this part does not seem
>>>>>>>> right:
>>>>>>>>
>>>>>>>>    do it = 0,ntimes-1                ;Loop for the time: it=
>>>>>>>> starting time
>>>>>>>>       time = it
>>>>>>>>       time_numeric=cd_string(time(0),"%Y%N%D%H%M")
>>>>>>>>
>>>>>>>> "time" would be an integer scalar (although in NCL, all scalars are
>>>>>>>> arrays of dimension 1, so notation like time(0) is not a syntax/semantic
>>>>>>>> error), but time certainly will not have the requisite "units" attribute.
>>>>>>>> Did you perhaps mean to specify "ntimes(it)" in the call to cd_string()?
>>>>>>>>
>>>>>>>> Rick
>>>>>>>>
>>>>>>>> On Tue, Jan 24, 2017 at 11:28 PM, isakhar sakhar isakhar <
>>>>>>>> isakhar.inside13 at gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Dear Mr.Dave
>>>>>>>>>
>>>>>>>>> I am very for asking a lot, I have tried my best but I still face
>>>>>>>>> the error even I already have the line '/usr/share/ncarg/nclscripts/contrib/cd_string.ncl'
>>>>>>>>> on my top script. I still use NCL version 6.1.2.
>>>>>>>>>
>>>>>>>>> I face error say:
>>>>>>>>>
>>>>>>>>> cd_string: The variable containing time values must have a 'units'
>>>>>>>>> attribute.
>>>>>>>>> fatal:Illegal right-hand side type for assignment
>>>>>>>>> fatal:["Execute.c":8128]:Execute: Error occurred at or near line
>>>>>>>>> 33 in file script.ncl
>>>>>>>>>
>>>>>>>>> My script file in attachment.
>>>>>>>>> Thanks
>>>>>>>>>
>>>>>>>>> regards,
>>>>>>>>> Soares
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Wed, Jan 25, 2017 at 5:46 AM, Dave Allured - NOAA Affiliate <
>>>>>>>>> dave.allured at noaa.gov> wrote:
>>>>>>>>>
>>>>>>>>>> Soares,
>>>>>>>>>>
>>>>>>>>>> Also show the output from print (time(0)) before you call
>>>>>>>>>> cd_string.
>>>>>>>>>>
>>>>>>>>>> --Dave
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Tue, Jan 24, 2017 at 1:29 PM, Dave Allured - NOAA Affiliate <
>>>>>>>>>> dave.allured at noaa.gov> wrote:
>>>>>>>>>>
>>>>>>>>>>> Soares,
>>>>>>>>>>>
>>>>>>>>>>> The documentation for cd_string says that you must have this
>>>>>>>>>>> line at the top of your program:
>>>>>>>>>>>
>>>>>>>>>>>    load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/cd_string.ncl"
>>>>>>>>>>>
>>>>>>>>>>> If that does not solve your problem, then please show:
>>>>>>>>>>>
>>>>>>>>>>> 1.  Complete console output up to the point of error.  This
>>>>>>>>>>> should include the command to run your program, and the NCL version number.
>>>>>>>>>>>
>>>>>>>>>>> 2.  A complete copy of your NCL script, or a reduced test script
>>>>>>>>>>> that just shows this error.
>>>>>>>>>>>
>>>>>>>>>>> --Dave
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Mon, Jan 23, 2017 at 9:28 PM, isakhar sakhar isakhar <
>>>>>>>>>>> isakhar.inside13 at gmail.com> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Dear Mr. Dave
>>>>>>>>>>>>
>>>>>>>>>>>> I have modified the syntax to cd_string but I still face the
>>>>>>>>>>>> error 'fatal:Undefined identifier: (cd_string) is undefined, can't continue'
>>>>>>>>>>>>
>>>>>>>>>>>> time_numeric=cd_string(time,"%Y%N%D%H%M")  ;; will return in
>>>>>>>>>>>> hours since 1800-01-01 unless specified otherwise
>>>>>>>>>>>> offset=-9    ; hours
>>>>>>>>>>>> time_numeric =time_numeric-offset
>>>>>>>>>>>>
>>>>>>>>>>>> time=cd_string(time_numeric,"%Y%N%D%H%M")
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Soares
>>>>>>>>>>>>
>>>>>>>>>>>> On Tue, Jan 24, 2017 at 12:39 PM, Dave Allured - NOAA Affiliate
>>>>>>>>>>>> <dave.allured at noaa.gov> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Soares,
>>>>>>>>>>>>>
>>>>>>>>>>>>> The function cd_inv_string is in the next NCL release.  It is
>>>>>>>>>>>>> not available in the current release 6.3.0.  That is why you are getting a
>>>>>>>>>>>>> syntax error.
>>>>>>>>>>>>>
>>>>>>>>>>>>> If your data already has date/time in numeric format as hours
>>>>>>>>>>>>> since XXX, then you might be able to directly subtract the offset and use
>>>>>>>>>>>>> cd_string to print the times that you want.
>>>>>>>>>>>>>
>>>>>>>>>>>>> --Dave
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Mon, Jan 23, 2017 at 8:07 PM, isakhar sakhar isakhar <
>>>>>>>>>>>>> isakhar.inside13 at gmail.com> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Dear Mr.Dennis
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I have a wrfout data and it is in UTC. I want to print in my
>>>>>>>>>>>>>> local time (UTC+9). I already have the file cd_inv_string.ncl and already
>>>>>>>>>>>>>> load it in my top of file. I also adjust as below to the my local time but
>>>>>>>>>>>>>> I still face the error.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> time_numeric=cd_inv_string(ntimes,“%Y%N%D%H%M”)  ;; will
>>>>>>>>>>>>>> return in hours since 1800-01-01 unless specified otherwise
>>>>>>>>>>>>>> offset=-9    ; hours
>>>>>>>>>>>>>> time_numeric =time_numeric-offset
>>>>>>>>>>>>>> time=cd_string(time_numeric,“%Y%N%D%H%M” )
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I got the error say: fatal:syntax error: line 34 in file
>>>>>>>>>>>>>> script.ncl before or near �
>>>>>>>>>>>>>> time_numeric=cd_inv_string(time,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> My file in attachment.
>>>>>>>>>>>>>> Really appreciate for any help.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Big thanks
>>>>>>>>>>>>>> Soares
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170216/f84d4148/attachment.html 


More information about the ncl-talk mailing list