[ncl-talk] Creating Date String

Barry Lynn barry.h.lynn at gmail.com
Tue Nov 1 04:33:43 MDT 2016


Good Morning:

I went to this page

https://www.ncl.ucar.edu/Document/Functions/User_contributed/cd_string.shtml

and tried to do this:

For all the following examples, assume that *time* is an array of time
values.

*Example 1*

Using the default format string of "" will result in "HHMM UTC D Mon YYYY"
(e.g., 1800 UTC 4 Jul 1776):

  format = ""
  stime  = cd_string(time,format)

The goal is to plot the string "time_var" as shown below, as a single
variable.

But I get an error; please see below.

(Note: I thought (as a try) to stick this information in the "unitlabel"
parameter below, but I would really prefer to plot the date on the right
hand side at
the top of the map).

Here's my code.

;HHMM UTC D Mon YYYY
  time_array(0)=hour(1,1,1)
  time_array(1)=minute(1,1,1)
  time_array(2)=day(1,1,1)
  time_array(3)=month(1,1,1)
  time_array(4)=year(1,1,1)
  time_array(5)=units
; format = "HHMM UTC D Mon YYYY"
  format = ""
  *time_var=cd_string(time_array,format)*
  print("time_var = " + time_var)
  opts_ic_cg at FieldTitle           = "Lightning Rate"
; opts_ic_cg at UnitLabel            = "/10-min"
 * opts_ic_cg at UnitLabel            = time_var*

(0) Working on time: 2016-10-30_00:00:00
(0) cd_string: The variable containing time values must have a 'units'
attribute.
fatal:Illegal right-hand side type for assignment

After searching and finding:

http://www.ncl.ucar.edu/Document/Functions/User_contributed/time_axis_labels.shtml

*time*

An array containing the values of time. This variable should have an
attribute named "units". In other words, this variable holds the values of
the coordinate axis 'time' along with the units.


I am not sure what this error means or how to address the error.

Thank you.


-- 
Barry H. Lynn, Ph.D
Senior Lecturer,
The Institute of the Earth Science,
The Hebrew University of Jerusalem,
Givat Ram, Jerusalem 91904, Israel
Tel: 972 547 231 170
Fax: (972)-25662581

C.E.O, Weather It Is, LTD
Weather and Climate Focus
http://weather-it-is.com
Jerusalem, Israel
Local: 02 930 9525
Cell: 054 7 231 170
Int-IS: x972 2 930 9525
US 914 432 3108
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161101/a3fecc85/attachment.html 


More information about the ncl-talk mailing list