[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 20051010:netCDF General - IDL pointers and netCDF files
- Subject: Re: 20051010:netCDF General - IDL pointers and netCDF files
- Date: Tue, 11 Oct 2005 08:05:13 -0600
Unidata Support <address@hidden> writes:
> ------- Forwarded Message
>
>>To: address@hidden
>>From: "Lon Riesberg" <address@hidden>
>>Subject: netCDF General - IDL pointers and netCDF files
>>Organization: UCAR/Unidata
>>Keywords: 200510101932.j9AJWUo8005350
>
> Institution: University of Colorado - Laboratory for Atmospheric Space and
> Physics
> Package Version: N/A
> Operating System: OS X
> Hardware Information: Mac
> Inquiry: Hello,
>
> I\'m working on an application that writes IDL structures to a
> netCDF file and I have a quick question about the netCDF file
> structure. I\'ve spent quite a bit of time searching documentation
> and web forums and I just need to verify that I understand this
> correctly...
OK.
>
> One of my structure fields is a pointer to an array. The arrays are
>2-dimensional and will occassionally have different dimensions. From
>my understanding, all of the netCDF variables need to have the same
>dimensions so I\'m planning to dereference the array pointers and
>determine the largest array dimensions before defining netCDF
>variables. Then I\'ll use fill data for the smaller arrays.
>Finally, the IDL structures will be written to the netCDF file, along
>with the filled arrays.
Oh no, that's not true at all. The variables don't have to have the
same dimensions.
You call nc_def_dim for each dimension. For each dimension you will
get an id, the dimid.
When calling nc_def_var you pass the number of dims in that var, and
and array with the dimids.
You can define dozens of dimensions, or more, and mix and match when
creating variables.
The only problem is that there can be only one unlimited dimension in
the file. But since you seem to imply that you know all your
dimensionality in advance, that won't be a problem.
>
> I\'d define an attribute for the array variables that states that
> the fill data value is invalid.
Sorry, not sure what the connection is between fill value and the
above. However, if you simply refrain from defining a FillValue
attribute, the library will use default fill values.
>
> Functionally, this should work but is it valid netCDF? Also,
> there\'s a lot of overhead with this approach but this looks like
> the only valid way to do this. Is that correct??
>
> Thanks for any insights.
>
> -Lon
Define a dimension for each unique axis in your data, and then mix and
match to create your variables. It's very straightforward and will be
the easiest thing for you to do.
Let me know if you have further questions!
Good luck!
Ed
--
Ed Hartnett -- address@hidden