Richard,
Storing geometries inside netCDF is something I've also been thinking
about. I even went as far as to start writing some code to do this for
polygons (
https://github.com/bekozi/ncvec) using ragged arrays. Not CF I
know... Note, the code never got past the brainstorming phase. The method
did work well for interoperability with libraries like Shapely.
I also have some Python code for converting polygons from a watersheds
shapefile into the UGRID format (
https://github.com/ugrid-conventions/ugrid-conventions/blob/v0.9.0/ugrid-conventions.md#2d-flexible-mesh-mixed-triangles-quadrilaterals-etc-topology).
The major limitation here is that UGRID expects no gaps between the "faces"
which limits its ability to store multi-geometries (i.e. Hawaii). The code
for the conversion is not posted anywhere, but I can share it with you if
you are interested.
Anyway, I would be interested in staying in the loop on anything you do!
Thanks,
Ben
On Fri, Sep 19, 2014 at 3:43 PM, Signell, Richard <rsignell at usgs.gov> wrote:
> Jim,
>
> Awesome. And I guess if we save it as netcdf4 with deflation, it doesn't
> really matter how large we make the maximum number of vertices because all
> those fillValues at the end will compress very well.
>
> I'm still interested in why we switched from "cell_bounds" to "bounds", if
> indeed we did.
>
> Thanks,
> Rich
>
> On Fri, Sep 19, 2014 at 4:53 PM, Jim Biard <jbiard at cicsnc.org> wrote:
>
>> Richard,
>>
>> You can do this. Assuming you are storing the time series for more than
>> one watershed, you would have something like this (I lifted this largely
>> from Sections 7.1 and 7.2 in the CF Conventions document):
>>
>> dimensions:
>> time = -1;
>> sheds = 20;
>> npoly_verts = 2000; // This would be set to the maximum number of
>> vertices for any watershed.
>> variable:
>> float precip(time, sheds);
>> precip.cell_measures = "area: watershed_areas";
>> precip.cell_methods = "time area: sum"
>> precip.coordinates = "lat lon";
>>
>> time(time);
>> time.axis = "T";
>> time.standard_name = "time";
>> time.units = "days since ?????";
>> time.bounds = "time_bnds";
>>
>> float lon(cell); // This variable will contain a longitude to
>> associate with each watershed. Perhaps the center.
>> lon.standard_name = "longitude";
>> lon.units = "degrees_east";
>> lon.bounds = "watershed_lons";
>>
>> float lat(cell); // This variable will contain a latitude to
>> associate with each watershed. Perhaps the center.
>> lat.standard_name = "latitude";
>> lat.units = "degrees_north";
>> lat.bounds = "watershed_lats";
>>
>> float watershed_lons(cell, npoly_verts); // This variable will have
>> the bounding longitudes for each watershed.
>> watershed_lons._FillValue = -999.0; // Use this value for unused
>> elements.
>>
>> float watershed_lats(cell, npoly_verts); // This variable will have
>> the bounding latitudes for each watershed.
>> watershed_lats._FillValue = -999.0; // Use this value for unused
>> elements.
>>
>> float watershed_areas(cell); // This variable will have the area for
>> each watershed.
>> watershed_areas.standard_name = "area";
>> watershed_areas.units = "km2";
>>
>> I have left lots of attributes out. I hope this helps.
>>
>> Grace and peace,
>>
>> Jim
>> On 9/19/14, 4:09 PM, Signell, Richard wrote:
>>
>> Folks,
>> A colleague asked me if a time series of data associated with a
>> polygonal region (e.g. rainfall in a watershed) could be represented
>> in CF.
>>
>> So two questions:
>>
>> 1. Any reason this could be represented as a simple time series with a
>> cell_bounds = lon_verts, lat_verts
>> lon_verts(npoly_verts), lat_verts(npoly_verts)
>>
>> 2. I see an approved ticket from 4 years agohttps://cf-pcmdi.llnl.gov/trac/ticket/64
>> with "editorial correction" changing cell_bounds to bounds.
>> Does that mean that CF1.6 we use "cell_bounds" but in CF1.7 we will
>> use "bounds"?
>>
>>
>> --
>> [image: CICS-NC] <http://www.cicsnc.org/> Visit us on
>> Facebook <http://www.facebook.com/cicsnc> *Jim Biard*
>> *Research Scholar*
>> Cooperative Institute for Climate and Satellites NC <http://cicsnc.org/>
>> North Carolina State University <http://ncsu.edu/>
>> NOAA's National Climatic Data Center <http://ncdc.noaa.gov/>
>> 151 Patton Ave, Asheville, NC 28801
>> e: jbiard at cicsnc.org
>> o: +1 828 271 4900
>>
>>
>>
>>
>
>
> --
> Dr. Richard P. Signell (508) 457-2229
> USGS, 384 Woods Hole Rd.
> Woods Hole, MA 02543-1598
>
> _______________________________________________
> CF-metadata mailing list
> CF-metadata at cgd.ucar.edu
> http://mailman.cgd.ucar.edu/mailman/listinfo/cf-metadata
>
>
--
Ben Koziol
NESII/CIRES/NOAA Earth System Research Laboratory
ben.koziol at noaa.gov
<https://mail.google.com/mail/u/0/?view=cm&fs=1&tf=1&to=ben.koziol at noaa.gov>
802.392.4522
Skype: bwkoziol
http://www.esrl.noaa.gov/nesii/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cgd.ucar.edu/pipermail/cf-metadata/attachments/20140919/fd4baf1e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hhchjcab.png
Type: image/png
Size: 11847 bytes
Desc: not available
URL: <http://mailman.cgd.ucar.edu/pipermail/cf-metadata/attachments/20140919/fd4baf1e/attachment-0001.png>
Received on Fri Sep 19 2014 - 16:17:19 BST