[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question about strings
- Subject: Re: Question about strings
- Date: Thu, 11 May 2006 10:33:24 -0600
Bastian Graupner <address@hidden> writes:
> Hello Ed,
>
> I am working with netCDF 3.6.1.
>
> To store data I created a dimension "parameter" with the length of 3
> for example. To avoid confusion between the parameters I want to use
> names instead of numbers by defining a coordinate variable. But if I
> declare the variable as CHAR I can't give a array of strings to the
> variable as it is possible for integers or floats. But if I want 3
> names for 3 parameters it is necessary to give an array to the
> variable.
>
> Is there a possibility to solve this problem?
>
> Thank you for your help.
>
> P.S. We have sunny and warm weather that doesn't make it easy to sit
> in an office!
>
> Bastian
Howdy Bastian!
I am shortly going to go out and enjoy the weather on my bike, but
meanwhile, let me try and answer some of your questions.
Do you have a good understanding of the netCDF data model? (Variables,
attributes, dimensions, and all that...) If not, you may wish to see:
http://www.unidata.ucar.edu/software/netcdf/docs/netcdf/The-NetCDF-Data-Model.html
As you note, you cannot store arrays of strings in NC_CHAR, only
arrays of char. If you want to store strings, what you can do is find
your max string length and store a 2D array of NC_CHAR, with the max
string length being one of the two dimensions. For more on strings and
other important topics, see the best practices page:
http://www.unidata.ucar.edu/software/netcdf/docs/BestPractices.html
Please let me know if this helped.
Thanks!
Ed
--
Ed Hartnett -- address@hidden