juseg / hyoga

Paleoglacier modelling framework
https://hyoga.io
GNU General Public License v3.0
8 stars 0 forks source link

Make dataset plot methods available as functions. #23

Closed juseg closed 1 year ago

juseg commented 1 year ago

Make ~dataset~ ~plot~ methods Dataset.hyoga.plot.method(self, ...) available as functions hyoga.plot.function(ds, ...).

juseg commented 1 year ago

I am planning to do it for plot methods only. My idea is that v0.2 will ship with a variety of unbound plot functions for vectors (Natural Earth, paleoglaciers, shapefiles) not using datasets. Instead of mixing object-oriented and unbound code:

import hyoga.plot
ds.hyoga.plot.ice_margin()
hyoga.plot.rivers()

Some users might prefer a fully non-oo equivalent:

import hyoga.plot
hyoga.plot.ice_margin(ds)
hyoga.plot.rivers()

On the other hand something like hyoga.calc.interp(ds) would require a new module hyoga.calc (or many top-level functions). I don't see anything that would fit in hyoga.calc but not in ds.hyoga. Forgetting about hyoga.calc.

juseg commented 1 year ago

I am backtracking on this one (see 6a61dcb). Thanks to GeoPandas (#24) shapefiles can be plotted as objects. This beautifully removes the need for any non-object-oriented plot interface (that hyoga.plot would have been). Hyoga will stick object-oriented plotting.