Skip to content

Commit 1fbfa29

Browse files
authored
Merge pull request #988 from cbegeman/new-ocn-conservation-task
New ocean conservation task
2 parents ba6a6d8 + 5ac7568 commit 1fbfa29

10 files changed

Lines changed: 734 additions & 1 deletion

File tree

docs/developers_guide/api.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ Ocean tasks
6161
.. autosummary::
6262
:toctree: generated/
6363

64+
ConservationTask
6465
ClimatologyMapSST
6566
ClimatologyMapSSS
6667
ClimatologyMapMLD
@@ -75,6 +76,7 @@ Ocean tasks
7576
ClimatologyMapWaves
7677
IndexNino34
7778
MeridionalHeatTransport
79+
OceanHistogram
7880
StreamfunctionMOC
7981
TimeSeriesOHCAnomaly
8082
TimeSeriesTemperatureAnomaly

docs/users_guide/analysis_tasks.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Analysis Tasks
3737
tasks/oceanRegionalProfiles
3838
tasks/regionalTSDiagrams
3939
tasks/oceanHistogram
40+
tasks/conservation
4041

4142
tasks/climatologyMapSeaIceConcNH
4243
tasks/climatologyMapSeaIceThickNH
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
.. _task_conservation:
2+
3+
conservation
4+
============
5+
6+
An analysis task for plotting histograms of 2-d variables of climatologies
7+
in ocean regions.
8+
9+
Component and Tags::
10+
11+
component: ocean
12+
tags: timeseries, conservation
13+
14+
Configuration Options
15+
---------------------
16+
17+
The following configuration options are available for this task:
18+
19+
.. code-block:: cfg
20+
21+
[conservation]
22+
## options related to producing time series plots, often to compare against
23+
## observations and previous runs
24+
25+
# the year from which to compute anomalies if not the start year of the
26+
# simulation. This might be useful if a long spin-up cycle is performed and
27+
# only the anomaly over a later span of years is of interest.
28+
# anomalyRefYear = 249
29+
30+
# start and end years for timeseries analysis. Use endYear = end to indicate
31+
# that the full range of the data should be used. If errorOnMissing = False,
32+
# the start and end year will be clipped to the valid range. Otherwise, out
33+
# of bounds values will lead to an error. In a "control" config file used in
34+
# a "main vs. control" analysis run, the range of years must be valid and
35+
# cannot include "end" because the original data may not be available.
36+
startYear = 1
37+
endYear = end
38+
39+
# Plot types to generate. The following plotTypes are supported:
40+
# total_energy_flux : Total energy flux
41+
# absolute_energy_error : Energy error
42+
# ice_salt_flux : Salt flux related to land ice and sea ice
43+
# absolute_salt_error : Salt conservation error
44+
# total_mass_flux : Total mass flux
45+
# total_mass_change : Total mass anomaly
46+
# land_ice_mass_change : Mass anomaly due to land ice fluxes
47+
# land_ice_ssh_change : SSH anomaly due to land ice fluxes
48+
# land_ice_mass_flux_components : Mass fluxes from land ice
49+
plotTypes = 'land_ice_mass_flux_components'
50+
51+
# line colors for the main, control and obs curves
52+
# see https://matplotlib.org/stable/gallery/color/named_colors.html
53+
# and https://matplotlib.org/stable/tutorials/colors/colors.html
54+
mainColor = black
55+
controlColor = tab:red
56+
57+
58+
Example Result
59+
--------------
60+
61+
.. image:: examples/total_mass_flux.png
62+
:width: 500 px
63+
:align: center
121 KB
Loading

mpas_analysis/__main__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ def build_analysis_list(config, controlConfig):
172172
config, oceanClimatologyTasks['avg'], oceanRegionMasksTask,
173173
controlConfig))
174174

175+
analyses.append(ocean.ConservationTask(
176+
config, controlConfig))
177+
175178
analyses.append(ocean.RegionalTSDiagrams(
176179
config, oceanClimatologyTasks['avg'], oceanRegionMasksTask,
177180
controlConfig))

mpas_analysis/default.cfg

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ logsSubdirectory = logs
171171
mpasClimatologySubdirectory = clim/mpas
172172
mappingSubdirectory = mapping
173173
timeSeriesSubdirectory = timeseries
174+
conservationSubdirectory = timeseries
174175
histogramSubdirectory = histograms
175176
profilesSubdirectory = profiles
176177
maskSubdirectory = masks
@@ -322,6 +323,24 @@ obsColor5 = tab:cyan
322323

323324
fitColor1 = tab:blue
324325

326+
327+
[timeSeriesConservation]
328+
## options related to producing time series plots from the conservation
329+
## analysis member, often to compare previous runs
330+
331+
# Plot types to generate. The following plotTypes are supported:
332+
# total_energy_flux : Total energy flux
333+
# absolute_energy_error : Energy error
334+
# ice_salt_flux : Salt flux related to land ice and sea ice
335+
# absolute_salt_error : Salt conservation error
336+
# total_mass_flux : Total mass flux
337+
# total_mass_change : Total mass anomaly
338+
# land_ice_mass_change : Mass anomaly due to land ice fluxes
339+
# land_ice_ssh_change : SSH anomaly due to land ice fluxes
340+
# land_ice_mass_flux_components : Mass fluxes from land ice
341+
plotTypes = ['absolute_energy_error', 'absolute_salt_error', 'total_mass_change']
342+
343+
325344
[index]
326345
## options related to producing nino index.
327346

mpas_analysis/ocean/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
from mpas_analysis.ocean.climatology_map_argo import \
2424
ClimatologyMapArgoTemperature, ClimatologyMapArgoSalinity
2525

26+
from mpas_analysis.ocean.conservation import ConservationTask
27+
2628
from mpas_analysis.ocean.time_series_temperature_anomaly import \
2729
TimeSeriesTemperatureAnomaly
2830
from mpas_analysis.ocean.time_series_salinity_anomaly import \

0 commit comments

Comments
 (0)