Re: strings questions

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Wed, 20 Sep 2006 14:52:44 -0600

Hi Kate,

I think I have answers to your first 2 questions:

1) Try adding the the following code to your .nc write out section:

spherical!0 = "spherical"
spherical&spherical = spherical

That should result in the .nc file looking like this:

variables:
    char spherical(spherical) ;
         spherical:long_name = "Grid type logical switch"

2) The NCL developers can correct me if I wrong, but I do believe that
the netCDF3 conventions do not allow any other dimension other than time
to be unlimited.

Good luck,
Adam

Kate Hedstrom wrote:
> I have an NCL program to convert a grid created by gridgen
> (http://www.marine.csiro.au/~sakov/) into a format that ROMS can use.
> There are a few nagging things about string handling that I'm not
> 100% happy with. First of all, we want to have:
>
> char spherical ;
> spherical:long_name = "Grid type logical switch" ;
>
> and instead I have:
>
> ncl10 = 2 ;
>
> char spherical(ncl10) ;
> spherical:long_name = "Grid type logical switch" ;
>
> Is there any way to have a scalar character?
>
> Second, I was hoping to have a string (or character array) that is
> dimensioned (/ bath, stringlen /) with bath being an unlimited
> dimension. I'm using the unlimited dimension to contain working
> bathymetries and would like a description of each one. Here is what
> did and didn't work:
>
> filedimdef(ncid, "bath", -1, True)
> ; delete(dims)
> ; filedimdef(ncid, "stringlen", 80, False)
> ; dims = (/ "bath", "stringlen" /)
> ; filevardef(ncid, "bath_history", "character", dims)
> ; str = new((/ 80 /), "character")
> ; str = stringtochar("Flat bottom")
> ; ncid->bath_history(0,:) = str
> fileAtt = True
> fileAtt_at_bath_history_0 = "Flat bottom"
> fileattdef(ncid, fileAtt)
>
> The commented out code complained about a mismatch in array lengths.
>
> Third, the next step is an inverse map projection. NCAR graphics
> provides access to mapinv but I'm not finding anything similar in
> NCL. I was hoping to avoid using WRAPIT and requiring extra packages
> if at all possible, plus I want the double precision of NCL.
>
> Thanks!
> Kate

-- 
--------------------------------------------------------------
Adam Phillips			             asphilli_at_ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
ESSL/CGD/CAS                               fax: (303) 497-1333
P.O. Box 3000				
Boulder, CO 80307-3000	  http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Sep 20 2006 - 14:52:44 MDT

This archive was generated by hypermail 2.2.0 : Mon Sep 25 2006 - 11:45:07 MDT