Re: Create NetCDF string variable?

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Wed Nov 14 2012 - 12:46:44 MST

Sorry for not responding to your follow-up question. Yes the same general idea should work for string arrays of any dimensionality.
 -dave

On Oct 30, 2012, at 10:40 AM, Daniel Gilmore wrote:

> Thanks, that definitely helps.
>
> Am I right in assuming that the same general idea also works with 2 dimensional arrays?
>
> Also, we're still using PyNio 1.3.1. This method will work with that version?
>
> Dan
>
> On Mon, Oct 29, 2012 at 4:19 PM, David Brown <dbrown@ucar.edu> wrote:
> Hi Dan,
> Currently PyNIO only supports the classic interface to NetCDF. Classic NetCDF only has a character type, not a string type. Therefore you must figure out in advance the longest string you have, and create the rightmost dimension with a size appropriate for the longest string. There is an example in the test directory that show how to write strings to a NetCDF file. It is not very long so I am attaching it here.
> -dave
>
>
>
> On Oct 29, 2012, at 6:24 AM, Daniel Gilmore wrote:
>
>> Could someone post an example of using PyNio to create a NetCDF string variable? I've tried:
>>
>> fh = Nio.open_file('foobar.nc','w')
>> fh.create_dimension('x',10)
>> fh.create_dimension('y',10)
>> fh.create_dimension('z',20)
>> dims = ('x','y','z')
>> fh.create_variable('hellostring','s',dims)
>>
>> And that is giving me an error. What am I doing wrong and what is the right way I should be doing it?
>>
>> Dan
>>
>> --
>> --
>> Daniel Gilmore (AceInfo Solutions)
>> PGB/MDL/OST/NWS/NOAA
>> Office #: SSMC2-10357
>> Phone: 301.713.0224 x101
>> Cell: 703.232.9603
>> _______________________________________________
>> pyngl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
>
>
>
>
>
> --
> --
> Daniel Gilmore (AceInfo Solutions)
> PGB/MDL/OST/NWS/NOAA
> Office #: SSMC2-10357
> Phone: 301.713.0224 x101
> Cell: 703.232.9603

_______________________________________________
pyngl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
Received on Wed Nov 14 12:46:51 2012

This archive was generated by hypermail 2.1.8 : Fri Dec 21 2012 - 10:43:45 MST