Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add histogram plot type and ocean histogram task #917

Merged
merged 26 commits into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7726950
Prototype histograms with ssh climatology
cbegeman Sep 22, 2022
0f3f5cb
Generalize histogram task to 2-d ocean variables
cbegeman Sep 23, 2022
ba71bda
Enhance ocean histogram capabilities
cbegeman Sep 26, 2022
ec47ac6
Support regions list for ocean histogram
cbegeman Sep 26, 2022
3fed828
Support observation list for ocean histogram
cbegeman Sep 27, 2022
792c5b9
Use weights in histogram plot
cbegeman Sep 27, 2022
82c08f7
Change variable dicts to list for histogram subtask
cbegeman Sep 27, 2022
f2ac85f
Cleanup OceanHistogram
cbegeman Sep 27, 2022
063a549
Support comparison with control run
cbegeman Sep 28, 2022
5fda1fa
Clean up histogram plot
cbegeman Sep 28, 2022
0c2acca
Purge histogram directory
cbegeman Sep 29, 2022
d32b921
Aesthetic changes to OceanHistogram
cbegeman Sep 29, 2022
3121c17
Replace weightByVariable by weightList
cbegeman Sep 29, 2022
7266c6d
Aesthetic changes to OceanHistogram
cbegeman Sep 29, 2022
cc50fe4
Add histograms to default.cfg, off by default
cbegeman Oct 2, 2022
0e41dd6
Apply suggestions from code review
cbegeman Oct 10, 2022
7a9c641
Include regionGroup in file and task names
cbegeman Oct 10, 2022
ec2b848
Fix typo in ocean histogram task
cbegeman Oct 10, 2022
dd29f0c
Fixup mpas_analysis/__main__.py
cbegeman Oct 10, 2022
ba6dacd
Fix style
cbegeman Oct 10, 2022
2e6c67e
Change title, caption
cbegeman Oct 10, 2022
24cebbd
Fixup filePrefix for control run
cbegeman Oct 10, 2022
683de8b
Fixup masking for histogram vars
cbegeman Oct 11, 2022
abc6895
Fixup weightList checks
cbegeman Oct 11, 2022
c836ee2
Add oceanHistogram to user's guide
cbegeman Oct 11, 2022
c48363d
Fixup config options
cbegeman Oct 11, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/users_guide/analysis_tasks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Analysis Tasks
tasks/geojsonTransects
tasks/oceanRegionalProfiles
tasks/regionalTSDiagrams
tasks/oceanHistogram

tasks/climatologyMapSeaIceConcNH
tasks/climatologyMapSeaIceThickNH
Expand Down
12 changes: 6 additions & 6 deletions docs/users_guide/config/regions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ web page.
Region Groups
-------------

