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

Release 2.0 #68

Merged
merged 152 commits into from
Nov 22, 2024
Merged

Release 2.0 #68

merged 152 commits into from
Nov 22, 2024

Conversation

gampnico
Copy link
Collaborator

@gampnico gampnico commented Jun 24, 2024

This release is not backwards-compatible with previous versions of COSIPY!

Tested on Ubuntu 22.04 & 24.04, Python 3.9 to 3.12, with and without Slurm.

Main Features:

  • New configuration system - convert your old config files using convert_config.py.
  • Critical bug fixes - surface temperature, refreezing, snowfall, radiation.
  • Performance - up to 30% faster for some simulations.
  • Expanded support for WRF.
  • Pip package support - install once, run anywhere.
  • Updated tutorial, API, and documentation.
  • CI workflow.

Breaking Changes:

  • Drops support for Python 3.8 and lower.
  • Replaces the entire configuration system.
  • Centralises the source directory structure.
  • Removes the output and output.full files. Output variable selection is now in the config file.
  • Some arguments have been renamed to avoid namespace collision. -c, -x, -u, -s are now reserved for handling configuration files.
  • Some output attributes variable names have been corrected.

Details

Critical Bug Fixes

  • The surface temperature solver no longer terminates prematurely.
  • Refreezing now conserves mass and uses the correct units. Thanks to @MarcusGastaldello for providing both these fixes.
  • Snowfall is now in m water equivalent instead of ice equivalent. Thanks to @Richteny for spotting this.
  • Date comparisons now compare times instead of string lengths.
  • Incorrect conversion to radians in radiation module.
  • Fixed typos in output variable names.

Configuration

Configuration system now uses .toml files. You can now run multiple simulations from the same root directory. You can now select from multiple configuration files in any directory via optional user arguments:

python COSIPY.py -c <config.toml> -x <constants.toml> -s <slurm_config.toml>

This system is not backwards-compatible, but you can convert your existing configuration files:

git fetch --all
git checkout master -- convert_config.py
python convert_config.py  # generate .toml files

If you have custom scripts importing constants or config variables, these will break. Look at densification.py to see how these are now implemented: if you want to access constants or config variables within an njitted function, these must be declared at the module level. Otherwise, replace import constants with from cosipy.constants import Constants.

Packaging

COSIPY now supports pip installation as a package or editable. This centralises the file hierarchy, so utilities and postprocessing are now under cosipy. Installing COSIPY as a package or editable adds entry points to simplify your workflow. View these using cosipy-shortcuts.

When running COSIPY from source, you will need to modify your commands, e.g.:

python -m cosipy.utilities.create_static.create_static_file

Optimisations

  • Simulations run up to 30% faster.
  • Significant optimisations across all modules - with thanks to @MarcusGastaldello and @Richteny.
  • "Secant" is now the default and fastest minimisation algorithm.
  • Optimisations for saving data to disk.
  • Optimisations for preprocessing scripts.

Documentation

  • Updated tutorial and installation instructions.
  • API now covers the entire model.

CI workflow

Code pushed to master or release branches is automatically tested with python 3.9-3.12 on Ubuntu.

Fixes #8, fixes #9, fixes #42, fixes #64.
Closes #59, closes #66.

emilycollier and others added 30 commits June 1, 2021 15:05
… unless at snow-ice interface; merge small ice layers
Bug fix on the surface temperature solver
Refactors:
    - get_total_foo and get_number_snow_layers now sum the output of the method they duplicated.
    - Unused overburden pressure in merge_nodes.
    - String operations.

Adds:
    - Relevant tests.
Removes `-c` arguments as these conflict with configuration imports.

Refactors inconsistent documentation, illegible code.
Re-implements output variable selection to fix dask OOM errors when
using SLURM. The output variables are now read from the config.toml file
instead of the output/output.full files.
Fixes:
    - Date comparisons comparing lengths of strings instead of time.
    - Incorrect type for self.restart_date.

Refactors:
    - Streamlines saving to loop over user selected variables.
    - Removes duplicate code.
Fixes crash caused when passing an empty string to output_variable in
config
Fix readthedocs, mock imports, outdated docs
@AnsArn AnsArn merged commit 47c44f9 into master Nov 22, 2024
8 checks passed
@gampnico gampnico deleted the release-2.0 branch November 22, 2024 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants