comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » writing fixed-length string arrays to netcdf-4
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: writing fixed-length string arrays to netcdf-4 [message #86402 is a reply to message #86394] Tue, 05 November 2013 10:34 Go to previous messageGo to previous message
Chris O'Dell is currently offline  Chris O'Dell
Messages: 5
Registered: August 2011
Junior Member
Thanks David! However, your program seems to require your special NetCDF libraries, which I downloaded and installed so I could run your test program. However, it still produces the same fundamental netCDF objects inside the actual netcdf file. The reason they come out as string arrays when you read them seems to be because of logic you have built into your netCDF reader. Something like, "When you encounter a field that is a n-dimensional array of characters (length 1 strings), interpret this as an array of strings, where the string length is the size of the first dimension". Something like that.

To prove this to you, I ran your program and took a screenshot of HDFView's look at the output file; HDFView (as you likely know) is a standard reader for HDF files which also works on netCDF-4 (which itself is built on HDF-5). The output shows that the internal storage is actually a 2D array of single characters. Which sounds fine, except I know from past experience that HDF-5 does support fixed-length strings of length > 1. I assumed that netCDF-4 did as well, but perhaps not. I really don't know. Maybe this is the way it has to be internally stored.

I will email you the screenshot directly , as I don't see a way to do attachments in this forum.

Thanks again,
Chris


On Monday, November 4, 2013 12:15:07 PM UTC-7, David Fanning wrote:
> By the way, I notice now you specifically were asking about netCDF-4
>
> files. To create these kinds of files with my ncdf_file object you have
>
> to set the /NETCDF4_FORMAT keyword when you open the file for writing.
>
> Doing so doesn't affect the results of either of the two programs I sent
>
> earlier.
>
>
>
> fileObj = Obj_New('ncdf_file', 'tester.nc', /Clobber, $
>
> /Create, /NETCDF4_FORMAT)
>
>
>
> Cheers,
>
>
>
> David
>
>
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Difficulty in succesfully creating a runtime app
Next Topic: derivative function in IDL similar as DIFF in matlab

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:38:43 PDT 2025

Total time taken to generate the page: 0.00402 seconds