Re: Characters, strings, netcdf, wrf and bears - oh my

From: Correia, James <james.correia_at_nyahnyahspammersnyahnyah>
Date: Wed Feb 24 2010 - 16:03:30 MST

I figured it out:
Stringtochar returns an extra character, so this works:
Xt = stringtochar(xta)
Times(2,:) = xt(0:18)

jimmyc

On 2/24/10 2:55 PM, "James Correia" <james.correia@pnl.gov> wrote:

Hi all-
I have a WRF netcdf file I am trying to fix:

Times(2,0:18) = "2050-04-02_03:00:00" is what should appear in the netcdf
file. Instead it has: Times = ""

So I wrote up some ncl code to replace the missing characters.

Times = g->Times

 xt = new((/1/),"string")
 xt = "2050-04-02_03:00:00"
Times(2,:) = stringtochar(xt)

this should work in theory but it doesn't yielding a dimension mismatch with
the stringtochar(xt) yielding 20 elements and Times having only 19.

If I truncate:
Times(2,:) = stringtochar(xt(0:18))
Then I end up with a:
fatal: subscript out of range, error in subscript #0
fatal:An error occurred reading xt
fatal:execute: Error occurred at or near line 18 in file mod.ncl

How can I solve this problem?
Jimmyc

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Feb 24 16:03:05 2010

This archive was generated by hypermail 2.1.8 : Thu Feb 25 2010 - 09:38:32 MST