Re: [netcdfgroup] storing data in attributes

A couple of points.
If you store as attributes, then all of them will be stored
   in memory. If you store as variable(s), then the content
   will only be read in when requested. You might calculate
   how much total memory these attributes will take up.

Some alternative suggestions to consider assuming you are
using netcdf-4:
1. Store the key value pairs as a single attribute something
   of the form:
        String :config = "key1=value1;key2=value2;..."
2. Store the key value pairs as a single variable something like
   String var(unlimited,2);
   where N is the number of key+value pairs.
   Then the content of var would look something like this:
        var = {"key1","value1"}, {"key1","value1"},...

=Dennis Heimbigner
 Unidata

On 11/30/2017 1:22 PM, Chris Barker wrote:
what everyone else said, but:

    I want to store settings (metadata) containing 600+ key value pairs.____


key: value pairs are made for attributes.

    I could store them as attributes with a key and a 1D array of
    values, which has the advantage that I have all the metadata within
    the .nc file.

    In an extreme case the array will grow to a thousand entries.____


If you have an array of thousands of entries that map to a single key -- you should put that in a variable, not attributes.

You might use attributes to map the key to the particular variable name.

    Alternatively I would store the settings history in a separate text
    file.


definitely not!

-CHB



--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@xxxxxxxx <mailto:Chris.Barker@xxxxxxxx>


_______________________________________________
NOTE: All exchanges posted to Unidata maintained email lists are
recorded in the Unidata inquiry tracking system and made publicly
available through the web.  Users who post to any of the lists we
maintain are reminded to remove any personal information that they
do not want to be made public.


netcdfgroup mailing list
netcdfgroup@xxxxxxxxxxxxxxxx
For list information or to unsubscribe,  visit: 
http://www.unidata.ucar.edu/mailing_lists/




  • 2017 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: