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

Export all layers of the prior in omGeoJSON.py #32

Merged
merged 5 commits into from
Jul 1, 2024
Merged

Conversation

aethr
Copy link
Contributor

@aethr aethr commented Jul 1, 2024

Description

This script is still just used as a debugging script, but exporting all layers gives us more data to debug with.

On one hand, we can visualise each layer distinctly in the front-end, allowing each layer to be checked visually. As a secondary benefit, each layer provides a distinct but realistic example of methane emissions that can be used as mock data for front-end development.

Checklist

Please confirm that this pull request has done the following:

  • [] Tests added
  • [] Documentation added (where applicable)

Note: I have not added tests, as this file is still only useful for debugging and I do not believe it forms part of the production workflow.

Notes

I attempted to update this script to work more like omDomainJSON.py which uses xarray to select the specific NetCDF layers we're interested in, however that approach wasn't easy because the variables in the prior output file don't all share the same dimensions.

@aethr aethr self-assigned this Jul 1, 2024
scripts/omGeoJSON.py Outdated Show resolved Hide resolved
scripts/omGeoJSON.py Outdated Show resolved Hide resolved
@aethr aethr requested a review from a team July 1, 2024 01:14

# There is a better way to do this but this will work for now
# Using xarray wasn't straightforward because the layers don't use
# the same attribute names, ie mixing x/y and lat/long.
Copy link
Collaborator

Choose a reason for hiding this comment

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

That needs to be fixed. The naming is incorrect, but the dimensions are the right size which makes it harder to handle than it should

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree, but not within the scope of this change. The code here should continue to work after layer names are changed due to its simplicity, so I'd like to leave it as-is for now.

Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

scripts/omGeoJSON.py Outdated Show resolved Hide resolved
aethr added 3 commits July 1, 2024 11:47
This script is still just used as a debugging script, but exporting all layers gives us more data to debug with.
Instead of writing out identical operations for each layer of the prior, use a list of known layers and apply the same logic to each layer programmatically.
These are aliases of the same function but max is more commonly used and understood.
aethr added 2 commits July 1, 2024 14:30
This typo caused python to construct a list instead of a single value.
By including the max values of each layer once as metadata, each grid cell's relative value can be calculated on the fly. It also makes it easier to understand the relative scale of each layer.
@aethr aethr merged commit f354d5d into main Jul 1, 2024
3 checks passed
@aethr aethr deleted the prior-geo-json-layers branch July 1, 2024 05:23
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.

None yet

2 participants