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

Fix formatting of cice grid file #18

Merged
merged 7 commits into from
Apr 25, 2024
Merged

Conversation

anton-seaice
Copy link
Contributor

@anton-seaice anton-seaice commented Apr 22, 2024

This PR fixes two issues:

  • In CICE6, angle of t-cell is called anglet however in the cice5-auscom build, we called this angleT.
  • To make it easier to combine this file with cice history output, use names ni, nj for x and y dimensions. In conjunction with CICE config for CICE6.5 ACCESS-NRI/access-om3-configs#54, this should allow a straight / no-warnings xr.merge of the grid with history output. Thanks to @aidanheerdegen for the suggestion.

Closes #16

Copy link

codecov bot commented Apr 22, 2024

Codecov Report

Attention: Patch coverage is 6.66667% with 14 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (main@f5d137f). Click here to learn what that means.

❗ Current head 569849e differs from pull request most recent head 5a71eae. Consider uploading reports for the commit 5a71eae to get more accurate results

Files Patch % Lines
esmgrids/cice_grid.py 8.33% 11 Missing ⚠️
esmgrids/cli.py 0.00% 3 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##             main     #18   +/-   ##
======================================
  Coverage        ?   3.38%           
======================================
  Files           ?      20           
  Lines           ?    1241           
  Branches        ?       0           
======================================
  Hits            ?      42           
  Misses          ?    1199           
  Partials        ?       0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

test/test_cice_grid.py Outdated Show resolved Hide resolved
@anton-seaice
Copy link
Contributor Author

@dougiesquire apologies for the many reviews. please look at #17 first.

@anton-seaice anton-seaice marked this pull request as ready for review April 23, 2024 01:54
Comment on lines 1 to 10
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: local
hooks:
- id: black
name: black
entry: black
language: system
types: [python]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Added in #17

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be fixed now

pyproject.toml Outdated
@@ -43,6 +42,7 @@ write_to = "esmgrids/_version.py"
devel = [
"flake8",
"black",
"pre-commit"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Added in #17

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be fixed now


if variant == "cice5-auscom":
angleT = self._create_2d_nc_var(f, "angleT")
else: # variant==cice6
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm assume you chose to do the switching with a string, rather than a binary cice6 = False because you want to allow for the potential for other variants in the future? If so, it might be worth explicitly doing elif variant == "cice6" and producing an error or warning otherwise. Or if it's only ever going to be binary (ie cice5-auscom or cice6) then the API should reflect that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. Ill make in a boolean ... its hard to be sure tho. There's 80% chance cice7 would use 'anglet' but maybe it won't, or we find some other fork we need to support that uses a different name.

Copy link
Collaborator

@dougiesquire dougiesquire Apr 24, 2024

Choose a reason for hiding this comment

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

Then maybe safest to leave as is but issue an error or warning (e.g. "unrecognised variant, defaulting to cice5-auscom") if it's not a recognised string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I want the default to be cice6, but I dont want to change the current interface. So if a variant is provided its set to cice6, if no variant then its cice5-auscom. A bit confusuing maybe. Let me know :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah I think that's a bit confusing. I think the default for an unrecognised variant should be the same as the method default. You could just make the method default variant="cice6" and for backwards compatibility someone would have to set variant="cice5-auscom"? That'll be more convenient for us going forward anyway right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that makes sense if you are happy with that? It just breaks back-ward compatibility?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think I'm fine with that. As far as we know all existing uses of this package are via a git submodule so won't be a problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok cice6 is now by default, cice5-auscom is optional. It raises an error on any other variant that is not cice5-auscom.

@anton-seaice anton-seaice merged commit 79f2952 into COSIMA:main Apr 25, 2024
4 checks passed
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.

Cice dimension names
2 participants