Currently, seven analysis tasks (:ref:`task_climatologyMapAntarcticMelt`,
Currently, eight analysis tasks (:ref:`task_climatologyMapAntarcticMelt`,
:ref:`task_hovmollerOceanRegions`, :ref:`task_oceanRegionalProfiles`,
:ref:`task_regionalTSDiagrams`, :ref:`task_streamfunctionMOC`,
:ref:`task_timeSeriesAntarcticMelt`, and :ref:`task_timeSeriesOceanRegions`)
use masks that define regions in an MPAS mesh as part of their analysis. Most
of these region group are defined in
:ref:`task_oceanHistogram`, :ref:`task_timeSeriesAntarcticMelt`, and
:ref:`task_timeSeriesOceanRegions`) use masks that define regions in an MPAS
mesh as part of their analysis. Most of these region group are defined in
:py:func:`geometric_features.aggregation.get_aggregator_by_name()`.
Several tasks (:ref:`task_hovmollerOceanRegions`,
Several tasks (:ref:`task_hovmollerOceanRegions`, :ref:`task_oceanHistogram`,
:ref:`task_oceanRegionalProfiles`, :ref:`task_regionalTSDiagrams`, and
:ref:`task_timeSeriesOceanRegions`) can use any of the defined region groups.
Currently, available region groups are: ``Antarctic Regions``,
Currently, available region groups are: ``Artic Ocean Regions``, ``Antarctic Regions``,
``Ocean Basins``, ``Ice Shelves``, and ``Ocean Subbasins``.

The option ``regionMaskSubdirectory`` in the ``[diagnostics]`` section specifies
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
120 changes: 120 additions & 0 deletions docs/users_guide/tasks/oceanHistogram.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
.. _task_oceanHistogram:

oceanHistogram
==============

An analysis task for plotting histograms of 2-d variables of climatologies
in ocean regions.

Component and Tags::

component: ocean
tags: climatology, histogram, regions, publicObs

Configuration Options
---------------------

The following configuration options are available for this task:

.. code-block:: cfg

[oceanHistogram]
## options related to plotting histograms of climatologies of 2-d ocean
## variables

# list of variables to plot
variableList = []

# list of observations to compare against
obsList = ['AVISO']

# list of ocean variables by which to weight variables in variable list
weightList = []

# list of regions to plot from the region list in [regions] below
regionGroups = ['Ocean Basins']

# list of region names within the region group listed above
regionNames = []

# Seasons to conduct analysis over
# Note: start and end year will be inherited from climatology section
seasons = ['ANN']

# Number of histogram bins
bins = 40

Region Groups
-------------

A list of groups of regions, each of which will get its own gallery on
the resulting analysis web page. See :ref:`config_region_groups` for
more information on the available region groups. By default,
the only region group is ``'Ocean Basins'``.

Region Names
------------

The ``regionNames`` can be set to ``['all']`` to plot all of the
regions in the geojson file. In the case of ``Antarctic Regions``, these
are:

.. code-block:: cfg

["Southern Ocean", "Southern Ocean 60S", "Eastern Weddell Sea Shelf",
"Eastern Weddell Sea Deep", "Western Weddell Sea Shelf",
"Western Weddell Sea Deep", "Weddell Sea Shelf", "Weddell Sea Deep",
"Bellingshausen Sea Shelf", "Bellingshausen Sea Deep", "Amundsen Sea Shelf",
"Amundsen Sea Deep", "Eastern Ross Sea Shelf", "Eastern Ross Sea Deep",
"Western Ross Sea Shelf", "Western Ross Sea Deep",
"East Antarctic Seas Shelf", "East Antarctic Seas Deep"]

For ``Ocean Basins``, they are:

.. code-block:: cfg

["Atlantic_Basin", "Pacific_Basin", "Indian_Basin", "Arctic_Basin",
"Southern_Ocean_Basin", "Mediterranean_Basin", "Global Ocean",
"Global Ocean 65N to 65S", "Global Ocean 15S to 15N"]

Variable List
-------------
The ``variableList`` option determines the variables to plot. Currently, only
2-d variables are supported but we envision extending to 3-d variables in the
near future. The variables are to be listed according to their registry names, with ``timeMontly_avg_`` prepended in the code.

Observations
------------
The ``obsList`` option contains a list of the names of observational data sets.
Currently, "AVISO" is the only data set available, but we anticipate adding
several additional data sets in the near future.

:ref:`aviso_ssh`

Weight List
-----------
The ``weightList`` option determines the variables to normalize by in plotting
the histogram. This is an optional feature. If used, ``weightList`` should be
of the same length as ``variableList``. We currently only support for 2-d
variables that are the same size as their corresponding variables in
``variableList`` and that are present in the restart file. For example, we use
``areaCell`` to weight cell-centered variables such as ``ssh``.

Bins
----
``bins`` sets the number of bins to include in the histogram.

Other Config Options
--------------------

Other config options include ``lineWidth``, ``mainColor``, ``obsColor``,
``controlColor``, ``titleFontSize``, ``defaultFontSize``. For more details on
the remaining config options, see
* :ref:`config_seasons`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm seeing:

/gpfs/fs1/home/ac.xylar/mpas-work/MPAS-Analysis/add_ocean_hisogram_task/docs/users_guide/tasks/oceanHistogram.rst:113: ERROR: Unexpected indentation.

But this line looks perfectly fine to me. I'm going to ignore it but figured I'd note this in case you can spot the problem for a later clean-up PR.


Example Result
--------------

.. image:: examples/histogram_ssh_aviso_atl.png
:width: 500 px
:align: center
17 changes: 11 additions & 6 deletions mpas_analysis/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ def build_analysis_list(config, controlConfig):
controlConfig))
analyses.append(ocean.TimeSeriesTransport(config, controlConfig))

