[ncl-talk] Using WRAPIT with string variables

Barry Lynn barry.h.lynn at gmail.com
Wed Aug 2 06:13:04 MDT 2017


Hi:

As you may have read before, you can't pass string variables through the
subroutine call using WRAPIT.  Perhaps you could pass a single character,
but I am not sure.

There is a simple way around this.

One can produce a csv file through a simple write statement in the *.f
program.  Then, open the file in ncl.

A one line output (here).

 Tel Aviv University           ,  Mostly Sunny       ,

Then, you can read it in the ncl program this way.

  asc_file = "weather_type.csv"

  lines = asciiread(asc_file,-1,"string")

  print(lines)

  delim = ","

  station    = str_get_field(lines,1,delim)

  weather_type    = str_get_field(lines,2,delim)

  print("station = " + station)

  print("weather_type = " + weather_type)


Just in case you want to read in a real value, you can do the following.

Latitude = tofloat(str_get_field(lines,2,delim))

)



-- 
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/20170802/66cd9ca9/attachment.html 


More information about the ncl-talk mailing list