phenology / springtime

Spatiotemporal phenology research with interpretable models
https://springtime.readthedocs.io
Apache License 2.0
3 stars 2 forks source link

Adding geometry to dataset baseclass #179

Open Peter9192 opened 1 year ago

Peter9192 commented 1 year ago

We could add geometry to the baseclass as a union of the three main geometries that we use now:

class Dataset(BaseModel, ABC):
    dataset: str
    years: Timerange. 
    geometry: Point | Area | PointList 
    resample: ResampleConfig

Then, for each data source, we could suffice with a single class with multiple loaders, e.g.

class EOBS(Dataset):
    def download():
        if isinstance(self.geometry, Area):
            self._download_area()

That would lead to a cleaner interface for the user. With a bit of work, we could try to make the geometry adhere (almost) to geojson.

Challenge: options for area or multipoint might need different other fields on the class. Opportunity: perhaps we could use multimethod to overload the load function for different geometries?

Peter9192 commented 8 months ago

192 already made a first step in this direction by treating Point and Points the same, and standardizing behaviour when points, area, or both are given.