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

Quadtree read/write, no build #226

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open

Quadtree read/write, no build #226

wants to merge 27 commits into from

Conversation

roeldegoede
Copy link
Collaborator

Issue addressed

Fixes #

Explanation

Explain how you addressed the bug/feature request, what choices you made and why.

Checklist

  • Updated tests or added new tests
  • Branch is up to date with main
  • Updated documentation if needed
  • Updated changelog.rst if needed

Additional Notes (optional)

Add any additional notes or information that may be helpful.

@roeldegoede
Copy link
Collaborator Author

Done

  • Contains reading/writing of Quadtree files
  • Reading/writing of Quadtree subgrid files
  • New property bbox that can be used to clip for example forcing data
  • Up to date with other open PRs and main branch

Not working/testes:

  • Plot basemap
  • Read results

@roeldegoede roeldegoede requested a review from Leynse November 29, 2024 16:48
Copy link
Collaborator

@Leynse Leynse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work Roel!

Looks good and as discussed

tests/data/sfincs_test_quadtree/sfincs_log.txt Outdated Show resolved Hide resolved
* bugfix so that the .nc file is closed automatically when erroring or when leaving the context manager (with block). see pydata/xarray#1629 (comment)

* fixed all occurences of xr.opendataset with the safe open&close pattern

* review comments by Roel

* fix linting

---------

Co-authored-by: roeldegoede <[email protected]>
@@ -3126,7 +3196,7 @@ def read_forcing(self, data_vars: List = None):
elif name in ["netbndbzsbzi", "netsrcdis"]:
ds = GeoDataset.from_netcdf(fn, crs=self.crs, chunks="auto")
else:
ds = xr.open_dataset(fn, chunks="auto")
ds = xr.load_dataset(fn, chunks="auto")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LuukBlom zou dit niet ook zo'n indented statement geweest moeten zijn?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nee, hier wordt in 1x de hele ds geladen, dus load_dataset is prima hier vgm.

docs xarray zeggen dit:
Open, load into memory, and close a Dataset from a file or file-like object.

This is a thin wrapper around open_dataset(). It differs from open_dataset in that it loads the Dataset into memory, closes the file, and returns the Dataset. In contrast, open_dataset keeps the file handle open and lazy loads its contents. All parameters are passed directly to open_dataset. See that documentation for further details.

https://docs.xarray.dev/en/stable/generated/[xarray.load_dataset](https://docs.xarray.dev/en/stable/generated/xarray.load_dataset.html).html

* added xu_open_dataset wrapper.

* load_dataset -> open_dataset

* linting

---------

Co-authored-by: roeldegoede <[email protected]>
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

Successfully merging this pull request may close these issues.

4 participants