NRLMMD-GEOIPS / geoips

Main Geolocated Information Processing System code base with basic functionality enabled.
https://nrlmmd-geoips.github.io/geoips/
Other
14 stars 11 forks source link

492 text based interface #504

Open evrose54 opened 5 months ago

evrose54 commented 5 months ago

Reviewer Checklist

Related Issues

fixes NRLMMD-GEOIPS/geoips#492 fixes NRLMMD-GEOIPS/geoips#424

Testing Instructions

Run ./tests/integration_tests/full_test.sh and get an output of 0 to know this is working correctly. I've also added a unit test for this new interface / plugins, which can be ran via pytest -v tests/unit_tests/plugins/text/ascii_palettes/test_ascii_palettes.py.

NOTE: This PR is still a draft and will likely fail. I need access to test_data_tpw in order to test that the new ascii-based products are running correctly.

Summary

While there are not many, GeoIPS has some text-based plugins which currently do not have a supporting interface. Currently, we only have ascii palettes implemented as text based plugins, and in truth, we do not treat them as we do other GeoIPS Plugins. Instead, the ascii palettes defined in these plugins are used in tandom alongside GeoIPS Colormappers to correctly get and apply the palette.

To prepare GeoIPS to be able to handle other types of text based plugins, we've decided to create a Text-Based Interface which can handle text plugins. This Interface acts similarly to both Yaml and Module based interfaces, and has functionality such as get_plugin and get_plugins. This PR only supports ascii palette text plugins, but was structured in a manner that could support other types of text plugins in the future.

ascii_palette plugins have a colormap attrubute, which is a Matplotlib.colors.ListedColormap which was created based on the ascii palette defined in the plugins source file. This colormap attribute can then be used alongside a colormapper to correctly apply the ascii palette to a certain output.

A large number of the yaml files below were modified because we've renamed colormapper matplotlib_linear_norm to linear_norm instead. We did this because the original name was inaccurate, as that colormapper didn't just produce matplotlib-based colormaps.

added:
  - geoips/interfaces/text_based/__init__.py
  - geoips/interfaces/text_based/ascii_palettes.py
  - geoips/plugins/modules/colormappers/ascii_based.py
  - tests/unit_tests/plugins/text/ascii_palettes/test_ascii_palettes.py
  - tests/unit_tests/plugins/text/ascii_palettes/example_palettes/good.txt
  - tests/unit_tests/plugins/text/ascii_palettes/example_palettes/invalid_palette.txt
  - tests/unit_tests/plugins/text/ascii_palettes/example_palettes/missing_docstring.txt
  - tests/unit_tests/plugins/text/ascii_palettes/example_palettes/missing_palette.txt
  - tests/unit_tests/plugins/text/ascii_palettes/example_palettes/missing_required_attr.txt
modified:
  - docs/source/releases/v1_13_0a0.rst
  - geoips/commandline/ancillary_info/cmd_instructions.yaml
  - geoips/create_plugin_registries.py
  - geoips/errors.py
  - geoips/geoips_utils.py
  - geoips/image_utils/colormap_utils.py
  - geoips/interfaces/__init__.py
  - geoips/interfaces/base.py
  - geoips/plugins/modules/colormappers/linear_norm.py
  - geoips/plugins/txt/ascii_palettes/tpw_purple.txt
  - geoips/plugins/yaml/product_defaults/Uncorrected-Channel.yaml
  - geoips/plugins/yaml/product_defaults/sfc_winds/incident-angle.yaml
  - geoips/plugins/yaml/product_defaults/sfc_winds/nrcs.yaml
  - geoips/plugins/yaml/product_defaults/tpw/TPW-CIMSS.yaml
  - geoips/plugins/yaml/product_defaults/tpw/TPW-PURPLE.yaml
  - geoips/plugins/yaml/product_defaults/tpw/TPW-PWAT.yaml
  - geoips/plugins/yaml/product_defaults/visir/Infrared-Gray.yaml
  - geoips/plugins/yaml/product_defaults/visir/Night-Vis-GeoIPS1.yaml
  - geoips/plugins/yaml/product_defaults/visir/Night-Vis.yaml
  - geoips/plugins/yaml/product_defaults/visir/Visible.yaml
  - geoips/plugins/yaml/products/abi.yaml
  - geoips/plugins/yaml/products/ahi.yaml
  - geoips/plugins/yaml/products/ascat.yaml
  - geoips/plugins/yaml/products/ascatuhr.yaml
  - geoips/plugins/yaml/products/modis.yaml
  - geoips/plugins/yaml/products/seviri.yaml
  - geoips/plugins/yaml/products/viirs.yaml
  - geoips/schema/product_defaults/bases/colormapper.yaml
moved:
  - geoips/plugins/modules/colormappers/matplotlib_linear_norm.py --> linear_norm.py
deleted:
  - geoips/plugins/modules/colormappers/tpw/__init__.py
  - geoips/plugins/modules/colormappers/tpw/tpw_pwat.py

Output

Will add output once I have access to test_data_tpw. For now, I've modified the product_defaults/visir/Infrared-Gray.yaml file to use all 3 ascii palettes which currently exist in GeoIPS. Shown below is the colormapper section of a yaml product defaults. It's extremely easy to use ascii palettes now.

  colormapper:
    plugin:
      name: ascii_based
      arguments:
        data_range: [-100.0, 50.0]
        cmap_name: tpw_cimss
        cbar_label: "Brightness Temperatures (degrees Celsius)"

Here are examples of Infrared-Gray used with each ascii_palette plugin.

TPW PWAT

goes16 abi Infrared-Gray tpw_pwat

TPW Purple

goes16 abi Infrared-Gray tpw_purple

TPW CIMSS

goes16 abi Infrared-Gray tpw_cimss

evrose54 commented 5 months ago

Please feel free to leave your opinions on this PR and if you'd like to see any changes / revisions.