Skip to content

Conversation

@atteggiani
Copy link
Collaborator

@atteggiani atteggiani commented Feb 24, 2025

Important

This PR head branch was based off davide/remove_hres_eccb (which includes davide/integration_tests_pytest) to provide a way to test the scripts after their modification.
It is suggested the branch to be rebased to main after #53 and #59 are merged, before marking this PR as "ready to be reviewed".

Overview

This PR main objective is to remove the redundant --mask argument from the replace_landsurface scripts.
In doing so, the code has been restructured the following issues ended up getting fixed.

List of the modifications and fixed issues

Testing

PR passes the integration tests with little needed modifications (removed the --mask argument from the tests).

Why is this important

This changes make the code cleaner and easier to test.

Important

SUITE MODIFICATIONS NEEDED
These changes break back-compatibility with this version of the RNS suite.
An updated version of the suite is available in this branch.

@atteggiani atteggiani self-assigned this Feb 24, 2025
Before the actual test run, there is a setup step that sets up the work directory and data paths
Currently the tests are not meant to be run in parallel yet, as the setup should be re-structured to be run only once (before the test run) and not for each parallel worker.
- Mock the shutil.move function so the outputs can be sent to a custom path and there is no need for copying the input data
- Use fixtures
- Use mark.parameterize
- Use built-in tmp_path_factory fixture
- Enable parallelized tests

Tests can now be run with 'pytest -n <num> | auto' to run in parallel.
…e' to make it general. Also changed the entry points to only include replace_landsurface (old 'hres_ic').
- Simplified code removing redundant portions
- Deleted redundant MASK input
- Turned the class bounding_box to the function get_bounding_box, that returns the BoundingBox namedtuple. Simplified the way to get boundary box extents.
- Restructured the get_barra_data function to use xarray DataArray.sel method, together with slice and 'method' keyword for more efficient and simpler data retrieval.
… and make it consistent with the BARRA2R script

Updated BARRA2R script
…d other redundant variables

- General minor updates
@atteggiani atteggiani force-pushed the davide/remove_mask branch from 2639cd8 to 40eb164 Compare March 2, 2025 07:11
Updated gitignore
@atteggiani atteggiani force-pushed the davide/remove_mask branch from 3ba4679 to 897295e Compare March 2, 2025 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment