[ncl-talk] About local time (UTC+9)
Rick Brownrigg
brownrig at ucar.edu
Wed Jan 25 07:29:17 MST 2017
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
>>>>>>
>>>>>
>>
>
> _______________________________________________
> 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/20170125/3aab58f7/attachment.html
More information about the ncl-talk
mailing list