Re: [netcdfgroup] storing sparse matrices data in NetCDF

You could define a netCDF file with:
- Two dimensions: ID of length 20,000 and time, of length 365.
- The coordinate variables (integer) ID(ID) and (float or double)
time(time).
- Then the static (float or double) variables x(ID), y(ID), lat(ID), and
lon(ID).
- Finally the two dimensional variable (float or double) runoff(time,ID).
- You may want to create at least two attributes per variable: long_name,
and units.
- For the time variable you may want to add also a calendar attribute.
- You can also add global attributes (for the whole file) describing the
nature of the data, etc.
If you're using Python from conda, you will need the netcdf4 and netcdftime
(available for Python 2.7 and 3.6, not 3.7) packages.
Python dates don't match well netcdf time convention, hence you need
netcdftime.
You could use netCDF time units like "days since 01-01-1980", and the time
variable values would go: 0.0, 1.0, 2.0, ..., 19999.0
Calendar could be "gregorian" or "noleap", depending on whether you have or
not
Feb/29 on leap years.
The other variables can be read directly from their CSV values.

On Mon, Mar 18, 2019 at 4:57 PM Ken Mankoff <mankoff@xxxxxxxxx> wrote:

>
> On 2019-03-18 at 13:12 -0700, Sourish Basu <Sourish.Basu@xxxxxxxxxxxx>
> wrote...
> > In your example dataset, there are five values for the time
> > coordinate. However, the values of x, y, lat, lon, and elev do not
> > seem to depend on the values of time. Is this true in general for your
> > data? If that's true (while still allowing x, y etc. to vary from year
> > to year, or file to file), that makes packaging even simpler.
>
> Correct. There are 6 header rows that *never* change: ID, lon,lat, x,y,
> elev. There is 1 index column that is date. Then the data that is a
> function of (ID,date) (or ((lon,lat),date), or ((x,y),date)) does change.
>
>   -k.
>
> _______________________________________________
> 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/
>
  • 2019 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: