Repository navigation
GRSprocessor 3.1: science improvement, Zarr output, OmniCloudMask, performance - #27
Merged
Merged
Conversation
# Conflicts: # grs/__init__.py # grs/grs_process.py # grs/run.py # pyproject.toml
Internal modules import classes from their submodules instead of the lazy package namespace, and grs/__init__.py declares the public classes under TYPE_CHECKING so IDEs and type checkers can resolve them.
Kernel.get_coarse_masked_raster takes a target resolution in meters (e.g. 60, 120, 240) instead of xcoarsen/ycoarsen; the factors are derived from the raster pixel size by the new coarsening_factor method, which raises if the resolution is not a multiple of the pixel size. Process.execute: aot_megapix_size is replaced by aot_resolution (default 160 m, same as the previous 8 x 20 m default).
Pass lazy_geom=True to GRSdriver.Sentinel2Driver so vza and raa stay dask arrays, computed block by block.
Add a "Physical model" section to the grs_kernel module docstring (notation, diffuse light correction, transmittances, Cox-Munk sunglint, Rrs, aerosol retrieval) and the equations implemented by each retrieval method; Misc.air_mass and Misc.transmittance_dir in utils get their formulas. Docstrings with LaTeX are raw strings, rendered by MathJax.
Kernel.get_coarse_masked_raster keeps the coarse resolution in kernel.coarse_resolution and in the "resolution" attribute of the coarse raster; Process writes it to the output global attribute "aot_resolution". The default aot_resolution of Process.execute is now 240 m.
- conf.py: autodoc/autosummary with napoleon, mathjax, intersphinx, copybutton, mermaid and myst-nb; drop autoapi (duplicated the API); notebooks rendered with their stored outputs instead of executed - hand-written API reference by role, autosummary templates, stubs generated at build time (git-ignored); remove stale "GRS API" pages - new Methods page (processing steps and equations) and Installation page; Usage includes the CLI help from grs/run.py and the outputs - index reorganised (user guide, tutorials, reference, funding) - fix malformed docstring tables in mask.py and output.py - add the "docs" extra required by .readthedocs.yaml
":template: class.rst" was not found (autosummary looks it up as "class.rst", then "autosummary/class.rst.rst") and fell back to base.rst, so class pages had no methods. Use "autosummary/class.rst".
- white GRS logo for dark mode (theme logo image_light/image_dark) and an SVG favicon that follows the browser theme - support page: aligned partner logos with links, white card in dark mode; logos trimmed and resized for the web (cnes 248 KB -> 21 KB) - custom.css: dark mode versions of the hard-coded light colours - processing chain: Zarr store with pyramids as default output (layout, overviews, cloud-ready storage, naming), NetCDF as alternative; dataflow diagram updated
The CLI writes a Zarr store (<odir>/<name>/<name>.zarr) but --no_clobber looked for <name>.nc, so existing products were never skipped. --snap_compliant applies to both formats (Rrs as one variable per band).
Without a filter, packages.find picked up every directory of the repo (build, docs, docs_bu, ecmwf, exe, notebook, test...) as top-level packages: the editable install redirected those names to the repo and the wheel shipped them. Keep only grs and its subpackages, without grs/TEST.
The number of water pixels of each retrieval block was overwritten by the per-pixel map of the block (NaN at the block centre), and the outlier filter replaced the weights of outliers and empty blocks by the median AOT: filter2d ended up weighting only the empty blocks. Keep the number of water pixels as weight, give a null weight to outliers and empty blocks (median aot_ref), and pass a copy to filter2d so that kernel.aot_ref_img keeps the unsmoothed values.
The weighted mean of the block AOT values used a fixed 15 x 15 window, which covers the whole block grid of most scenes and gave a nearly uniform AOT map; the second smoothing spanned about 5 blocks. The window of the weighted mean is now given in blocks (new parameter aot_smoothing_blocks, default 3) and the transitions are smoothed over about one block. Fix Kernel.filter2d: the window wrapped around the edges of the image (negative indices) and the mean was computed in place, from already smoothed neighbours.
- Kernel.final_process_chunk: Misc.air_mass returns a (y, x) DataArray for monoview sensors; multiplied by the (wl, y, x) numpy arrays of the direct transmittance it fails with recent xarray versions. Use the numpy values, which broadcast over wl. - Masking: coarsen().mean() no longer accepts skipna; NaN are ignored by default.
500 m is not a multiple of the 30 m (Landsat) and 60 m pixel sizes, so the processing failed in Kernel.coarsening_factor for those resolutions when aot_resolution was not given (always the case with the CLI). 480 m is a multiple of 10, 20, 30 and 60 m. Update the documented default (was 240 m) in usage.rst, methods.rst and the changelog.
Pass the pixel size of the coarse grid of the aerosol retrieval to Process.execute (default 480 m, as in Process.execute) and log it. The CLI imported set_ofile from exe.procutils, which is not installed since package discovery is restricted to grs: the grs command failed outside the repository. run.py now has its own set_ofile. Update the CLI help copied in README.md.
2.2.0 is the released CNES CI version (tag v2.2.0, 2026-10-16), as on develop; the scientific developments formerly listed as 2.2.0 and 2.2.1 (not released) are described in 3.0.0. 2.1.7 to 2.2.0 as on develop and in order; 3.1.0 summarised in grs/__init__.py. The history page of the documentation includes CHANGELOG.md instead of a stale copy.
…nd grstbx ViewParam
…nda, PDF without warnings, pre-release banner
…et (Level-1 product, CAMS, gaseous transmittance, logger); Git LFS test data and integration_tests removed
- grs_kernel: rugosity_est, aerosol_swir, aerosol_visible and aerosol_visible_chunk_old removed (replaced by the *_chunk methods), with the unused chunk and update_state arguments and neg_pix_max - auxdata: AuxData moved to grs.utils (from grs import AuxData still works), module removed with the obsolete SensorData, its masking thresholds and grs/TEST/src/test_auxdata.py
… variable - wind added to the packing table (int16, scale 0.001): it was written as uncompressed float64, about 60 % of a Zarr product (209 MB at level 0 for a 20 m tile, 1.2 MB packed); own attributes (units, long_name) instead of the product ones - export_to_zarr: Blosc compression, inner chunks and shards applied to all data variables, also those without packing - test_zarr_encoding: every image variable compressed, wind packed
- L1C RGB (TOA 665/560/490 nm, taken before the gas correction and the water masking), L2A RGB (Rrs of the water pixels) and sunglint (BRDFg of the water pixels): <name>_ql_<kind>.png, at most 1000 px, fixed stretches (TOA 0-0.3, Rrs 0-0.05 sr-1, BRDFg 0-0.05), transparent outside the image - computed in the same dask pass as the Zarr store or the NetCDF file; quicklooks=False export option; a failure only logs a warning - test_quicklooks, docs (output module, processing chain) and changelog
… PyTorch, LUT download, ADS key)
…etches) and usage pages
… CAMS archive); HAL, PBS and Docker sections removed
…lass 0) water pixels are processed
…ory per block halved (~150 MB at 512 px), same speed and Rrs
…urrent dask calls); one numba thread per final_process block, so processor.ncpu is the number of busy cores
…sk flags, quicklooks, aerosol defaults, CAMS archive)
…s -> 5 s for an uncached monthly file); LUT preparation reads only the window of the radiance table around the image angles and mixes the aerosol models before the angular interpolation (45 + 26 s -> 21 + 7 s, same tables)
… block, nearest Rdiff tables by index, direct transmittance on numpy arrays): retrieval 33 -> 19 s on a Sentinel-2 tile, same AOT
…km²): Process.execute stops after reading the image when the water test finds less water, no product is written; --min_water_area option
… images without water; skipped by grs --no_clobber and by the batch notebook (status no_water)
… marker, faster CAMS / LUT / aerosol retrieval, float32 blocks, numba threads)
…efore setting up the logger, so a skipped run no longer overwrites the log file of the previous run
… notebooks, dataflow diagram)
…es of develop, processing code of 3.1.1 - CI: GitLab sync workflow, unit tests before PyPI, test summary, Gitflow branches, docs on tags - Docker (Ubuntu 24.04, Python 3.12, no GDAL), SLURM test env, light environment.yml, CWL on S3 - unit tests of develop (kernel, mask, output, config, CLI, utils); v3 tests kept, develop's variants of test_logger/test_product/test_process as *_units.py - requirements: minimum versions, GRSdriver >= 2.0.4 - kept from 3.1.1: grs/*.py, pyproject (GRSprocessor), version, docs, READMEs, unit conftest - fix: _find_min_cost ignored valid costs after a NaN candidate (wind retrieval) - fix: config tests isolated from the user configuration file
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
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
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.
Merges the 3.x series (3.0.0 – 3.1.1, see
CHANGELOG.md) intodevelop.develop(PRs #24 and #26) is already merged into the branch: no conflict.Main changes
Science
aot_resolution240 m, blocks of 15 km),aerosolsection of the configuration; validated against AERONET-OC (AOT RMSE 0.078 → 0.065, bias removed)._find_min_cost).min_water_area, marker<name>_no_water.txt).Output and software
grs/config.yml, user file, environment),grs_configcommand, LUTs downloaded from Zenodo, CAMS archive in aYYYY/MM/DDtree.GRSprocessor(package and commands stillgrs), Python >= 3.11, GRSdriver >= 2.0.4 (no GDAL / EOReader).Performance
From
develop(kept)test_logger,test_product,test_processare kept, those ofdevelopare in*_units.py.develop(the fixes of PR CI: unit tests before publish #26 concern code already present in 3.1.1).Notes for review
develophad 3.0.0);pyproject.tomlkeeps the PyPI nameGRSprocessor._find_min_cost) can change wind values on pixels where some wind candidates were NaN, compared with 3.1.0.CI on f07b345:
python-testsandpodman-buildpassed, branch mirrored to GitLab.