NRLMMD-GEOIPS / geoips

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

Update relevant plugins to improve how we can modify plotting outputs #535

Open evrose54 opened 1 month ago

evrose54 commented 1 month ago

Reviewer Checklist

Related Issues

fixes NRLMMD-GEOIPS/geoips#259 fixes NRLMMD-GEOIPS/geoips#147

Testing Instructions

For now, run ./tests/scripts/.abi.static.Infrared.imagery_annotated_enhanced.sh and get an output of 0. You can also run ./tests/integration_tests/full_test.sh as this bash script now includes the new test added.

Summary

This enhancement updates feature / gridline -annotator yaml plugins and imagery-based module plugins to enhance the plotting configurability we can control as users within GeoIPS. It adds quite a few new attributes which we can use to control our plotting output. This includes:

To change the background of a frame, all you need to do is add a background: <mpl_color_name_or_hexadecimal_string> property within your gridline_annotator plugin. To modify the background color of the mapped portion of the image, you'll add the same section to your feature_annotator.

To change the offset of the labels for applicable imagery outputs, all you need to do is add an xpadding: <pixel_offset_int> and/or a ypadding: <pixel_offset_int> to the labels portion of your gridline annotator. Using this information, we will adjust the offset of your tick labels to the desired position.

To modify the font-based aspects of labels, you can do any of the following:

For examples of these new features, look at feature_annotator: default_oldlace and gridline_annotator: default_palegreen.

modified: geoips/image_utils/maps.py
modified: geoips/image_utils/mpl_utils.py
modified: geoips/plugins/modules/output_formatters/full_disk_image.py
modified: geoips/plugins/modules/output_formatters/imagery_annotated.py
modified: geoips/plugins/modules/output_formatters/imagery_windbarbs.py
modified: geoips/schema/feature_annotators/cartopy.yaml
modified: geoips/schema/gridline_annotators/cartopy.yaml
added: geoips/plugins/yaml/feature_annotators/default_oldlace.yaml
added: geoips/plugins/yaml/gridline_annotators/default_palegreen.yaml
added: tests/outputs/abi.static.Infrared.imagery_annotated_enhanced/20200918.195020.goes-16.abi.Infrared.goes_east.45p56.noaa.10p0.png
added: tests/scripts/abi.static.Infrared.imagery_annotated_enhanced.sh

Output

Here is an example of new feature / gridline -annotator plugins used to create imagery output products with modified backgrounds and offset labeling.

default_oldlace feature_annotator

interface: feature_annotators
name: default_oldlace
family: cartopy
docstring: |
  The default_oldlace feature_annotators plugin. All line types enabled. All colored 
  red. 2px coastlines, 1px countries, 0.5px states borders, and 0px rivers. oldlace 
  background color.
spec:
  coastline:
    enabled: true
    edgecolor: red
    linewidth: 2
  borders:
    enabled: true
    edgecolor: red
    linewidth: 1
  states:
    enabled: true
    edgecolor: red
    linewidth: 0.5
  rivers:
    enabled: false
  background: oldlace

default_palegreen gridline_annotator

interface: gridline_annotators
family: cartopy
name: default_palegreen
docstring: |
  The default_palegreen gridline_annotators plugin. Top and left gridline labels
  (offset 50 px), latitude and longitude lines colored black, auto spacing, 1px
  linewidth, and [4, 2] linestyle. palegreen background color.
spec:
  labels:
    top: true
    bottom: false
    left: true
    right: false
    xpadding: 50
    ypadding: 50
    fontfamily: 'URW Bookman'
    fontstyle: oblique
    fontweight: demibold
    fontsize: 50
  lines:
    color: black
    linestyle: [4, 2]
    linewidth: 1
  spacing:
    latitude: auto
    longitude: auto
  background: palegreen

New Output

20200918 195020 goes-16 abi Infrared goes_east 45p56 noaa 10p0

You can also use negative numbers for xpadding and ypadding which will offset the labels into the map-portion of the imagery. In the example below, we set xpadding and ypadding to -15. 20200918 195020 goes-16 abi Infrared goes_east labels_inside