Skip to content

Add operator plotmap, intake catalogs, fixes for IDRIS and check(), run on Obelix, validate plotmap with C-ESM-EP, allow for data check by ds()#260

Merged
rigoudyg merged 107 commits intoV3.1from
plotmap_for_merge
Jan 16, 2026
Merged

Add operator plotmap, intake catalogs, fixes for IDRIS and check(), run on Obelix, validate plotmap with C-ESM-EP, allow for data check by ds()#260
rigoudyg merged 107 commits intoV3.1from
plotmap_for_merge

Conversation

@senesis
Copy link
Collaborator

@senesis senesis commented Jun 26, 2025

Plotmap aims at replacing operator plot, without relying on Ncl. It uses matplotlib, cartopy and geocat-viz.
This PR brings its code and its doc (which includes two notebooks). It doesn't yet include specific tests for plotmap in the test suite
Also, a new module allows to use intake catalogs for accessing project's data, for CMIP5, CMIP6, PMIP3, CORDEX

Function ds() can perform an automatic check of datafiles with respect to requested period. Default behaviour depends on env.environment.data_check

Method check() has been fixed for a number of observation datasets

It also includes a series of fixes for running on Jean-Zay at IDRIS

GitHub actions were updated (Ubuntu 24.04)

Here is the content of doc/news.rst :

  • script ensemble_ts_plot now has options --year_delta and --draw_grid

  • Add function :py:func:~climaf.driver.cxr that returns a DataArray version of a CliMAF object

  • Fix a bug when finding data files using calias(.., fileNameVar=)

  • On Spirit, use intake catalogs, as available at IPSL for some MIPs. First use implies reading the catalog, which can last up to 30s for CMIP6; but next requests are much quicker. Can be deactivated by setting env.environment.projects_using_intake list to []. Current list includes CMIP5, CMIP6, and CORDEX. Project PMIP3 was also included as a test case for introducing a new project natively managed with intake. See 'internals' below for details.

  • Add operator plotmap, a replacement for operator plot, albeit only for maps. It is based on Matplotlib, Cartopy and GeoCat Viz; see :doc:scripts/plotmap, which gives access to introductory notebooks. Calls to plot that end up as a map should be transformed accordingly. You can also set env.environment.plot_use_plotmap=True for automatically transforming plot calls to plotmap calls, but this will fail when plot is used for 1- and 2-d profiles, curves or time series (except if adding argument forbid_plotmap=False to such plot() calls). The generated plotmap call is displayed when setting env.environment.teach_me_plotmap = True.

  • Function cshow now calls display(Image()) if called from a notebook. This applies to default function cshow (the one in climaf.api)

  • Function ds() has a new argument 'check' for light to full check of datafiles associated with the dataset. See :py:func:~climaf.classes.ds

  • Various fixes for running at IDRIS

  • Fixes errors in : cdu(), iplot_members()

  • Dataset's method :py:meth:~climaf.classes.cdataset.glob has new argument ensure_period (default is True)

  • New operator cnkso mimics operator cnks but allows to apply a composite operator

  • Function :py:func:~climaf.chtml.cell() allows to choose the target image filename

  • Setting variable driver.scripts_ouput_write_mode to 'a' allows to accumulate scripts outputs in last.out. Default value is 'w' and allows to keep only the output of last script.

  • Internals :

    • New module projects/intake_search.py handles intake catalogs, thanks to:

      • variables in env.environment.py :

        • the list of target projects: projects_using_intake and
        • the catalog path: intake_catalog
      • for each target project:

      • a dict translate_facet for matching CliMAF facet names to intake catalog facet names

      • a string period_pattern which allows to extract the period from the filename; this is needed only because IPSL catalogs do not provide relevant values for that, yet

    • When calling an external script, operator arguments values are dumped in json format (except if argument keyword has prefix !) ; so, called scripts must decode json format when they accept complex arguments; and must also interpret strings 'true' and 'false' as logical values

    • Add value 'show' to operator's output format possibe values; in that case, CliMAF doesn't handle any output; the value is forwarded to the script

    • a number of data samples have been added in examples/data : Nemo, Aladin, (uas, vas)

    • test suite on GitHub was updated for dependencies (ipython, pyproj, geocat-viz) and for cache and miniconda versions (v4)

    • add function period.build_date_regexp()

    • fix concurrency issue in makedirs(tmpdir)

    • create tests/reference_data/test_data_plot/idris_20230611_V3.0_IPSL2

