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

Add CLI for days above tas indicator #48

Merged
merged 9 commits into from
Apr 15, 2024

Conversation

emileten
Copy link
Collaborator

@emileten emileten commented Apr 5, 2024

Solves #44

@joemoorhouse this is a draft PR but the general idea is here (I'm relying on google's fire module to create a CLI).

This will then be packaged in a docker container and OGC application package. The biggest questions are :

  • How big a given task can be. Right now it's set up to be one gcm/scenario/year.
  • How we are going to handle saving to an output zarr.

@emileten emileten self-assigned this Apr 12, 2024

default_dev_bucket = "physrisk-hazard-indicators-dev01"


class OscZarr(WriteDataArray):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@joemoorhouse I'd like to attract your attention to these two typing changes. I had to do these changes because mypy was failing. These new failures weren't due to my own changes, but because the CLI I added in this PR uses code that wasn't typed-checked before. More precisely, my CLI is essentially a copy of the launcher notebook, which wasn't typed check.

  • I changed the inherited class to ReadWriteDataArray because this is what IndicatorModel.run_all requires for its target argument type.
  • I changed store to any, following what zarr expects downstream.

If you see any problem with this let me know and I'll reopen a PR, but I'd like to move forward in the meanwhile.

@@ -31,7 +31,7 @@ def test_create_inventory(test_output_dir): # noqa: F811

# path = os.path.join(test_output_dir)

docs_store = DocStore(bucket=path, fs=local_fs, prefix="hazard")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@joemoorhouse again here we had a quite confusing pattern where, even for a local DocStore we had to pass a 'prefix' and a 'bucket'.

I changed things so that we can pass a local_path if fs is a local filesystem.

@emileten emileten merged commit 762fc46 into os-climate:main Apr 15, 2024
4 of 5 checks passed
@emileten emileten deleted the feat/cli branch April 15, 2024 12:39
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.

Expose a command line interface with one command to run days_above_tas indicator generation
1 participant