analyses.append(ocean.OceanHistogram(config, oceanClimatologyTasks['avg'],
oceanRegionMasksTask,
controlConfig))
analyses.append(ocean.MeridionalHeatTransport(
config, oceanClimatologyTasks['avg'], controlConfig))

Expand All @@ -211,7 +214,8 @@ def build_analysis_list(config, controlConfig):
analyses.append(ocean.SoseTransects(config, oceanClimatologyTasks['avg'],
controlConfig))

analyses.append(ocean.GeojsonTransects(config, oceanClimatologyTasks['avg'],
analyses.append(ocean.GeojsonTransects(config,
oceanClimatologyTasks['avg'],
controlConfig))

oceanRegionalProfiles = ocean.OceanRegionalProfiles(
Expand Down Expand Up @@ -242,16 +246,16 @@ def build_analysis_list(config, controlConfig):
hemisphere='SH', controlConfig=controlConfig))
analyses.append(seaIceTimeSeriesTask)
analyses.append(sea_ice.ClimatologyMapSeaIceProduction(
config=config, mpas_climatology_task=seaIceClimatolgyTask,
config=config, mpas_climatology_task=seaIceClimatologyTask,
hemisphere='NH', control_config=controlConfig))
analyses.append(sea_ice.ClimatologyMapSeaIceProduction(
config=config, mpas_climatology_task=seaIceClimatolgyTask,
config=config, mpas_climatology_task=seaIceClimatologyTask,
hemisphere='SH', control_config=controlConfig))
analyses.append(sea_ice.ClimatologyMapSeaIceMelting(
config=config, mpas_climatology_task=seaIceClimatolgyTask,
config=config, mpas_climatology_task=seaIceClimatologyTask,
hemisphere='NH', control_config=controlConfig))
analyses.append(sea_ice.ClimatologyMapSeaIceMelting(
config=config, mpas_climatology_task=seaIceClimatolgyTask,
config=config, mpas_climatology_task=seaIceClimatologyTask,
hemisphere='SH', control_config=controlConfig))

analyses.append(sea_ice.TimeSeriesSeaIce(config, seaIceTimeSeriesTask,
Expand Down Expand Up @@ -715,7 +719,8 @@ def purge_output(config):
'No purge necessary.'.format(outputDirectory))
else:
for subdirectory in ['plots', 'logs', 'mpasClimatology', 'mapping',
'timeSeries', 'html', 'mask', 'profiles']:
'timeSeries', 'html', 'mask', 'profiles',
'histogram']:
option = '{}Subdirectory'.format(subdirectory)
directory = build_config_full_path(
config=config, section='output',
Expand Down
28 changes: 28 additions & 0 deletions mpas_analysis/default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ logsSubdirectory = logs
mpasClimatologySubdirectory = clim/mpas
mappingSubdirectory = mapping
timeSeriesSubdirectory = timeseries
histogramSubdirectory = histograms
profilesSubdirectory = profiles
maskSubdirectory = masks
# provide an absolute path to put HTML in an alternative location (e.g. a web
Expand Down Expand Up @@ -3415,6 +3416,33 @@ observationsLabel = SeaWIFS
galleryLabel = Chlorophyll


[oceanHistogram]
## options related to plotting histograms of climatologies of 2-d ocean
## variables

# list of variables to plot
variableList = []

# list of observations to compare against
obsList = ['AVISO']

# list of ocean variables by which to weight variables in variable list
weightList = []

# list of regions to plot from the region list in [regions] below
regionGroups = ['Ocean Basins']

# list of region names within the region group listed above
regionNames = []

# Seasons to conduct analysis over
# Note: start and end year will be inherited from climatology section
seasons = ['ANN']

# Number of histogram bins
bins = 40


[oceanRegionalProfiles]
## options related to plotting vertical profiles of regional means (and
## variability) of 3D MPAS fields
Expand Down
1 change: 1 addition & 0 deletions mpas_analysis/ocean/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from mpas_analysis.ocean.time_series_ssh_anomaly import TimeSeriesSSHAnomaly

from mpas_analysis.ocean.time_series_sst import TimeSeriesSST
from mpas_analysis.ocean.histogram import OceanHistogram
from mpas_analysis.ocean.index_nino34 import IndexNino34
from mpas_analysis.ocean.streamfunction_moc import StreamfunctionMOC
from mpas_analysis.ocean.meridional_heat_transport import \
Expand Down
Loading