Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding geometry to dataset baseclass #179

Open
Peter9192 opened this issue Aug 11, 2023 · 1 comment
Open

Adding geometry to dataset baseclass #179

Peter9192 opened this issue Aug 11, 2023 · 1 comment

Comments

@Peter9192
Copy link
Collaborator

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
Copy link
Collaborator Author

#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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant