Skip to content

Commit

Permalink
I1423, fixing style name problem on RTFD builds (#1424)
Browse files Browse the repository at this point in the history
* skyfield_data updated

* default name for generic styles

* use same name as in tests

* section moved

* next step raising on wrong class

* ignore HS|VS_GenericStyle

* log IndexError

* propper name for the workflow

* flake8

* name clarified

* syntax fix
  • Loading branch information
ReimarBauer authored Apr 22, 2022
1 parent 56b0d9a commit baa5932
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 9 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/build_docs_gallery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Build Gallery

on: pull_request

jobs:
Test-MSS-docs:
runs-on: ubuntu-latest

defaults:
run:
shell: bash

container:
image: openmss/mss-test:latest

steps:
- name: Trust My Directory
run: git config --global --add safe.directory /__w/MSS/MSS
- uses: actions/checkout@v2

- name: Create gallery
timeout-minutes: 25
run: |
source /opt/conda/bin/activate mssenv \
&& cd $GITHUB_WORKSPACE/docs \
&& python conf.py
1 change: 0 additions & 1 deletion docs/components.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Components
:maxdepth: 3

usage
deployment
mswms
mscolab
tutorials
Expand Down
4 changes: 2 additions & 2 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ aircraft performance. Such a file may be loaded using the 'performance settings'
in Table View. The aircraft performance is specified using tables given in the JSON format.
A basic configuration looks like the following file:

.. literalinclude:: samples/config/mss/performance_simple.json.sample
.. literalinclude:: samples/config/mss/performance_simple.json

This example file assumes a constant speed of 400 nm/h and a constant fuel consumption of
2900 lbs/h irrespective of flight level changes. The aircraft weight and available fuel are
Expand Down Expand Up @@ -315,4 +315,4 @@ for instance a number of the same plots or several flights or several forecast s

The retriever is an example which needs tweaked before using it

.. literalinclude:: samples/automation/retriever.py
.. literalinclude:: samples/automation/retriever.py
1 change: 1 addition & 0 deletions mslib/mswms/mpl_hsec_styles.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ class HS_GenericStyle(MPLBasemapHorizontalSectionStyle):
"""
Pressure level version for Chemical Mixing ratios.
"""
name = "HS_GenericStyle"
styles = [
("auto", "auto colour scale"),
("autolog", "auto logcolour scale"), ]
Expand Down
1 change: 1 addition & 0 deletions mslib/mswms/mpl_vsec_styles.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class VS_GenericStyle(AbstractVerticalSectionStyle):
"""
Vertical section of chemical species/other stuff
"""
name = "VS_GenericStyle"
styles = [
("auto", "auto colour scale"),
("autolog", "auto log colour scale"), ]
Expand Down
27 changes: 21 additions & 6 deletions mslib/mswms/wms.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,13 @@ def generate_gallery(self, create=False, clear=False, generate_code=False, sphin
dataset = [next(iter(mss_wms_settings.data))]
mss_wms_settings.register_horizontal_layers = [
(plot[1], dataset) for plot in inspect.getmembers(mpl_hsec_styles, inspect.isclass)
if not any(x in plot[0] or x in str(plot[1]) for x in ["Abstract", "Target", "fnord"])
if plot[0] != "HS_GenericStyle" and
not any(x in plot[0] or x in str(plot[1]) for x in ["Abstract", "Target", "fnord"])
]
mss_wms_settings.register_vertical_layers = [
(plot[1], dataset) for plot in inspect.getmembers(mpl_vsec_styles, inspect.isclass)
if not any(x in plot[0] or x in str(plot[1]) for x in ["Abstract", "Target", "fnord"])
if plot[0] != "VS_GenericStyle" and
not any(x in plot[0] or x in str(plot[1]) for x in ["Abstract", "Target", "fnord"])
]
mss_wms_settings.register_linear_layers = [
(plot[1], dataset) for plot in inspect.getmembers(mpl_lsec_styles, inspect.isclass)
Expand All @@ -249,7 +251,7 @@ def generate_gallery(self, create=False, clear=False, generate_code=False, sphin
tmp_path = tempfile.mkdtemp()
path = DOCS_LOCATION if sphinx else STATIC_LOCATION

if not plot_list:
if plot_list is None:
plot_list = [[self.lsec_drivers, self.lsec_layer_registry],
[self.vsec_drivers, self.vsec_layer_registry],
[self.hsec_drivers, self.hsec_layer_registry]]
Expand Down Expand Up @@ -287,9 +289,16 @@ def generate_gallery(self, create=False, clear=False, generate_code=False, sphin
elif not plot_driver.get_init_times():
itime = None

# All valid times for the specific init time
i_vtimes = plot_driver.get_valid_times(plot_object.required_datafields[0][1], file_type,
itime)
try:
# All valid times for the specific init time
i_vtimes = plot_driver.get_valid_times(plot_object.required_datafields[0][1],
file_type, itime)
except IndexError:
# ToDo fix demodata for sfc
logging.debug("plot_object.required_datafields incomplete"
" for filetype: %s in dataset: %s for l_type: %s",
file_type, dataset, l_type)
continue

# All specified valid times, or the latest if empty, or all if "all",
# or None if there are no valid times for the init time
Expand Down Expand Up @@ -455,6 +464,9 @@ def register_hsec_layer(self, datasets, layer_class):
if layer.name in self.hsec_layer_registry[dataset]:
raise ValueError(f"new layer is already registered? dataset={dataset} layer.name={layer.name} "
f"new={layer} old={self.hsec_layer_registry[dataset][layer.name]}")
if layer.name == "HS_GenericStyle":
raise ValueError(f"problem in configuration for dataset={dataset}. We found layer.name={layer.name}"
f" The class HS_GenericStyle should never be used.")
self.hsec_layer_registry[dataset][layer.name] = layer

def register_vsec_layer(self, datasets, layer_class):
Expand Down Expand Up @@ -483,6 +495,9 @@ def register_vsec_layer(self, datasets, layer_class):
if layer.name in self.vsec_layer_registry[dataset]:
raise ValueError(f"new layer is already registered? dataset={dataset} layer.name={layer.name} "
f"new={layer} old={self.vsec_layer_registry[dataset][layer.name]}")
if layer.name == "VS_GenericStyle":
raise ValueError(f"problem in configuration for dataset={dataset}. We found layer.name={layer.name}"
f" The class VS_GenericStyle should never be used.")
self.vsec_layer_registry[dataset][layer.name] = layer

def register_lsec_layer(self, datasets, variable=None, filetype="ml", layer_class=None):
Expand Down

0 comments on commit baa5932

Please sign in to comment.