senesis added 30 commits June 24, 2025 15:34
Only one plot change vs. spirit_conda_20221224
compare_picture_files don't anymore stop on first instance of
different pictures
It also allows to create a html file showing the differences and the two
images that differ
@senesis senesis requested a review from rigoudyg June 26, 2025 15:14
@senesis senesis changed the title Add operator plotmap, the use of intake catalogs, and fixes for IDRIS and for check() Add operator plotmap, intake catalogs, fixes for IDRIS and check(), run on Obelix Aug 21, 2025
@senesis senesis changed the title Add operator plotmap, intake catalogs, fixes for IDRIS and check(), run on Obelix Add operator plotmap, intake catalogs, fixes for IDRIS and check(), run on Obelix, validate plotmap with C-ESM-EP Nov 6, 2025
env.environment.data_check turned to False
@senesis senesis changed the title Add operator plotmap, intake catalogs, fixes for IDRIS and check(), run on Obelix, validate plotmap with C-ESM-EP Add operator plotmap, intake catalogs, fixes for IDRIS and check(), run on Obelix, validate plotmap with C-ESM-EP, allow for data check by ds() Nov 6, 2025
Copy link
Owner

@rigoudyg rigoudyg left a comment

Choose a reason for hiding this comment

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

I have correct two tests launched only at CNRM.

@rigoudyg rigoudyg merged commit 6f254f2 into V3.1 Jan 16, 2026
5 checks passed
rigoudyg added a commit that referenced this pull request Feb 3, 2026
* Bugfix for getting time dimension for period not in filename pattern.

* Bugfix in fline function.

* Simplify a lot doc/requirements.txt

* Fix colors for ta500, ta700, ta850

* Introduce env.robust_pid for alleviating issue with docker at TGCC

* scripts/regrid.sh doesn't interpolate when same grids

* Add tests on pull requests

* Bugfix for use of cdo at CNRM

* Add operator plotmap, intake catalogs, fixes for IDRIS and check(), run on Obelix, validate plotmap with C-ESM-EP, allow for data check by ds() (#260)

* PEP008 on environment.py and test_example_data_plot.py

* use generate_pdf.py also at IPSL

* Remove test condition SkipIf_CondaEnv

* Fix some project's root for IDRIS

* Fix for IDRIS (atIDRIS diag, path for igcm_out)

* Another fix for IDRIS (igcm_cmip6)

* Fix concurrency issue in makedirs(tmpdir); don't use pdfjam at TGCC and IDRIS

os.makedirs(tmpdir) more robust

* Create tests/reference_data/test_data_plot/idris_20230611_V3.0_IPSL2

Only one plot change vs. spirit_conda_20221224

* Fix typo in ea4c992 (makedirs(test_ok=True))

* Improve tools_for_tests (compare_picture_files)

compare_picture_files don't anymore stop on first instance of
different pictures
It also allows to create a html file showing the differences and the two
images that differ

* PEP008 on environment.py and test_example_data_plot.py

* use generate_pdf.py also at IPSL

* Remove test condition SkipIf_CondaEnv

* Fix concurrency issue in makedirs(tmpdir); don't use pdfjam at TGCC and IDRIS

os.makedirs(tmpdir) more robust

* Fix typo in ea4c992 (makedirs(test_ok=True))

* Restore utils/remove_keys_with_same_values

* Fix on : Restore utils/remove_keys_with_same_values

* dataset.glob() also includes facet 'project' in returned dict(s)

* dataset.glob() returns intersection of requested and avilable periods

* dataset.glob() has argument ensure_period (default is True)

* tests.tools_for_tests.build_diffs_html() now based on chtml

* dataset.check handles monthly data (and cleaner)

* PEP8

* Add facet 'frequency' in project CMIP6

* Add arg 'check' to ds(). Create period.build_date_rexep()

* PEP008

* Some flesh in plotmap, and its interface in plot_operators.py

* Change plotmap Climaf interface. Stage plotmap example and Aladin sfcWind file

* 1st version OK with xarray for LambertII

* Add script output format 'show' (no output, value forwarded to script)

* Script call parameters are dumped in json format

* Discard now extraneous " in script call parameters. Needs testing !

* Discard empty arguments in instanciated script calls

* plotmap.py interface looks almost like gplot.ncl

* Add data samples : Nemo, Aladin, uas + vas

* Fix vector plots, titles. Add gv methods. CCRS from metadata

Fix vector plots
Fix titles
Diagnose CCRS from metadata
Add gv methods
Default plot_engine is contourf

* Fix cscript() call for Ncl scripts, and fix those scripts re. decoding "true"

* Fix plotmap.py re. compute_xy and default projection

* Stage plotmap_demo.py, python version of the plotmap example notebook

* Fix tools_for_tests for comparing figure ensembles

* For ensemble members title, fix combining ensemble title and member_label

* version of plotmap.py mimicking gplot.ncl, with demo notebook

* api.cshow now calls display o Image if running in a notebook

* More fixes and improvements for plotmap and related notebooks

* GitHub actions : upgrade versions. Update environment for plotmap

* GitHub actions : fix setup-miniconda version

* Github Actions : fix cache version and update test_environment.yml

* Fix ipython in conda_test_env.yml

* Create doc for plotmap + some changes on plotmap

* Stage plotmapdemo and Getting_started_with_plotmap (html and ipynb)

* Polish doc/news

* Fix doc/conf.py

* Introduce env.robust_pid for alleviating issue with docker at TGCC

* Fix ensemble_time_series.py for case with only one time step

* Handle IPSL intake catalogs

* Fixes and doc (in news) for intake

* Add forgotten module intake_search

* Add project PMIP3

* Fixes re. intake related changes, and fix tests

* Add reference_data/test_index_html/spiritIMv7 for ImageMagick V7

* Fix calling convert (arguments order)

* Fix setting a robust PID when running in a container

* At TGCC (i.e. in a container), use SLURM_JOBID as PID

* Fix on using SLURM_JOBID

* Use SLURM_JOBID also at IDRIS

* gplot.ncl understands both 'true' and 'True'

* store_wildcard_facet_value admits facet filenameVar

* Fix intake_search and allow version='latest' for CMIP6 and CMIP5

* Fix intake re. cfreqs. Fix Cordex cfreqs. Fix intake_search. latest in Cordex

* Add projects's method for solving ambiguity in facet values

With instances for projects igcm_out and cmip5

* plotmap avoids decoding time when not necessary

* Introduce a wrapper for 'plot', which may call plotmap

Function plot_operators.plot calls plotmap if
env.environment.plot_use_plotmap=True (otherwise it calls plot)
It transforms some plot arguments to plotmap's equivalent

* driver.scripts_ouput_write_mode allows for mode append for last.out

* Fixes for plot wrapper and for classes.dataset.prefered_values()

* plot wrapper handles cnMissingValFillColor and cnLineLabelsOn

* Add driver.cxr(); fix bug in find_files when using fileNameVar

Also fix typo in standard_operators (for curves)

* chtml.cell allows to choose image filename

* Add args for ensemble_time_series_plot : 'year_delta' and 'draw_grid'

* Called scripts arguments are not json-coded when declared as {!arg}

* Ensure backward compatbility for tests regarding chtml.cell()

* Add operator cnkso, which calls ncks with a (possibly composite) operator

* Update doc and news re. ensemble_ts_plot args draw_grid and year_delta

* Changes to .gitignore

* Fix intake_search re. e.g. CORDEX_domain

* Fix gplot (NhlSetColor). Fix period.start_with re. fx.

* Fix gplot re NhlSetColor. Fix ensemble_ts_plot re legendHandles

* ds.resolve() stores files list. Fix operator rescale. Improve plot scripts

ensemble_time_series_plot show months names on seasonal cycle plots
gplot.ncl knows more latnames and lonnames

* gplot.ncl does not change all colormaps when defining a grey

* Fix errors with check for some observation datasets

* Fix typos and polish doc

* PEP8

* Test suite on GitHub uses Ubuntu 24.04

* Test suite on GitHub uses Miniforge3

* Doc build on GitHub uses Ubuntu 24.04 and Miniforge3

* Disable test_html in GitHub test workflow

* For doc build on GitHub, update upload-artifact to v4

* GitHub test suite does install Image magick and pdftk

* Fix some doc strings

* Insert changes for obelix. Simplify find_files

* chtml.cell() fixed re. file extension; ensemble_time_series_plot allows for single time

* Netcdfbasics.varsOfFile() is flexible about nav_lat*

* functions.tsplot() handle argument None

* ds() has new args data_check and check_type, with default values in env

* Fix cache.cdrop for index entries without corresponding file

* Tune plotmap and its interface with a C-ESM-EP run. Fix hurs plot params

For hurs bias : avoid defining 24 levels when using a 12 colors colormap

* Default behaviour for ds() doesn't include a data check

env.environment.data_check turned to False

* Fix at CNRM

---------

Co-authored-by: Stephane Senesi <ssenesi@obelix4.lsce.ipsl.fr>
Co-authored-by: rigoudyg <gaelle.rigoudy@meteo.fr>

---------

Co-authored-by: Stéphane Sénési <senesi@posteo.net>
Co-authored-by: Stéphane Sénési <9604741+senesis@users.noreply.github.com>
Co-authored-by: Stephane Senesi <ssenesi@obelix4.lsce.ipsl.fr>
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.

2 participants