-
Notifications
You must be signed in to change notification settings - Fork 19
Improved scripts to create initial conditions files #946
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
Open
einola
wants to merge
15
commits into
develop
Choose a base branch
from
issue945_init_scripts
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Just rewrite it a bit so that you have to call either make_cartesian_grid or make_geographic_grid before setting your variables. Only make_cartesian_grid implemented so far.
make_init_base.py can now handle NEMO files and produce vertex coordinates and the grid azimuth angle on a displaced pole.
Doc strings and miscellaneous cleaning. I also added two functions to get the grid centre longitude and latitude.
The script is now much shorter and also more generalised. But it expects the grid file to follow NEMO naming conventions for the coordinates.
This belongs with the commit before last.
make_init_base.py can now handle grids that only have lat/lon information at the grid cell centre. I do this by assuming everything is regular and that the vertices are +/- dx and dy away from the grid cell centre. I also updated make_init_geographic.py to be able to handle such grids.
The grid is up-side-down and we also need the reverse of the angle. Two minuses that make a plus, but now it's clearer why it all works (I hope).
I think it's useful for our NANUK setup.
The velocities need to have zeros on land, but the rest can have missing values.
# Conflicts: # run/interpolators.py # run/make_initNH.py # run/make_init_base.py
I did "ruff format --config ruff.toml ./" in the project base directory. This modified a lot of files, but I just picked the ones relevant for this PR.
This time, I did "ruff check --diff ./ > patch.diff" in the run directory, followed by "git apply patch.diff". That gave a different result to "ruff format". .
I won over Ruff in the end! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Improved scripts to create initial conditions files
Fixes #945
Task List
Change Description
Adds the functionality to make_init_base.py to make generic geographic grids, in addition to idealised ones. The user must supply lat/lon coordinates of the grid and may provide a mask and initial fields. The program can create nextsim grids from a grid of lat/lon coordinates or lat/lon coordinates of a NEMO C-grid (which also provides coordinates of the upper right corner of the grid box).
I also modified and renamed make_initNH.py to use make_init_base.py
Test Description
I used the script to recreate the grid of the integration test, as well as the grid from our NEMO-coupled setup and a few others. All of which run successfully.
Documentation Impact
The functionality of make_init_base.py should be documented in the usage section of the manual, but it is not.
Other Details
N/A
Pre-Request Checklist