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

GridModel; HydroMT 0.9 compliant; Deprecated PCR; Ubuntu testing #211

Merged
merged 30 commits into from
Nov 16, 2023

Conversation

dalmijn
Copy link
Collaborator

@dalmijn dalmijn commented Oct 20, 2023

Issue addressed

Fixes #160

Explanation

Inherent from GridModel; adjusted methods and properties

Checklist

  • Updated tests or added new tests
  • Branch is up to date with main
  • Tests & pre-commit hooks pass
  • Updated documentation if needed

Well, the important tests pass, but there is something with testing against core version 0.9 that causes issues...

Additional Notes (optional)

Add any additional notes or information that may be helpful.

@dalmijn dalmijn changed the title Switched to gridmodel; deprecated pcr methods GridModel; HydroMT 0.9 compliant; Deprecated PCR; Ubuntu testing Oct 20, 2023
Copy link

@savente93 savente93 left a comment

Choose a reason for hiding this comment

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

I only skimmed the code since I can't really meaninfully review that, but most of it seems fine. I left a couple of comments that you may or may not want to do anything with. The workflows are mostly fine except the stest stable. I'm not sure that one actually does anything (or at least not what you think it does) we might have to pair up and look at that together some time so you can walk me through it. Otherwise LGTM

examples/linux64/wflow_piave_subbasin/log.txt Show resolved Hide resolved
.actrc Outdated Show resolved Hide resolved
examples/linux64/wflow_piave_clip/wflow_sbm.toml Outdated Show resolved Hide resolved

Choose a reason for hiding this comment

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

In general it is considered bad practice to keep output and/or binaries in the repository, especially if they change often, git cannot deal with blobs as efficently as other types of data. Given they are this small I think it's fine, but if it changes a lot you might want to consider moving these to git LFS. I won't repeat it, but the same comment applies to all output files in this PR

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree, it should be something for an overhaul of the tests.

Comment on lines 86 to 93
for lib, version in artifact_keys.items():
warnings.warn(
"Adding a predefined data catalog as key-word argument is deprecated, "
f"add the catalog as '{lib}={version}'"
" to the data_libs list instead.",
DeprecationWarning,
stacklevel=2,
)

Choose a reason for hiding this comment

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

Given that you also run super().__init__() this might lead to duplicated warnings, I'm not sure, but it would be good to double check

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will look at that.

Comment on lines 79 to 85
@pytest.fixture()
def floodplain1d_testdata():
data = xr.load_dataset(
join(TESTDATADIR, "floodplain_layers.nc"),
join(TESTDATADIR, SUBDIR, "floodplain_layers.nc"),
lock=False,
mode="r",
)

Choose a reason for hiding this comment

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

FYI: fixtures are scoped by module not by test by default in pytest so if you modify this in any way other tests will see that modification. Recently had to find out the hard way. You can add a scope argument to the fixture to change this. Not necessary but wanted to mention it anyway.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Also something for a tests overhaul.

Comment on lines +29 to +40
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest" ] #, "macos-latest", "windows-latest"]
python-version: ['3.11']
include:
- os: ubuntu-latest
label: linux-64
prefix: /usr/share/miniconda3/envs/hydromt_wflow

name: ${{ matrix.label }}
runs-on: ${{ matrix.os }}

Choose a reason for hiding this comment

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

if you only test for one version an done os a matrix here is not necessary, but ti does make it easier to add those down the line. up to you whether you want to keep it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I like the fact that it gives me some variables to work with. but en general you're right.

Comment on lines +69 to +70
export PATH=/usr/share/miniconda3/bin:$PATH
PYTHONPYCACHEPREFIX=~/pycache mamba run -n hydromt_wflow sphinx-build ./docs ./docs/_build -b dummy

Choose a reason for hiding this comment

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

You don't seem to use the same caching strategy as core so the export and cache previx is not necessary here. if you want me to explain why this is necessary in core but not here ping me

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will do. Will look at that.

Comment on lines 49 to 50
run: pip install tomli && python make_env.py test --py-version ${{ matrix.python-version }}.*

Choose a reason for hiding this comment

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

I have a slight susspiscion this is going to break since .* is a glob in bash, so it is probably going to expand to things you don't expect. I think the make_env.py in core now has a update to deal with this, if not please ping me and I'll make one. If you want to keep this patern you should wrap it in quotes at least

.github/workflows/test_stable.yml Outdated Show resolved Hide resolved
Copy link
Collaborator

@JoostBuitink JoostBuitink left a comment

Choose a reason for hiding this comment

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

Looks good to me! Two things that need fixing, both related to the docs:

  • Update convert_staticmaps_to_mapstack.ipynb to reflect the new way to deal with PCRaster files
  • build_sediment.ipynb currently fails at the part where we add layers to a wflow model. I don't directly see where it goes wrong, but should hopefully be easy to fix

Perhaps also good to note (in the changelog maybe) that these changes need hydromt v0.9.1 (that is currently not yet released).

@dalmijn dalmijn requested a review from savente93 November 15, 2023 13:21
Copy link

@savente93 savente93 left a comment

Choose a reason for hiding this comment

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

LGTM

@dalmijn dalmijn merged commit a112260 into main Nov 16, 2023
4 of 6 checks passed
@JoostBuitink JoostBuitink deleted the gridmodel branch November 21, 2023 15:33
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.

3 participants