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

create_regridding_dataset as a method of Grid #38

Closed
ahuang11 opened this issue Apr 20, 2024 · 1 comment · Fixed by #41
Closed

create_regridding_dataset as a method of Grid #38

ahuang11 opened this issue Apr 20, 2024 · 1 comment · Fixed by #41
Assignees
Labels
enhancement New feature or request

Comments

@ahuang11
Copy link
Member

ahuang11 commented Apr 20, 2024

Cool, convenient package! I was looking at the examples, and I am wondering whether Grid could simply contain the create_regridding_dataset util as a method instead of separately importing since dataclasses can also hold methods:

from xarray_regrid import Grid, create_regridding_dataset

new_grid = Grid(
    north=90,
    east=90,
    south=0,
    west=0,
    resolution_lat=1,
    resolution_lon=1,
)
target_dataset = create_regridding_dataset(new_grid)

to

from xarray_regrid import Grid

target_dataset = Grid(
    north=90,
    east=90,
    south=0,
    west=0,
    resolution_lat=1,
    resolution_lon=1,
).to_dataset()
@BSchilperoort
Copy link
Contributor

Good point! This would indeed be much more convenient.

@BSchilperoort BSchilperoort added the enhancement New feature or request label Apr 30, 2024
@BSchilperoort BSchilperoort self-assigned this Apr 30, 2024
BSchilperoort added a commit that referenced this issue Sep 4, 2024
* add nan_threshold option

* track nan frac across dims, use xr.dot, consolidate ds/da paths, tests

* fixes and cleanup plus initial notebook cell

* speed up by only tracking the max of nonnull points over non_regrid_dims

* fix tests for newer dependency versions

* Improve typing of call_on_dataset

* Fix typing in updated conservative routines

* Apply code formatting

* Ensure hashable is a valid input for coordinate identifier

* Make tests & typing pass

* Make `create_regridding_dataset` a method of `Grid` #38

* Update notebooks and dependencies

* Allow xesmf test to run if it's available

* Add @slevang to the contributors list

* Update changelog

* Ignore linter in test

* Update readme with badges and "why use..." text

---------

Co-authored-by: Sam Levang <slevang@salientpredictions.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants