diff --git a/.gitignore b/.gitignore index fd5988b..a8b0dbe 100644 --- a/.gitignore +++ b/.gitignore @@ -71,6 +71,10 @@ instance/ # Sphinx documentation _build docs/_build/ +docs/build +docs/_static/images/oceanography/_thumbs +docs/_static/images/hydrology/_thumbs +docs/jupyter_execute # PyBuilder .pybuilder/ diff --git a/docs/SWOT-Hydrology b/docs/SWOT-Hydrology index a947e79..9c64078 160000 --- a/docs/SWOT-Hydrology +++ b/docs/SWOT-Hydrology @@ -1 +1 @@ -Subproject commit a947e7946278b5bbde4036e9ac9a3d92035c229e +Subproject commit 9c64078a0ce5f550839a5758dbcb926e4ad84bd8 diff --git a/docs/SWOT-Oceanography b/docs/SWOT-Oceanography index f1c7b67..d2a65c8 160000 --- a/docs/SWOT-Oceanography +++ b/docs/SWOT-Oceanography @@ -1 +1 @@ -Subproject commit f1c7b676456921df0b76ce70c13a3d28a9f6a022 +Subproject commit d2a65c89be0e762895431d514023d965221d87f9 diff --git a/docs/_static/css/custom.css b/docs/_static/css/custom.css index ffe18b5..796c9ea 100644 --- a/docs/_static/css/custom.css +++ b/docs/_static/css/custom.css @@ -1,13 +1,65 @@ .wy-side-nav-search, .wy-nav-top, .wy-nav-side { background: #0b1817; - } - .wy-nav-side{ +} +.wy-nav-side{ color: #0b1817; - } - .wy-nav-content { - max-width: 80% !important; - background: #fefefe - } - .wy-menu-vertical p.caption{ +} +.wy-nav-content { + max-width: 80% !important; + background: #fefefe +} +.wy-menu-vertical p.caption{ color:#43a299 - } \ No newline at end of file +} + +/* ---- Layout général des cards ---- */ + +.sd-card { + height: 100%; + display: flex; + flex-direction: column; +} + +/* ---- Image thumbnail ---- */ + +.sd-card-img-top { + width: 100%; + height: 160px !important; /* hauteur fixe */ + object-fit: contain !important; /* image entièrement visible */ + object-position: center; /* centre l’image */ + background: #ffffff !important; + padding: 8px; /* petit espace autour */ +} + + + +/* conteneur du contenu */ +.sd-card-body { + flex-grow: 1; + display: flex; + flex-direction: column; +} + +/* ---- Titre ---- */ + +.sd-card-title { + min-height: 60px; + display: flex; + align-items: center; + justify-content: center; + text-align: center; +} + +/* ---- Texte description ---- */ + +.sd-card-text { + flex-grow: 1; +} + +/* ---- Petit effet hover ---- */ + +.sd-card:hover { + transform: translateY(-3px); + transition: 0.2s ease; + box-shadow: 0 4px 14px rgba(0,0,0,0.1); +} \ No newline at end of file diff --git a/docs/_static/SWOT_spacecraft_model.png b/docs/_static/images/SWOT_spacecraft_model.png similarity index 100% rename from docs/_static/SWOT_spacecraft_model.png rename to docs/_static/images/SWOT_spacecraft_model.png diff --git a/docs/_static/images/cnes_aviso.png b/docs/_static/images/cnes_aviso.png new file mode 100644 index 0000000..82b9611 Binary files /dev/null and b/docs/_static/images/cnes_aviso.png differ diff --git a/docs/_static/Hydrocron_logo.png b/docs/_static/images/hydrology/Hydrocron_logo.png similarity index 100% rename from docs/_static/Hydrocron_logo.png rename to docs/_static/images/hydrology/Hydrocron_logo.png diff --git a/docs/_static/Raster_QF_example.png b/docs/_static/images/hydrology/Raster_QF_example.png similarity index 100% rename from docs/_static/Raster_QF_example.png rename to docs/_static/images/hydrology/Raster_QF_example.png diff --git a/docs/_static/SWORD_River_reaches.png b/docs/_static/images/hydrology/SWORD_River_reaches.png similarity index 100% rename from docs/_static/SWORD_River_reaches.png rename to docs/_static/images/hydrology/SWORD_River_reaches.png diff --git a/docs/_static/earthaccess_logo.png b/docs/_static/images/hydrology/earthaccess_logo.png similarity index 100% rename from docs/_static/earthaccess_logo.png rename to docs/_static/images/hydrology/earthaccess_logo.png diff --git a/docs/_static/from_pixc_virtual_stations_example.png b/docs/_static/images/hydrology/from_pixc_virtual_stations_example.png similarity index 100% rename from docs/_static/from_pixc_virtual_stations_example.png rename to docs/_static/images/hydrology/from_pixc_virtual_stations_example.png diff --git a/docs/_static/geopkg.png b/docs/_static/images/hydrology/geopkg.png similarity index 100% rename from docs/_static/geopkg.png rename to docs/_static/images/hydrology/geopkg.png diff --git a/docs/_static/hydroweb_next_1024px.png b/docs/_static/images/hydrology/hydroweb_next_1024px.png similarity index 100% rename from docs/_static/hydroweb_next_1024px.png rename to docs/_static/images/hydrology/hydroweb_next_1024px.png diff --git a/docs/_static/podaac.png b/docs/_static/images/hydrology/podaac.png similarity index 100% rename from docs/_static/podaac.png rename to docs/_static/images/hydrology/podaac.png diff --git a/docs/_static/zarr.png b/docs/_static/images/hydrology/zarr.png similarity index 100% rename from docs/_static/zarr.png rename to docs/_static/images/hydrology/zarr.png diff --git a/docs/aviso.png b/docs/_static/images/oceanography/aviso.png similarity index 100% rename from docs/aviso.png rename to docs/_static/images/oceanography/aviso.png diff --git a/docs/_static/images/oceanography/aviso_authent.png b/docs/_static/images/oceanography/aviso_authent.png new file mode 100644 index 0000000..f7674c1 Binary files /dev/null and b/docs/_static/images/oceanography/aviso_authent.png differ diff --git a/docs/_static/images/oceanography/opendap_url.png b/docs/_static/images/oceanography/opendap_url.png new file mode 100644 index 0000000..cc84629 Binary files /dev/null and b/docs/_static/images/oceanography/opendap_url.png differ diff --git a/docs/_static/swot_favicon.png b/docs/_static/images/swot_favicon.png similarity index 100% rename from docs/_static/swot_favicon.png rename to docs/_static/images/swot_favicon.png diff --git a/docs/cnes.md b/docs/cnes.md new file mode 100644 index 0000000..68d5357 --- /dev/null +++ b/docs/cnes.md @@ -0,0 +1,132 @@ +# Swot Ocean Data Tutorials + +```{admonition} Gallery Versions & Changelog +:class: dropdown tip + +Current version: {{ oceanography_latest_badge }} + +Download a release: + +{{ oceanography_downloads }} + +📄 [Changelog](#changelog) +``` + +## Access to data + +````{grid} 1 1 3 4 +:gutter: 2 + +```{grid-item-card} Search Swot data +:link: SWOT-Oceanography/ex_search_swot +:link-type: doc +:img-top: _static/images/oceanography/_thumbs/ex_search_swot.png +``` + +```{grid-item-card} Download Swot data from AVISO +:link: SWOT-Oceanography/ex_aviso_download_swot +:link-type: doc +:img-top: _static/images/oceanography/aviso.png +``` +```` + +```{toctree} +:hidden: + +SWOT-Oceanography/ex_search_swot +SWOT-Oceanography/ex_aviso_download_swot +``` + +--- + +## 2-km data + +````{grid} 1 1 3 4 +:gutter: 2 + +```{grid-item-card} Basic L2 startup +:link: SWOT-Oceanography/ex_swot_l2_basic_startup +:link-type: doc +:img-top: _static/images/oceanography/_thumbs/ex_swot_l2_basic_startup.png +``` + +```{grid-item-card} L3 startup +:link: SWOT-Oceanography/ex_swot_l3_startup +:link-type: doc +:img-top: _static/images/oceanography/_thumbs/ex_swot_l3_startup.png +``` +```` + +```{toctree} +:hidden: + +SWOT-Oceanography/ex_swot_l2_basic_startup +SWOT-Oceanography/ex_swot_l3_startup +``` + +--- + +## 250-m data + +````{grid} 1 1 3 4 +:gutter: 2 + +```{grid-item-card} L3 unsmoothed data +:link: SWOT-Oceanography/ex_swot_l3_unsmoothed +:link-type: doc +:img-top: _static/images/oceanography/_thumbs/ex_swot_l3_unsmoothed.png +``` + +```{grid-item-card} Subset L3 unsmoothed (AVISO TDS) +:link: SWOT-Oceanography/ex_subset_swot_l3_unsmoothed_aviso_tds +:link-type: doc +:img-top: _static/images/oceanography/_thumbs/ex_subset_swot_l3_unsmoothed_aviso_tds.png +``` + +```{grid-item-card} Subset L2 unsmoothed (AVISO TDS) +:link: SWOT-Oceanography/ex_subset_swot_l2_unsmoothed_aviso_tds +:link-type: doc +:img-top: _static/images/oceanography/_thumbs/ex_subset_swot_l2_unsmoothed_aviso_tds.png +``` + +```{grid-item-card} Sea ice classification +:link: SWOT-Oceanography/ex_sea_ice_classification +:link-type: doc +:img-top: _static/images/oceanography/_thumbs/ex_sea_ice_classification.png +``` +```` + +```{toctree} +:hidden: + +SWOT-Oceanography/ex_swot_l3_unsmoothed +SWOT-Oceanography/ex_subset_swot_l3_unsmoothed_aviso_tds +SWOT-Oceanography/ex_subset_swot_l2_unsmoothed_aviso_tds +SWOT-Oceanography/ex_sea_ice_classification +``` + +--- + +## Wind Wave data + +````{grid} 1 1 3 4 +:gutter: 2 + +```{grid-item-card} L3 LR Wind Wave startup +:link: SWOT-Oceanography/ex_swot_l3_lr_ww_startup +:link-type: doc +:img-top: _static/images/oceanography/_thumbs/ex_swot_l3_lr_ww_startup.png +``` +```` + +```{toctree} +:hidden: + +SWOT-Oceanography/ex_swot_l3_lr_ww_startup +``` + +```{image} aviso.png +:class: hidden +``` + +```{include} SWOT-Oceanography/changelog.md \ No newline at end of file diff --git a/docs/cnes.rst b/docs/cnes.rst deleted file mode 100644 index b1b033f..0000000 --- a/docs/cnes.rst +++ /dev/null @@ -1,34 +0,0 @@ -SWOT Ocean Data Tutorials -========================= - -.. nbgallery:: - :caption: Access to data - :name: cnes_data_gallery - - SWOT-Oceanography/ex_search_swot.ipynb - SWOT-Oceanography/ex_aviso_download_swot.ipynb - -.. nbgallery:: - :caption: 2-km data - :name: cnes_l2_gallery - - SWOT-Oceanography/ex_swot_l2_basic_startup.ipynb - SWOT-Oceanography/ex_swot_l3_startup.ipynb - -.. nbgallery:: - :caption: 250-m data - :name: cnes_l3_gallery - - SWOT-Oceanography/ex_swot_l3_unsmoothed.ipynb - SWOT-Oceanography/ex_subset_swot_l3_unsmoothed_aviso_tds.ipynb - SWOT-Oceanography/ex_subset_swot_l2_unsmoothed_aviso_tds.ipynb - SWOT-Oceanography/ex_sea_ice_classification.ipynb - -.. nbgallery:: - :caption: Wind Wave data - :name: cnes_l3_ww_gallery - - SWOT-Oceanography/ex_swot_l3_lr_ww_startup.ipynb - -.. image:: aviso.png - :class: hidden diff --git a/docs/conf.py b/docs/conf.py index 88b42eb..f1140da 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,109 +1,70 @@ # Configuration file for the Sphinx documentation builder. -# -# For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html -# -- Project information ----------------------------------------------------- -# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information +import subprocess +import sys +from pathlib import Path + +# -- Path setup --------------------------------------------------------------- + +SCRIPTS_PATH = Path(__file__).parent / "scripts" +sys.path.insert(0, str(SCRIPTS_PATH)) + +# -- Project information ------------------------------------------------------ project = 'SWOT Gallery' copyright = '2024, SWOT Community' author = 'SWOT Community' -release = '0.0' +release = '1.0' -# -- General configuration --------------------------------------------------- -# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration +# -- General configuration ---------------------------------------------------- extensions = [ - 'nbsphinx', - 'sphinx.ext.mathjax', - # 'sphinx_gallery.gen_gallery', - 'sphinx_tabs.tabs', + "myst_nb", + "sphinx_design", + "sphinx.ext.mathjax", + "sphinx_tabs.tabs", ] -# -- Extension configuration ------------------------------------------------- -# sphinx_gallery_conf = dict( -# # It is important to follow the auto_* convention, because the gitlab CI -# # pipeline uses it to retrieve the notebook executions. -# examples_dirs=['../dummy'], -# gallery_dirs=['auto/dummy'], -# filename_pattern=r'[\\\/]ex_', -# only_warn_on_example_error=True, -# remove_config_comments=True, -# nested_sections=False, -# # Do not inspect global variables in code blocks. The links are useful but -# # their styling makes them too overwhelming -# inspect_global_variables=False, -# # ignore_repr_types=r'*DynamicMap*' -# ) - -# Don't add .txt suffix to source files: -html_sourcelink_suffix = '' - -# This is processed by Jinja2 and inserted before each notebook -nbsphinx_prolog = r""" -{% set docname = 'doc/' + env.doc2path(env.docname, base=None) %} - -.. raw:: html - -
- Download notebook. -
-""" - -nbsphinx_epilog = nbsphinx_prolog - -nbsphinx_thumbnails = { - 'SWOT-Oceanography/ex_aviso_download_swot': '_images/aviso.png', - 'SWOT-Hydrology/BASIC/Hydrocron_SWOT_timeseries_examples': '_static/Hydrocron_logo.png', - 'SWOT-Hydrology/BASIC/Search_by_earthaccess_python_package': '_static/earthaccess_logo.png', - 'SWOT-Hydrology/BASIC/Search_by_SWORD_River_ID_in_Earthdata': '_static/SWORD_River_reaches.png', - 'SWOT-Hydrology/BASIC/SWOT_Raster_Notebook_cloud_in_Earthdata': '_static/Raster_QF_example.png', - 'SWOT-Hydrology/BASIC/SWOT_Raster_Notebook_local_in_Earthdata': '_static/Raster_QF_example.png', - 'SWOT-Hydrology/INTERMEDIATE/download_pixc_to_zarr': '_static/zarr.png', - 'SWOT-Hydrology/INTERMEDIATE/download_pixc_to_gpkg': '_static/geopkg.png', - 'SWOT-Hydrology/INTERMEDIATE/from_pixc_to_virtual_stations': '_static/from_pixc_virtual_stations_example.png', -} - templates_path = ['_templates'] -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This pattern also affects html_static_path and html_extra_path. exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] - -# The name of the Pygments (syntax highlighting) style to use. pygments_style = "sphinx" -# -- Options for HTML output ------------------------------------------------- -# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output +# -- MyST configuration ------------------------------------------------------- -html_theme = 'sphinx_rtd_theme' -# html_theme = 'pydata_sphinx_theme' -#html_theme = 'alabaster' +myst_enable_extensions = ["substitution"] +from generate_versions import get_myst_substitutions +myst_substitutions = get_myst_substitutions() -# Title -html_title = "SWOT Community" -html_short_title = "SWOT Community" - -# These paths are either relative to html_static_path -# or fully qualified paths (eg. https://...) -html_css_files = ["css/custom.css"] +# -- Notebook execution ------------------------------------------------------- +nb_execution_mode = "off" +nb_execution_timeout = 120 +nb_execution_allow_errors = False -# Logo -html_logo = "_static/SWOT_spacecraft_model.png" +# -- HTML output -------------------------------------------------------------- -# Favicon -html_favicon = "_static/swot_favicon.png" +html_theme = 'sphinx_rtd_theme' +html_title = "SWOT Community" +html_short_title = "SWOT Community" +html_static_path = ["_static"] +html_css_files = ["css/custom.css"] +html_logo = "_static/images/SWOT_spacecraft_model.png" +html_favicon = "_static/images/swot_favicon.png" +html_sourcelink_suffix = '' -# Theme options html_theme_options = { "logo_only": True, "navigation_depth": 4, } -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ["_static"] +# -- Build hooks -------------------------------------------------------------- + +def setup(app): + app.connect("builder-inited", lambda app: subprocess.run( + ["python", str(SCRIPTS_PATH / "generate_thumbnails.py")] + )) + app.connect("builder-inited", lambda app: subprocess.run( + ["python", str(SCRIPTS_PATH / "insert_download_links.py")] + )) \ No newline at end of file diff --git a/docs/docs_hydrology/hydrology.rst b/docs/docs_hydrology/hydrology.rst deleted file mode 100644 index 83f5f6a..0000000 --- a/docs/docs_hydrology/hydrology.rst +++ /dev/null @@ -1,84 +0,0 @@ -SWOT Hydrology Data Tutorials -==================================== - -Here are Hydrology-relevant tutorials and resources for the Surface Water and Ocean Topography (SWOT) Mission, using cloud computing or via local machine. - -.. warning:: - - Those depict the most simple and commonly used methods to our knowledge to get a hand on SWOT HR products. - Should you have other methods or tools, please share! - -.. toctree:: - :caption: Tutorials for - :maxdepth: 3 - - basic - intermediate - expert - - -------------- -Data Portals -------------- -.. |hnext| image:: ../_static/hydroweb_next_1024px.png - :width: 30% -.. |podaac| image:: ../_static/podaac.png - :width: 15% - -|hnext| |podaac| - -All SWOT Hydrology data illustrated in these tutorials can be accessed via - -* `PO.DAAC Earthdata `_: search for, visualize and download all SWOT products vie intereactive GUI developped by NASA and PO.DAAC, earthdata -* `hydroweb.next `_: Search for, visualize, and download SWOT Hydrology products via interactive GUI developed by CNES and Theia, hydroweb.next - - - ------------------------ -Other useful tools ------------------------ - -* `Hydrocron `_: An API that repackages the river shapefile dataset (L2_HR_RiverSP) into csv or GeoJSON formats that make time-series analysis easier. -* `SWODLR `_: A system for generating on demand raster products from SWOT L2 raster data with custom resolutions, projections, and extents. -in development -* `SWOT hydrology toolbox `_: Together with RiverObs, open-source tools that enable end-users to generate virtually all SWOT HR level-2 (L2) products with fairly (but not fully) representative characteristics (see section on caveats below) -* `SWOT RiverObs tool `_: Together with SWOT Hydrology Toolbox, open-source tools that enable end-users to generate virtually all SWOT HR level-2 (L2) products with fairly (but not fully) representative characteristics (see section on caveats below) - -------------------- -A Priori Databases -------------------- - -* `SWOT River Database (SWORD) `_: the database for rivers SWOT products are based upon, great for discovering river reach IDs!. The dataset is also available in `hydroweb.next `_ -* `Prior Lake Database (PLD) `_: Add in the PLD layer into hydroweb.next to see the lakes SWOT products are based upon, great for discovering lake IDs! - ---------------------- -Products Description ---------------------- -* `SWOT Data User Handbook `_ is your first document -* `Product Description Documents `_: find more detailed information in this table! -* `Latest Release Notes - Version C KaRIn Science Data Products `_: See section 6 for current issues and features of the datasets! - ---------------------- -Additional Resources ---------------------- -* `PO.DAAC Cookbook: SWOT Chapter `_: Visit for more data resources, tips, and tutorials related to both the hydrology and oceanography SWOT communities. -* `GIS SWOT StoryMap `_ - ------------------------------------------------------ -Features of KaRIn Data that Users Should be Aware of ------------------------------------------------------ - -* `Slide Deck Presented at the SWOT Science Team by Curtis Chen `_: Addresses practical aspects of interpreting SWOT KaRIn data products, answers frequently asked questions, and provides tips to hopefully avoid misinterpretation and confusion of the data. - ------------------- -Earthdata Webinar ------------------- -* `Accessing Data for the World's Water with SWOT `_: Watch the Recording! Learn how to discover, access, and use SWOT mission data from PO.DAAC and how these data can lead to new, innovative science and applications in the world of water. - ------------------------------------------ -2024 SWOT Hydrology Data Access Workshop ------------------------------------------ - -`https://podaac.github.io/2024-SWOT-Hydro-Workshop/ `_ - - - diff --git a/docs/hydrology/basic.md b/docs/hydrology/basic.md new file mode 100644 index 0000000..6beaff4 --- /dev/null +++ b/docs/hydrology/basic.md @@ -0,0 +1,122 @@ + +(basic)= + +# Basic + +## Product Overview + +````{grid} 1 1 3 4 +:gutter: 2 + +```{grid-item-card} SWOT Hydrology Dataset Exploration in the Cloud +:link: ../SWOT-Hydrology/BASIC/Product_Overview_SWOT_HR_cloud_in_Earthdata +:link-type: doc +:img-top: ../_static/images/hydrology/_thumbs/Product_Overview_SWOT_HR_cloud_in_Earthdata.png +``` + +```{grid-item-card} SWOT Hydrology Dataset Exploration on a local machine +:link: ../SWOT-Hydrology/BASIC/Product_Overview_SWOT_HR_local_in_Earthdata +:link-type: doc +:img-top: ../_static/images/hydrology/_thumbs/Product_Overview_SWOT_HR_local_in_Earthdata.png +``` +```` + + +```{toctree} +:hidden: + +../SWOT-Hydrology/BASIC/Product_Overview_SWOT_HR_cloud_in_Earthdata +../SWOT-Hydrology/BASIC/Product_Overview_SWOT_HR_local_in_Earthdata +../SWOT-Hydrology/BASIC/Read_SWOT_PixelCloud +../SWOT-Hydrology/BASIC/Read_SWOT_Raster +../SWOT-Hydrology/BASIC/Read_SWOT_RiverSP_Node +../SWOT-Hydrology/BASIC/Read_SWOT_RiverSP_Reach +../SWOT-Hydrology/BASIC/Create_River_Profiles +../SWOT-Hydrology/BASIC/Hydrocron_SWOT_timeseries_examples +../SWOT-Hydrology/BASIC/Search_by_earthaccess_python_package +../SWOT-Hydrology/BASIC/Search_by_HUC_ID +../SWOT-Hydrology/BASIC/Search_by_SWORD_River_ID_in_Earthdata +../SWOT-Hydrology/BASIC/SWOT_Raster_Notebook_cloud_in_Earthdata +../SWOT-Hydrology/BASIC/SWOT_Raster_Notebook_local_in_Earthdata +``` +--- + +## Read and plot + +````{grid} 1 1 3 4 +:gutter: 2 + +```{grid-item-card} Read and plot a SWOT-HR Pixel Cloud netcdf products +:link: ../SWOT-Hydrology/BASIC/Read_SWOT_PixelCloud +:link-type: doc +:img-top: ../_static/images/hydrology/_thumbs/Read_SWOT_PixelCloud.png +``` + +```{grid-item-card} Read and plot a SWOT-HR Raster products +:link: ../SWOT-Hydrology/BASIC/Read_SWOT_Raster +:link-type: doc +:img-top: ../_static/images/hydrology/_thumbs/Read_SWOT_Raster.png +``` + +```{grid-item-card} Read and plot a SWOT-HR River Single Pass Node product +:link: ../SWOT-Hydrology/BASIC/Read_SWOT_RiverSP_Node +:link-type: doc +:img-top: ../_static/images/hydrology/_thumbs/Read_SWOT_RiverSP_Node.png +``` + +```{grid-item-card} Read and plot a SWOT-HR River Single Pass Reach product +:link: ../SWOT-Hydrology/BASIC/Read_SWOT_RiverSP_Reach +:link-type: doc +:img-top: ../_static/images/hydrology/_thumbs/Read_SWOT_RiverSP_Reach.png +``` + +```` + +## Tools to classify + +````{grid} 1 1 3 4 +:gutter: 2 + +```{grid-item-card} Create River Profiles from SWOT Hydrology Data in the Cloud +:link: ../SWOT-Hydrology/BASIC/Create_River_Profiles +:link-type: doc +:img-top: ../_static/images/hydrology/_thumbs/Create_River_Profiles.png +``` + +```{grid-item-card} Hydrocron API: SWOT Hydrology Time Series Examples +:link: ../SWOT-Hydrology/BASIC/Hydrocron_SWOT_timeseries_examples +:link-type: doc +:img-top: ../_static/images/hydrology/Hydrocron_logo.png +``` + +```{grid-item-card} Search and Download SWOT Data via earthaccess +:link: ../SWOT-Hydrology/BASIC/Search_by_earthaccess_python_package +:link-type: doc +:img-top: ../_static/images/hydrology/earthaccess_logo.png +``` + +```{grid-item-card} Search by HUC Example +:link: ../SWOT-Hydrology/images/hydrology/BASIC/Search_by_HUC_ID +:link-type: doc +:img-top: ../_static/images/hydrology/_thumbs/Search_by_HUC_ID.png +``` + +```{grid-item-card} Search via SWORD River ID or Geometry +:link: ../SWOT-Hydrology/BASIC/Search_by_SWORD_River_ID_in_Earthdata +:link-type: doc +:img-top: ../_static/images/hydrology/SWORD_River_reaches.png +``` + +```{grid-item-card} SWOT Water Mask Raster Image Data Product: In AWS Cloud +:link: ../SWOT-Hydrology/BASIC/SWOT_Raster_Notebook_cloud_in_Earthdata +:link-type: doc +:img-top: ../_static/images/hydrology/Raster_QF_example.png +``` + +```{grid-item-card} SWOT Water Mask Raster Image Data Product: Local Machine Download +:link: ../SWOT-Hydrology/BASIC/SWOT_Raster_Notebook_local_in_Earthdata +:link-type: doc +:img-top: ../_static/images/hydrology/Raster_QF_example.png +``` + +```` \ No newline at end of file diff --git a/docs/hydrology/basic.rst b/docs/hydrology/basic.rst deleted file mode 100644 index e7b47fe..0000000 --- a/docs/hydrology/basic.rst +++ /dev/null @@ -1,34 +0,0 @@ -.. _basic: - -=================== -Basic -=================== - -.. nblinkgallery:: - :caption: Product Overview - :name: product_overview - - ../SWOT-Hydrology/BASIC/Product_Overview_SWOT_HR_cloud_in_Earthdata.ipynb - ../SWOT-Hydrology/BASIC/Product_Overview_SWOT_HR_local_in_Earthdata.ipynb - -.. nblinkgallery:: - :caption: Read and plot - :name: read_plot - - ../SWOT-Hydrology/BASIC/Read_SWOT_PixelCloud.ipynb - ../SWOT-Hydrology/BASIC/Read_SWOT_Raster.ipynb - ../SWOT-Hydrology/BASIC/Read_SWOT_RiverSP_Node.ipynb - ../SWOT-Hydrology/BASIC/Read_SWOT_RiverSP_Reach.ipynb - - -.. nblinkgallery:: - :caption: Tools to classify - :name: to_classify - - ../SWOT-Hydrology/BASIC/Create_River_Profiles.ipynb - ../SWOT-Hydrology/BASIC/Hydrocron_SWOT_timeseries_examples.ipynb - ../SWOT-Hydrology/BASIC/Search_by_earthaccess_python_package.ipynb - ../SWOT-Hydrology/BASIC/Search_by_HUC_ID.ipynb - ../SWOT-Hydrology/BASIC/Search_by_SWORD_River_ID_in_Earthdata.ipynb - ../SWOT-Hydrology/BASIC/SWOT_Raster_Notebook_cloud_in_Earthdata.ipynb - ../SWOT-Hydrology/BASIC/SWOT_Raster_Notebook_local_in_Earthdata.ipynb \ No newline at end of file diff --git a/docs/hydrology/hydrology.md b/docs/hydrology/hydrology.md new file mode 100644 index 0000000..5e928e8 --- /dev/null +++ b/docs/hydrology/hydrology.md @@ -0,0 +1,106 @@ + +# Swot Hydrology Data Tutorials + +Here are Hydrology-relevant tutorials and resources for the Surface Water and Ocean Topography (SWOT) Mission, using cloud computing or via local machine. + + +```{admonition} Warning +:class: warning + +These depict the most simple and commonly used methods to our knowledge to get a hand on SWOT HR products. +Should you have other methods or tools, please share! +``` + +## Tutorials + +````{grid} 1 1 2 2 +:gutter: 2 + +```{grid-item-card} Basic Gallery +:link: basic +:link-type: doc +``` + +```{grid-item-card} Intermediate Gallery +:link: intermediate +:link-type: doc +``` + +```{grid-item-card} Expert Gallery +:link: expert +:link-type: doc +``` +```` + +```{toctree} +:hidden: +:maxdepth: 1 + +basic +intermediate +expert +``` + +--- + +## Data Portals + +| | | +|---|---| +| ![hydroweb.next](../_static/images/hydrology/hydroweb_next_1024px.png) | ![podaac](../_static/images/hydrology/podaac.png) | + +All SWOT Hydrology data illustrated in these tutorials can be accessed via: + +- [PO.DAAC Earthdata](https://search.earthdata.nasa.gov/search?portal=podaac-cloud): search for, visualize and download all SWOT products via interactive GUI developed by NASA and PO.DAAC, Earthdata +- [hydroweb.next](https://hydroweb.next.theia-land.fr/): search for, visualize, and download SWOT Hydrology products via interactive GUI developed by CNES and Theia, hydroweb.next + +--- + +## Other useful tools + +- [Hydrocron](https://podaac.github.io/hydrocron/intro.html): An API that repackages the river shapefile dataset (L2_HR_RiverSP) into CSV or GeoJSON formats for easier time-series analysis. +- [SWODLR](https://github.com/podaac/swodlr): A system for generating on-demand raster products from SWOT L2 raster data with custom resolutions, projections, and extents. *(in development)* +- [SWOT Hydrology Toolbox](https://github.com/CNES/swot-hydrology-toolbox): Together with RiverObs, open-source tools to generate virtually all SWOT HR L2 products with fairly (but not fully) representative characteristics. +- [SWOT RiverObs Tool](https://github.com/SWOTAlgorithms/RiverObs.git): Together with SWOT Hydrology Toolbox, enables generation of SWOT HR L2 products. + +--- + +## A Priori Databases + +- [SWOT River Database (SWORD)](https://www.swordexplorer.com/): Database for rivers SWOT products are based upon; great for discovering river reach IDs. Available also via [hydroweb.next](https://hydroweb.next.theia-land.fr/?pid=SWOT_PRIOR_RIVER_DATABASE) +- [Prior Lake Database (PLD)](https://hydroweb.next.theia-land.fr/?pid=SWOT_PRIOR_LAKE_DATABASE): + - Add the PLD layer into hydroweb.next to see the lakes SWOT products are based upon, great for discovering lake IDs! + - Ask for PLD updates on the page :ref:`pld-label` + +--- + +## Products Description + +- [SWOT Data User Handbook](https://archive.podaac.earthdata.nasa.gov/podaac-ops-cumulus-docs/web-misc/swot_mission_docs/D-109532_SWOT_UserHandbook_20240502.pdf?_ga=2.124259722.1042075570.1716930479-1354658737.1715875596): first reference document +- [Product Description Documents](https://podaac.jpl.nasa.gov/SWOT?tab=datasets-information): more detailed product information +- [Latest Release Notes – Version C KaRIn Science Data Products](https://archive.podaac.earthdata.nasa.gov/podaac-ops-cumulus-docs/web-misc/swot_mission_docs/releases/SWOT_VersionC_KaRIn_Products_Release_Note.pdf): See section 6 for current issues and features + +--- + +## Additional Resources + +- [PO.DAAC Cookbook: SWOT Chapter](https://podaac.github.io/tutorials/quarto_text/SWOT.html): data resources, tips, tutorials for hydrology and oceanography SWOT communities +- [GIS SWOT StoryMap](https://storymaps.arcgis.com/stories/4a9184e813e540248040069580f6a54c) + +--- + +## Features of KaRIn Data that Users Should be Aware of + +- [Slide Deck Presented at the SWOT Science Team by Curtis Chen](https://swotst.aviso.altimetry.fr/fileadmin/user_upload/SWOTST2023/20230919_3_Karin_overview2/14h10-KaRInFeatures.pdf): Addresses practical aspects of interpreting SWOT KaRIn data products, answers FAQs, and provides tips to avoid misinterpretation. + +--- + +## Earthdata Webinar + +- [Accessing Data for the World's Water with SWOT](https://www.earthdata.nasa.gov/learn/webinars-and-tutorials/webinar-podaac-2024-03-20): Watch the recording! Learn to discover, access, and use SWOT mission data from PO.DAAC. + +--- + +## 2024 SWOT Hydrology Data Access Workshop + +[SWOT 2024 Hydrology Workshop](https://podaac.github.io/2024-SWOT-Hydro-Workshop/) diff --git a/docs/hydrology/hydrology.rst b/docs/hydrology/hydrology.rst deleted file mode 100644 index e739ba8..0000000 --- a/docs/hydrology/hydrology.rst +++ /dev/null @@ -1,86 +0,0 @@ -SWOT Hydrology Data Tutorials -==================================== - -Here are Hydrology-relevant tutorials and resources for the Surface Water and Ocean Topography (SWOT) Mission, using cloud computing or via local machine. - -.. warning:: - - Those depict the most simple and commonly used methods to our knowledge to get a hand on SWOT HR products. - Should you have other methods or tools, please share! - -.. toctree:: - :caption: Tutorials for - :maxdepth: 3 - - basic - intermediate - expert - - -------------- -Data Portals -------------- -.. |hnext| image:: ../_static/hydroweb_next_1024px.png - :width: 30% -.. |podaac| image:: ../_static/podaac.png - :width: 15% - -|hnext| |podaac| - -All SWOT Hydrology data illustrated in these tutorials can be accessed via - -* `PO.DAAC Earthdata `_: search for, visualize and download all SWOT products vie intereactive GUI developped by NASA and PO.DAAC, earthdata -* `hydroweb.next `_: Search for, visualize, and download SWOT Hydrology products via interactive GUI developed by CNES and Theia, hydroweb.next - - - ------------------------ -Other useful tools ------------------------ - -* `Hydrocron `_: An API that repackages the river shapefile dataset (L2_HR_RiverSP) into csv or GeoJSON formats that make time-series analysis easier. -* `SWODLR `_: A system for generating on demand raster products from SWOT L2 raster data with custom resolutions, projections, and extents. -in development -* `SWOT hydrology toolbox `_: Together with RiverObs, open-source tools that enable end-users to generate virtually all SWOT HR level-2 (L2) products with fairly (but not fully) representative characteristics (see section on caveats below) -* `SWOT RiverObs tool `_: Together with SWOT Hydrology Toolbox, open-source tools that enable end-users to generate virtually all SWOT HR level-2 (L2) products with fairly (but not fully) representative characteristics (see section on caveats below) - -------------------- -A Priori Databases -------------------- - -* `SWOT River Database (SWORD) `_: the database for rivers SWOT products are based upon, great for discovering river reach IDs!. The dataset is also available in `hydroweb.next `_ -* `Prior Lake Database (PLD) `_: - * Add the PLD layer into hydroweb.next to see the lakes SWOT products are based upon, great for discovering lake IDs! - * Ask for PLD updates in the page :ref:`pld-label` - ---------------------- -Products Description ---------------------- -* `SWOT Data User Handbook `_ is your first document -* `Product Description Documents `_: find more detailed information in this table! -* `Latest Release Notes - Version C KaRIn Science Data Products `_: See section 6 for current issues and features of the datasets! - ---------------------- -Additional Resources ---------------------- -* `PO.DAAC Cookbook: SWOT Chapter `_: Visit for more data resources, tips, and tutorials related to both the hydrology and oceanography SWOT communities. -* `GIS SWOT StoryMap `_ - ------------------------------------------------------ -Features of KaRIn Data that Users Should be Aware of ------------------------------------------------------ - -* `Slide Deck Presented at the SWOT Science Team by Curtis Chen `_: Addresses practical aspects of interpreting SWOT KaRIn data products, answers frequently asked questions, and provides tips to hopefully avoid misinterpretation and confusion of the data. - ------------------- -Earthdata Webinar ------------------- -* `Accessing Data for the World's Water with SWOT `_: Watch the Recording! Learn how to discover, access, and use SWOT mission data from PO.DAAC and how these data can lead to new, innovative science and applications in the world of water. - ------------------------------------------ -2024 SWOT Hydrology Data Access Workshop ------------------------------------------ - -`https://podaac.github.io/2024-SWOT-Hydro-Workshop/ `_ - - - diff --git a/docs/hydrology/intermediate.md b/docs/hydrology/intermediate.md new file mode 100644 index 0000000..1847c7e --- /dev/null +++ b/docs/hydrology/intermediate.md @@ -0,0 +1,98 @@ +(intermediate)= + +# Intermediate + +## Use multiple vector products at once + +````{grid} 1 1 3 4 +:gutter: 2 + +```{grid-item-card} Plot a lake timeseries from multiple Lake/River Single Pass products +:link: ../SWOT-Hydrology/INTERMEDIATE/plot_timeseries_from_multiple_lakesp_prior +:link-type: doc +:img-top: ../_static/images/hydrology/_thumbs/plot_timeseries_from_multiple_lakesp_prior.png +``` + +```{grid-item-card} Plot a lake’s geometries from multiple Lake/River Single Pass products +:link: ../SWOT-Hydrology/INTERMEDIATE/plot_geometries_from_multiple_lakesp_prior +:link-type: doc +:img-top: ../_static/images/hydrology/_thumbs/plot_geometries_from_multiple_lakesp_prior.png +``` +```` + +```{toctree} +:hidden: + +../SWOT-Hydrology/INTERMEDIATE/plot_timeseries_from_multiple_lakesp_prior +../SWOT-Hydrology/INTERMEDIATE/plot_geometries_from_multiple_lakesp_prior + +``` +--- + +## Download and Convert Pixel Cloud products into a user-friendly format + +````{grid} 1 1 3 4 +:gutter: 2 + +```{grid-item-card} Download and convert to Geopackage +:link: ../SWOT-Hydrology/INTERMEDIATE/download_pixc_to_gpkg +:link-type: doc +:img-top: ../_static/images/hydrology/geopkg.png +``` + +```{grid-item-card} Download and convert to Zarr +:link: ../SWOT-Hydrology/INTERMEDIATE/download_pixc_to_zarr +:link-type: doc +:img-top: ../_static/images/hydrology/zarr.png +``` + +```` + +```{toctree} +:hidden: + +../SWOT-Hydrology/INTERMEDIATE/download_pixc_to_gpkg +../SWOT-Hydrology/INTERMEDIATE/download_pixc_to_zarr +``` + +--- + +## Dive in Pixel Cloud data + +````{grid} 1 1 3 4 +:gutter: 2 + +```{grid-item-card} From PixC to Virtual Stations +:link: ../SWOT-Hydrology/INTERMEDIATE/from_pixc_to_virtual_stations +:link-type: doc +:img-top: ../_static/images/hydrology/_thumbs/from_pixc_to_virtual_stations.png +``` + +```{grid-item-card} From PixC to river profiles +:link: ../SWOT-Hydrology/INTERMEDIATE/from_pixc_to_river_profile +:link-type: doc +:img-top: ../_static/images/hydrology/_thumbs/from_pixc_to_river_profile.png +``` + +```{grid-item-card} Swot PixC Dataset Phase Unwrapping on a local machine +:link: ../SWOT-Hydrology/INTERMEDIATE/SWOT_PIXC_PhaseUnwrap_localmachine +:link-type: doc +:img-top: ../_static/images/hydrology/_thumbs/SWOT_PIXC_PhaseUnwrap_localmachine.png +``` + +```{grid-item-card} Swot PixC Dataset Area Aggregration on a local machine +:link: ../SWOT-Hydrology/INTERMEDIATE/SWOT_PIXC_Area_localmachine +:link-type: doc +:img-top: ../_static/images/hydrology/_thumbs/SWOT_PIXC_Area_localmachine.png +``` +```` + +```{toctree} +:hidden: + +../SWOT-Hydrology/INTERMEDIATE/from_pixc_to_virtual_stations +../SWOT-Hydrology/INTERMEDIATE/from_pixc_to_river_profile +../SWOT-Hydrology/INTERMEDIATE/SWOT_PIXC_PhaseUnwrap_localmachine +../SWOT-Hydrology/INTERMEDIATE/SWOT_PIXC_Area_localmachine + +``` \ No newline at end of file diff --git a/docs/hydrology/intermediate.rst b/docs/hydrology/intermediate.rst deleted file mode 100644 index 2be786a..0000000 --- a/docs/hydrology/intermediate.rst +++ /dev/null @@ -1,29 +0,0 @@ -.. _intermediate: - -=================== -Intermediate -=================== - -.. nblinkgallery:: - :caption: Use multiple vector products at once - :name: vector_products - - ../SWOT-Hydrology/INTERMEDIATE/plot_timeseries_from_multiple_lakesp_prior.ipynb - ../SWOT-Hydrology/INTERMEDIATE/plot_geometries_from_multiple_lakesp_prior.ipynb - -.. nblinkgallery:: - :caption: Download and Convert Pixel Cloud products into a user-friendly format - :name: pixcdust - - ../SWOT-Hydrology/INTERMEDIATE/download_pixc_to_gpkg.ipynb - ../SWOT-Hydrology/INTERMEDIATE/download_pixc_to_zarr.ipynb - - -.. nblinkgallery:: - :caption: Dive in Pixel Cloud data - :name: pixc4experts - - ../SWOT-Hydrology/INTERMEDIATE/from_pixc_to_virtual_stations.ipynb - ../SWOT-Hydrology/INTERMEDIATE/from_pixc_to_river_profile.ipynb - ../SWOT-Hydrology/INTERMEDIATE/SWOT_PIXC_PhaseUnwrap_localmachine.ipynb - ../SWOT-Hydrology/INTERMEDIATE/SWOT_PIXC_Area_localmachine.ipynb diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..a579c02 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,54 @@ +# Welcome to SWOT Gallery's documentation! + +## Galleries + +````{grid} 1 1 2 2 +:gutter: 2 + +```{grid-item-card} CNES Gallery +:link: cnes +:link-type: doc + +Examples and notebooks related to CNES workflows. +``` + +```{grid-item-card} Hydrology Gallery +:link: hydrology/hydrology +:link-type: doc + +Hydrology-related analyses and examples. +``` +```` + +```{toctree} +:caption: Galleries +:hidden: +:maxdepth: 1 + +cnes +hydrology/hydrology +``` +--- + +```{toctree} +:caption: Ocean Products +:maxdepth: 1 + +l3_lr_ssh/index +``` +--- + +```{toctree} +:caption: Ocean Tools +:maxdepth: 1 + +tools +``` + +--- + +## Indices and tables + +* {ref}`genindex` +* {ref}`modindex` +* {ref}`search` \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst deleted file mode 100644 index c82898a..0000000 --- a/docs/index.rst +++ /dev/null @@ -1,37 +0,0 @@ -.. SWOT Gallery documentation master file, created by - sphinx-quickstart on Fri May 31 09:55:29 2024. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -Welcome to SWOT Gallery's documentation! -======================================== - -.. toctree:: - :maxdepth: 2 - :caption: Contents: - -.. toctree:: - :caption: Python scripts test - :maxdepth: 2 - - auto/dummy/index - -.. toctree:: - :caption: Galleries - :maxdepth: 1 - - cnes - hydrology/hydrology - -.. toctree:: - :caption: Products - :maxdepth: 1 - - l3_lr_ssh/index - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` diff --git a/docs/requirements.txt b/docs/requirements.txt index 3736c73..4b7a056 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,8 +1,8 @@ numpy -nbsphinx +myst-nb sphinx>=6,<8 -sphinx-gallery sphinx-tabs +sphinx-design markupsafe==2.0.1 jinja2==3.1 xarray diff --git a/docs/scripts/generate_thumbnails.py b/docs/scripts/generate_thumbnails.py new file mode 100644 index 0000000..8a9687a --- /dev/null +++ b/docs/scripts/generate_thumbnails.py @@ -0,0 +1,72 @@ +import json +import base64 +from pathlib import Path +from PIL import Image +from io import BytesIO + +GALLERIES = [ + "Oceanography", + "Hydrology", +] + +def get_image_from_cell(cell): + """Return PIL image if cell contains a PNG output.""" + for output in cell.get("outputs", []): + data = output.get("data", {}) + if "image/png" in data: + img_data = data["image/png"] + + # parfois stocké sous forme de liste + if isinstance(img_data, list): + img_data = "".join(img_data) + + img_bytes = base64.b64decode(img_data) + return Image.open(BytesIO(img_bytes)) + + return None + + +def extract_thumbnail(nb_path, thumb_path): + with open(nb_path) as f: + nb = json.load(f) + + thumbnail_cell = None + fallback_cell = None + + for cell in nb["cells"]: + + tags = cell.get("metadata", {}).get("tags", []) + if "thumbnail" in tags and thumbnail_cell is None: + thumbnail_cell = cell + + if fallback_cell is None: + if get_image_from_cell(cell) is not None: + fallback_cell = cell + + target_cell = thumbnail_cell if thumbnail_cell else fallback_cell + + if target_cell: + img = get_image_from_cell(target_cell) + + if img: + img.thumbnail((400, 300)) + img.save(thumb_path) + return True + + return False + + +def main(): + for gallery in GALLERIES: + NOTEBOOK_DIR = Path(f"docs/SWOT-{gallery}") + THUMB_DIR = Path("docs/_static/images/") / gallery.lower() / "_thumbs" + THUMB_DIR.mkdir(parents=True, exist_ok=True) + for nb in NOTEBOOK_DIR.rglob("*.ipynb"): + thumb = THUMB_DIR / f"{nb.stem}.png" + + if not thumb.exists(): + extract_thumbnail(nb, thumb) + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/docs/scripts/generate_versions.py b/docs/scripts/generate_versions.py new file mode 100644 index 0000000..bf8519c --- /dev/null +++ b/docs/scripts/generate_versions.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +""" +generate_versions.py +Generate JSON file with gallery versions based on Git tags of submodules. +""" +import subprocess +from pathlib import Path + +GALLERIES = [ + "Oceanography", + "Hydrology", +] + +def get_git_tags_with_dates(repo_path): + """Return a list of (tag, date) tuples sorted by creation date descending.""" + try: + output = subprocess.check_output( + ["git", "-C", str(repo_path), "tag", "--sort=-creatordate", + "--format=%(refname:short)|%(creatordate:short)"], + text=True + ).splitlines() + tags = [] + for line in output: + if "|" in line: + tag, date = line.split("|", 1) + tags.append({"tag": tag.strip(), "date": date.strip()}) + return tags + except Exception: + return [] + +def get_versions(): + """Return a dict with latest version, all tags with dates, and zip URLs.""" + gallery_versions = {} + for name in GALLERIES: + path = Path(f"../docs/SWOT-{name}") + tags = get_git_tags_with_dates(path) + latest = tags[0] if tags else {"tag": "dev", "date": ""} + zip_base = f"https://github.com/SWOT-community/SWOT-{name}/archive/refs/tags" + gallery_versions[name] = { + "latest": latest["tag"], + "latest_date": latest["date"], + "tags": tags[1:], + "zip_base": zip_base, + } + return gallery_versions + +def get_myst_substitutions(): + """Return a dict of MyST substitutions for all galleries.""" + substitutions = {} + for name, v in get_versions().items(): + key = name.replace("-", "_").lower() + + substitutions[f"{key}_latest_badge"] = ( + f"{{bdg-primary}}`{v['latest']}` {{bdg-secondary}}`{v['latest_date']}`" + ) + + lines = [ + f"- {{bdg-primary}}`{v['latest']}` _{v['latest_date']}_ — " + f"[Download ZIP]({v['zip_base']}/{v['latest']}.zip) ⬅ **latest**" + ] + for t in v["tags"]: + lines.append( + f"- {{bdg-secondary}}`{t['tag']}` _{t['date']}_ — " + f"[Download ZIP]({v['zip_base']}/{t['tag']}.zip)" + ) + substitutions[f"{key}_downloads"] = "\n".join(lines) + substitutions[f"{key}_latest"] = v["latest"] + + return substitutions + +if __name__ == "__main__": + print(get_myst_substitutions()) \ No newline at end of file diff --git a/docs/scripts/insert_download_links.py b/docs/scripts/insert_download_links.py new file mode 100644 index 0000000..d0e1da7 --- /dev/null +++ b/docs/scripts/insert_download_links.py @@ -0,0 +1,29 @@ +import glob +import os +import nbformat + +GALLERIES = [ + "Oceanography", + "Hydrology", +] + +def process_notebook(fn): + nb = nbformat.read(fn, as_version=4) + basename = os.path.basename(fn) + + link = f"{{download}}`Download notebook <{basename}>`" + cell = nbformat.v4.new_markdown_cell(link) + + if not any(c.cell_type == "markdown" and link in c.source for c in nb.cells): + nb.cells.insert(0, cell) + nb.cells.append(cell) + nbformat.write(nb, fn) + +def main(): + for gallery in GALLERIES: + pattern = os.path.join(f"docs/SWOT-{gallery}", "**", "*.ipynb") + for fn in glob.glob(pattern, recursive=True): + process_notebook(fn) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/docs/tools.md b/docs/tools.md new file mode 100644 index 0000000..ecd79df --- /dev/null +++ b/docs/tools.md @@ -0,0 +1,39 @@ +# Ocean Tools + +Below is a collection of useful tools for working with satellite altimetry and oceanographic data. Each card links to the tool’s repository and documentation when available. + +````{grid} 1 1 3 4 +:gutter: 2 + +```{grid-item-card} Altimetry Downloader Aviso +:link: https://cnes.github.io/altimetry-downloader-aviso/ +:link-type: url +:img-top: _static/images/cnes_aviso.png + +Python tool to simplify downloading datasets from the CNES Aviso data center. Provides command-line utilities and Python interfaces to automate altimetry data acquisition. +``` + +```{grid-item-card} Altimetry-io +:link: https://github.com/CNES/altimetry-io +:link-type: repo +:img-top: _static/images/cnes_aviso.png + +Python library for reading and handling satellite altimetry datasets, including NetCDF products, variables, and metadata. +Relies on **FCollections** to efficiently manage and read NetCDF datasets. +``` + +```{grid-item-card} FCollections +:link: https://cnes.github.io/fcollections/ +:link-type: url +:img-top: _static/images/cnes_aviso.png + +Lightweight Python library for managing collections of files and datasets. Provides abstractions for structured data pipelines and metadata handling. +``` + +```{grid-item-card} Altimetry Search +:link: https://github.com/CNES/altimetry-search +:link-type: url +:img-top: _static/images/cnes_aviso.png + +Interactive tool for altimetry missions passes search - available on Binder and as a Python library. +``` \ No newline at end of file