ioos / APIRUS

API for Regular, Unstructured and Staggered model output (or API R US)
Creative Commons Zero v1.0 Universal
2 stars 1 forks source link

Low level API definitions? #14

Open ChrisBarker-NOAA opened 9 years ago

ChrisBarker-NOAA commented 9 years ago

In writing even the very start of an API, I"ve found that I need to specify things like bounding rectangles, polygons, etc....

Perhaps we need to specify some of the low-level API conventions, for instance:

We may also want some higher-level objects to represent some of these concepts -- for instance, I have a Bounding Box class that is a numpy array as above, but also has a bunch of handy functionality built in.

Also a PolygonSet object...

rhattersley commented 9 years ago

Perhaps a more flexible numpy dtype system would help here. :stuck_out_tongue_winking_eye:

PythonCHB commented 9 years ago

how so? an easier/more robust way to subclass ndarray would help, though ti seems it's been decided that that's pretty much impossible, and delegation is the way to go...

though my bounding box class is, in fact, a subclass of ndarray -- and it seems to work so far...

rhattersley commented 9 years ago

how so?

Hopefully it's obvious I wasn't being completely serious, but with all the recent fuss about dtypes it seemed like an interesting case where an "array of polygons" might be nicer to work with than an Nx2 array of numbers.

ChrisBarker-NOAA commented 9 years ago

yes it was obvious ;-)

-- but you're right, not totally off the map.

In fact, I do have what I call a polygon set, which is, kind of, an array of polygons. It needs some work to make it more powerful and flexible, but I'm not at all sure that making a polygon dtype would be the way to do that -- even with the up and coming all-powerful-and-flexible-dtype-system :-)