From 9df6896d40aeb0ac0f26c172a7ed65b234236751 Mon Sep 17 00:00:00 2001 From: Max Grover Date: Tue, 2 Jan 2024 12:30:18 -0600 Subject: [PATCH 1/3] FIX: Fix failing CI by pinning older metpy versions (#1501) --- continuous_integration/environment-ci.yml | 2 +- doc/environment.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/continuous_integration/environment-ci.yml b/continuous_integration/environment-ci.yml index 427602cb43..7a3bff69cd 100644 --- a/continuous_integration/environment-ci.yml +++ b/continuous_integration/environment-ci.yml @@ -13,7 +13,7 @@ dependencies: - cartopy - cvxopt - xarray - - metpy + - metpy<1.6 - pytest-cov - pytest-mpl - coveralls diff --git a/doc/environment.yml b/doc/environment.yml index 0c10630d2b..b17e6d6c8a 100644 --- a/doc/environment.yml +++ b/doc/environment.yml @@ -11,7 +11,7 @@ dependencies: - netcdf4 - pytest - wradlib - - metpy + - metpy<1.6 - cartopy - cvxopt - xarray From c2fc6d8aa57bacd2a60f6c3c913fb181135af2b3 Mon Sep 17 00:00:00 2001 From: Max Grover Date: Wed, 3 Jan 2024 17:36:28 -0600 Subject: [PATCH 2/3] FIX: Fix the failing build of the gallery (#1503) --- doc/environment.yml | 2 +- doc/source/conf.py | 17 ++++++++++------- examples/retrieve/plot_convective_stratiform.py | 4 ++-- examples/retrieve/plot_feature_detection.py | 9 ++++----- examples/retrieve/plot_hydrometeor.py | 4 ++-- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/doc/environment.yml b/doc/environment.yml index b17e6d6c8a..c9ff12e75f 100644 --- a/doc/environment.yml +++ b/doc/environment.yml @@ -15,7 +15,7 @@ dependencies: - cartopy - cvxopt - xarray - - sphinx + - sphinx<7.2 - ipython - pandoc - pkg-config diff --git a/doc/source/conf.py b/doc/source/conf.py index 0a6380bfb6..1977c7c5e5 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -49,7 +49,6 @@ "sphinx.ext.napoleon", "sphinx_copybutton", "sphinx_gallery.gen_gallery", - "sphinx_gallery.load_style", "sphinx_design", "nbsphinx", "myst_nb", @@ -57,10 +56,11 @@ ] exclude_patterns = ["_build", "**.ipynb_checkpoints"] - -# only include examples if the BUILD_PYART_EXAMPLES env. variable is set -extensions.append("sphinx_gallery.gen_gallery") -sphinx_gallery_conf = {"examples_dirs": "../../examples", "gallery_dirs": "examples"} +sphinx_gallery_conf = { + "examples_dirs": "../../examples", + "gallery_dirs": "examples", + "abort_on_example_error": True, +} # Configuration options for plot_directive. See: @@ -124,7 +124,7 @@ # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = "en" # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. @@ -203,7 +203,7 @@ post_auto_excerpt = 2 # Don't execute the jupyter notebooks -jupyter_execute_notebooks = "off" +nb_execution_mode = "off" # Extra variables that will be available to the templates. Used to create the # links to the Github repository sources and issues @@ -263,6 +263,9 @@ # (source start file, target name, title, author, # dir menu entry, description, category) +# Make MyST generate anchors for headings +myst_heading_anchors = 2 + # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = { "python": ("https://docs.python.org/3/", None), diff --git a/examples/retrieve/plot_convective_stratiform.py b/examples/retrieve/plot_convective_stratiform.py index 2d905ee208..306c4d3c8c 100644 --- a/examples/retrieve/plot_convective_stratiform.py +++ b/examples/retrieve/plot_convective_stratiform.py @@ -21,7 +21,7 @@ ###################################### # How the algorithm works -# ---------- +# ----------------------- # This first section describes how the convective-stratiform algorithm works (see references for full details). This # algorithm is a feature detection algorithm and classifies fields as "convective" or "stratiform". The algorithm is # designed to detect features in a reflectivity field but can also detect features in fields such as rain rate or @@ -446,7 +446,7 @@ ###################################### # Summary of recommendations and best practices -# ---------- +# --------------------------------------------- # * Tune your parameters to your specific purpose # * Use a rescaled field if possible (i.e. linear reflectivity, rain or snow rate) # * Keep ``estimate_flag=True`` to see uncertainty in classification diff --git a/examples/retrieve/plot_feature_detection.py b/examples/retrieve/plot_feature_detection.py index 5122ce6928..b12aa6f97c 100644 --- a/examples/retrieve/plot_feature_detection.py +++ b/examples/retrieve/plot_feature_detection.py @@ -23,7 +23,7 @@ ###################################### # How the algorithm works -# ---------- +# ----------------------- # The feature detection algorithm works by identifying features that exceed the background value by an amount that # varies with the background value. The algorithm is heavily customizable and is designed to work with a variety of # datasets. Here, we show several examples of how to use the algorithm with different types of radar data. @@ -33,7 +33,7 @@ ###################################### # Part 1: Warm-season convective-stratiform classification -# ---------- +# -------------------------------------------------------- # **Classification of summer convective example** # # Our first example classifies echo from a summer convective event. @@ -397,8 +397,7 @@ ###################################### # Part 2: Cool-season feature detection -# ---------- -###################################### +# ------------------------------------- # **Winter storm example** # # In this example, we will show how to algorithm can be used to detect features (snow bands) in winter storms. Here, we @@ -778,7 +777,7 @@ def quick_image_mute(field, muted_ref): plt.show() ###################################### # Summary of recommendations and best practices -# ---------- +# --------------------------------------------- # * Tune your parameters to your specific purpose # * Use a rescaled field if possible (i.e. linear reflectivity, rain or snow rate) # * Keep ``estimate_flag=True`` to see uncertainty in classification diff --git a/examples/retrieve/plot_hydrometeor.py b/examples/retrieve/plot_hydrometeor.py index e4447cf9de..43702ca962 100644 --- a/examples/retrieve/plot_hydrometeor.py +++ b/examples/retrieve/plot_hydrometeor.py @@ -1,7 +1,7 @@ """ -========================================= +============================================= Calculate and Plot hydrometeor classification -========================================= +============================================= Calculates a hydrometeor classification and displays the results """ From 297e9eb9be5622b74ac2e066564fc8f3436378d0 Mon Sep 17 00:00:00 2001 From: Max Grover Date: Thu, 4 Jan 2024 10:25:25 -0600 Subject: [PATCH 3/3] ENH: Speed up IO for nexrad level2 file (#1504) --- pyart/io/nexrad_level2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyart/io/nexrad_level2.py b/pyart/io/nexrad_level2.py index 29469d6cff..38a3e88530 100644 --- a/pyart/io/nexrad_level2.py +++ b/pyart/io/nexrad_level2.py @@ -592,7 +592,7 @@ def _decompress_records(file_handler): cbuf = file_handler.read() # read all data from the file decompressor = bz2.BZ2Decompressor() skip = _structure_size(VOLUME_HEADER) + CONTROL_WORD_SIZE - buf = decompressor.decompress(cbuf[skip:]) + buf = bytearray(decompressor.decompress(cbuf[skip:])) while len(decompressor.unused_data): cbuf = decompressor.unused_data decompressor = bz2.BZ2Decompressor()