From a13e074abced68d4d9e8d18192361ded167f7ef6 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Fri, 25 Feb 2022 07:22:17 -0700 Subject: [PATCH 01/40] Reduce ncclimo tasks for Anvil to 6 This is needed because of out-of-memory errors that have been seen in some recent runs. --- mpas_analysis/configuration/anvil.cfg | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mpas_analysis/configuration/anvil.cfg b/mpas_analysis/configuration/anvil.cfg index d8097d947..8119d1e34 100644 --- a/mpas_analysis/configuration/anvil.cfg +++ b/mpas_analysis/configuration/anvil.cfg @@ -14,7 +14,9 @@ ncclimoParallelMode = bck # the number of total threads to use when ncclimo runs in "bck" or "mpi" mode. # Reduce this number if ncclimo is crashing (maybe because it is out of memory). # The number of threads must be a factor of 12 (1, 2, 3, 4, 6 or 12). -ncclimoThreads = 12 + +# Anvil is experiencing out-of-memory errors with 12 tasks so reducing to 6 +ncclimoThreads = 6 # the number of MPI tasks to use in creating mapping files (1 means tasks run in # serial, the default) From 756cbe427a3b5e3d6db4a75bd0b61a8d1f4dd051 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Tue, 8 Mar 2022 16:44:16 +0100 Subject: [PATCH 02/40] Add thermal forcing to Antarctic regional plots --- mpas_analysis/default.cfg | 6 ++ .../ocean/time_series_ocean_regions.py | 61 +++++++++++++++++-- 2 files changed, 61 insertions(+), 6 deletions(-) diff --git a/mpas_analysis/default.cfg b/mpas_analysis/default.cfg index b81528b02..b3af43e18 100644 --- a/mpas_analysis/default.cfg +++ b/mpas_analysis/default.cfg @@ -1514,6 +1514,12 @@ variables = [{'name': 'temperature', 'title': 'Potential Density', 'units': 'kg m$$^{-3}$$', 'mpas': 'timeMonthly_avg_potentialDensity'}, + {'name': 'thermalForcing', + 'title': 'Thermal Forcing', + 'units': r'$$^\circ$$C', + 'mpas': ['timeMonthly_avg_activeTracers_temperature', + 'timeMonthly_avg_activeTracers_salinity', + 'timeMonthly_avg_density']}, {'name': 'mixedLayerDepth', 'title': 'Mixed Layer Depth', 'units': 'm', diff --git a/mpas_analysis/ocean/time_series_ocean_regions.py b/mpas_analysis/ocean/time_series_ocean_regions.py index bef0375b2..69a07906b 100644 --- a/mpas_analysis/ocean/time_series_ocean_regions.py +++ b/mpas_analysis/ocean/time_series_ocean_regions.py @@ -17,6 +17,7 @@ import matplotlib.pyplot as plt from geometric_features import FeatureCollection, read_feature_collection +from mpas_tools.cime.constants import constants as cime_constants from mpas_analysis.shared.analysis_task import AnalysisTask @@ -529,8 +530,17 @@ def run_task(self): # {{{ variables = config.getExpression(sectionName, 'variables') - variableList = [var['mpas'] for var in variables] + \ - ['timeMonthly_avg_layerThickness'] + variableList = {'timeMonthly_avg_layerThickness'} + + for var in variables: + mpas_var = var['mpas'] + if mpas_var == 'none': + continue + if isinstance(mpas_var, (list, tuple)): + for v in mpas_var: + variableList.add(v) + else: + variableList.add(mpas_var) outputExists = os.path.exists(outFileName) outputValid = outputExists @@ -601,10 +611,17 @@ def run_task(self): # {{{ for var in variables: outName = var['name'] self.logger.info(' {}'.format(outName)) - mpasVarName = var['mpas'] - timeSeries = dsIn[mpasVarName].where(cellMask, drop=True) - units = timeSeries.units - description = timeSeries.long_name + if outName == 'thermalForcing': + timeSeries = self._add_thermal_forcing(dsIn, cellMask) + units = 'degrees Celsius' + description = 'potential temperature minus the ' \ + 'potential freezing temperature' + else: + mpasVarName = var['mpas'] + timeSeries = \ + dsIn[mpasVarName].where(cellMask, drop=True) + units = timeSeries.units + description = timeSeries.long_name is3d = 'nVertLevels' in timeSeries.dims if is3d: @@ -640,6 +657,38 @@ def run_task(self): # {{{ dsOut['month'].attrs['units'] = 'months' write_netcdf(dsOut, outFileName) # }}} + + def _add_thermal_forcing(self, dsIn, cellMask): + """ compute the thermal forcing """ + + c0 = self.namelist.getfloat( + 'config_land_ice_cavity_freezing_temperature_coeff_0') + cs = self.namelist.getfloat( + 'config_land_ice_cavity_freezing_temperature_coeff_S') + cp = self.namelist.getfloat( + 'config_land_ice_cavity_freezing_temperature_coeff_p') + cps = self.namelist.getfloat( + 'config_land_ice_cavity_freezing_temperature_coeff_pS') + + vars = ['timeMonthly_avg_activeTracers_temperature', + 'timeMonthly_avg_activeTracers_salinity', + 'timeMonthly_avg_density', + 'timeMonthly_avg_layerThickness'] + ds = dsIn[vars].where(cellMask, drop=True) + + temp = ds.timeMonthly_avg_activeTracers_temperature + salin = ds.timeMonthly_avg_activeTracers_salinity + dens = ds.timeMonthly_avg_density + thick = ds.timeMonthly_avg_layerThickness + + dp = cime_constants['SHR_CONST_G']*dens*thick + press = dp.cumsum(dim='nVertLevels') - 0.5*dp + + tempFreeze = c0 + cs*salin + cp*press + cps*press*salin + + timeSeries = temp - tempFreeze + + return timeSeries # }}} From 23b34dc0edcf116b444e42a38891b831c791c902 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Wed, 6 Apr 2022 18:49:33 +0200 Subject: [PATCH 03/40] Add flake8 to dev environment --- dev-spec.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/dev-spec.txt b/dev-spec.txt index ac43d1594..953855b5f 100644 --- a/dev-spec.txt +++ b/dev-spec.txt @@ -31,6 +31,7 @@ six xarray>=0.14.1 # Development +flake8 git pip pytest From db4ea89c7916a133b33e7d264fa9eaaaafc7eac3 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Fri, 15 Apr 2022 15:12:01 +0200 Subject: [PATCH 04/40] Remove the MpasAnalysisConfigParser and its test --- docs/api.rst | 11 -- mpas_analysis/configuration/__init__.py | 2 - .../mpas_analysis_config_parser.py | 132 ---------------- mpas_analysis/test/test_mpas_config_parser.py | 143 ------------------ .../test/test_mpas_config_parser/analysis.cfg | 47 ------ 5 files changed, 335 deletions(-) delete mode 100644 mpas_analysis/configuration/mpas_analysis_config_parser.py delete mode 100644 mpas_analysis/test/test_mpas_config_parser.py delete mode 100644 mpas_analysis/test/test_mpas_config_parser/analysis.cfg diff --git a/docs/api.rst b/docs/api.rst index 4b7a32b02..a1a1ebfd0 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -135,17 +135,6 @@ Sea ice tasks PlotClimatologyMapSubtask.set_plot_info -Configuration -============== -.. currentmodule:: mpas_analysis.configuration - -.. autosummary:: - :toctree: generated/ - - MpasAnalysisConfigParser.getWithDefault - MpasAnalysisConfigParser.getExpression - - Shared modules ============== diff --git a/mpas_analysis/configuration/__init__.py b/mpas_analysis/configuration/__init__.py index 644ae9562..e69de29bb 100644 --- a/mpas_analysis/configuration/__init__.py +++ b/mpas_analysis/configuration/__init__.py @@ -1,2 +0,0 @@ -from mpas_analysis.configuration.mpas_analysis_config_parser import \ - MpasAnalysisConfigParser diff --git a/mpas_analysis/configuration/mpas_analysis_config_parser.py b/mpas_analysis/configuration/mpas_analysis_config_parser.py deleted file mode 100644 index bbda4346a..000000000 --- a/mpas_analysis/configuration/mpas_analysis_config_parser.py +++ /dev/null @@ -1,132 +0,0 @@ -# This software is open source software available under the BSD-3 license. -# -# Copyright (c) 2020 Triad National Security, LLC. All rights reserved. -# Copyright (c) 2020 Lawrence Livermore National Security, LLC. All rights -# reserved. -# Copyright (c) 2020 UT-Battelle, LLC. All rights reserved. -# -# Additional copyright and license information can be found in the LICENSE file -# distributed with this code, or at -# https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -""" -A configuratin parser class for MPAS analysis. MpasAnalysisConfigParser adds -the capabilities to get an option including a default value -(``getWithDefault(section, option, default, ...)``) and to get options -that are lists, tuples, dicts, etc (``getExpression(section, option)``). -""" -# Authors -# ------- -# Xylar Asay-Davis, Phillip J. Wolfram - -from __future__ import absolute_import, division, print_function, \ - unicode_literals - -import numbers -import ast -import six -import numpy as np - -from six.moves.configparser import ConfigParser - -if six.PY3: - xrange = range - -npallow = dict(linspace=np.linspace, xrange=xrange, range=range, array=np.array, - arange=np.arange, pi=np.pi, Pi=np.pi, int=int, __builtins__=None) - - -class MpasAnalysisConfigParser(ConfigParser): - - def getWithDefault(self, section, option, default): - """ - Get an option, using the supplied default value if the option is not - present. - - Parameters - ---------- - section : str - The section in the config file - - option : str - The option in the config file - - default : {bool, int, float, list, tuple, dict, str} - The default value if the option and/or section is not found, used - to determine the type of the option if it *is* found. If - ``default`` is a list, tuple, or dict, ``getExpression(...)`` is - used if the option is present in the config file. - """ - # Authors - # ------- - # Xylar Asay-Davis - - if self.has_section(section): - if self.has_option(section, option): - if isinstance(default, bool): - return self.getboolean(section, option) - elif isinstance(default, numbers.Integral): - return self.getint(section, option) - elif isinstance(default, numbers.Real): - return self.getfloat(section, option) - elif isinstance(default, (list, tuple, dict)): - return self.getExpression(section, option) - else: - return self.get(section, option) - - # we didn't find the entry so set it to the default - if not self.has_section(section): - self.add_section(section) - self.set(section, option, str(default)) - return default - - def getExpression(self, section, option, elementType=None, - usenumpyfunc=False): - """ - Get an option as an expression (typically a list, though tuples and - dicts are also available). The expression is required to have valid - python syntax, so that string entries are required to be in single or - double quotes. - - Parameters - ---------- - section : str - The section in the config file - - option : str - The option in the config file - - elementType : {bool, int, float, list, tuple, str}, optional - If supplied, each element in a list or tuple, or - each value in a dictionary are cast to this type. This is likely - most useful for ensuring that all elements in a list of numbers are - of type float, rather than int, when the distinction is important. - - usenumpyfunc : bool, optional - If ``True``, the expression is evaluated including functionality - from the numpy package (which can be referenced either as ``numpy`` - or ``np``). - """ - # Authors - # ------- - # Xylar Asay-Davis, Phillip J. Wolfram - - expressionString = self.get(section, option) - if usenumpyfunc: - assert '__' not in expressionString, \ - "'__' is not allowed in {} "\ - "for `usenumpyfunc=True`".format(expressionString) - sanitizedstr = expressionString.replace('np.', '')\ - .replace('numpy.', '')\ - .replace('__', '') - result = eval(sanitizedstr, npallow) - else: - result = ast.literal_eval(expressionString) - - if elementType is not None: - if isinstance(result, (list, tuple)): - result = [elementType(element) for element in result] - elif isinstance(result, dict): - for key in result: - result[key] = elementType(result[key]) - - return result diff --git a/mpas_analysis/test/test_mpas_config_parser.py b/mpas_analysis/test/test_mpas_config_parser.py deleted file mode 100644 index 516012381..000000000 --- a/mpas_analysis/test/test_mpas_config_parser.py +++ /dev/null @@ -1,143 +0,0 @@ -# This software is open source software available under the BSD-3 license. -# -# Copyright (c) 2020 Triad National Security, LLC. All rights reserved. -# Copyright (c) 2020 Lawrence Livermore National Security, LLC. All rights -# reserved. -# Copyright (c) 2020 UT-Battelle, LLC. All rights reserved. -# -# Additional copyright and license information can be found in the LICENSE file -# distributed with this code, or at -# https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -""" -Unit test infrastructure for MpasAnalysisConfigParser - -Xylar Asay-Davis, Phillip J. Wolfram -01/31/2017 -""" - -from __future__ import absolute_import, division, print_function, \ - unicode_literals - -import pytest -import six -from six.moves import configparser -from mpas_analysis.test import TestCase, loaddatadir -from mpas_analysis.configuration import MpasAnalysisConfigParser -from mpas_analysis.test import requires_numpy - - -@pytest.mark.usefixtures("loaddatadir") -class TestMPASAnalysisConfigParser(TestCase): - def setup_config(self): - configPath = self.datadir.join('analysis.cfg') - self.config = MpasAnalysisConfigParser() - self.config.read(str(configPath)) - - def check_container(self, container, container_type, item_type): - assert isinstance(container, container_type) - for item in container: - assert isinstance(item, item_type) - - def test_read_config(self): - self.setup_config() - - colorMapName = self.config.get('sst_modelvsobs', 'cmapDiff') - self.assertEqual(colorMapName, 'coolwarm') - - self.assertEqual(self.config.getint('Test', 'testInt'), 15) - self.assertEqual(self.config.getExpression('Test', 'testInt'), 15) - - self.assertEqual(self.config.getfloat('Test', 'testFloat'), 18.0) - self.assertEqual(self.config.getExpression('Test', 'testFloat'), 18.0) - - self.assertEqual(self.config.getfloat('Test', 'testFloat2'), 3.) - self.assertEqual(self.config.getExpression('Test', 'testFloat2'), 3.) - - self.assertEqual(self.config.getboolean('Test', 'testBool'), True) - self.assertEqual(self.config.getExpression('Test', 'testBool'), True) - - testList = self.config.getExpression('sst_modelvsobs', - 'cmapIndicesModelObs') - self.check_container(testList, list, int) - self.assertEqual(testList, [0, 40, 80, 110, 140, 170, 200, 230, 255]) - - testList = self.config.getExpression('sst_modelvsobs', - 'cmapIndicesModelObs', - elementType=float) - self.check_container(testList, list, float) - self.assertEqual(testList, [0., 40., 80., 110., 140., 170., 200., - 230., 255.]) - - testList = self.config.getExpression('sst_modelvsobs', - 'comparisonTimes') - self.check_container(testList, list, str) - self.assertEqual(testList, ['JFM', 'JAS', 'ANN']) - - testList = self.config.getExpression('Test', 'testList') - self.check_container(testList, list, float) - self.assertEqual(testList, [0.5, 0.1, 0.5]) - - testTuple = self.config.getExpression('Test', 'testTuple') - assert isinstance(testTuple, tuple) - self.assertEqual(testTuple, (5, 0.1, 'string')) - - testDict = self.config.getExpression('Test', 'testDict') - assert isinstance(testDict, dict) - self.assertEqual(testDict, {'key1': 'string', - 'key2': -12, - 'key3': False}) - - with six.assertRaisesRegex( - self, - configparser.NoOptionError, - "No option 'doesntexist' in section: 'Test'"): - self.config.getExpression(str('Test'), str('doesntexist')) - - @requires_numpy - def test_read_config_numpy(self): - self.setup_config() - - # tests numpy evaluation capability - import numpy as np - for testname in ['testNumpyarange' + str(ii) for ii in np.arange(3)]: - self.assertArrayEqual(self.config.getExpression('TestNumpy', - testname, - usenumpyfunc=True), - np.arange(0, 1, 10)) - for testname in ['testNumpylinspace' + str(ii) for ii in np.arange(3)]: - self.assertArrayEqual(self.config.getExpression('TestNumpy', - testname, - usenumpyfunc=True), - np.linspace(0, 1, 10)) - for testNumpy in ['testNumpypi' + str(ii) for ii in np.arange(3)] + \ - ['testNumpyPi']: - self.assertEqual(self.config.getExpression('TestNumpy', testNumpy, - usenumpyfunc=True), - np.pi) - with six.assertRaisesRegex( - self, - AssertionError, - "'__' is not allowed in .* for `usenumpyfunc=True`"): - self.config.getExpression('TestNumpy', 'testBadStr', - usenumpyfunc=True), - - def test_get_with_default(self): - self.setup_config() - - def check_get_with_default(name, value, dtype): - # test an options that doesn't exist using getWithDefault - var = self.config.getWithDefault('sst_modelvsobs', name, value) - assert isinstance(var, dtype) - self.assertEqual(var, value) - - # test several types with getWithDefault - check_get_with_default(name='aBool', value=True, dtype=bool) - check_get_with_default(name='anInt', value=1, dtype=six.integer_types) - check_get_with_default(name='aFloat', value=1.0, dtype=float) - check_get_with_default(name='aList', value=[1, 2, 3], dtype=list) - check_get_with_default(name='aTuple', value=(1, 2, 3), dtype=tuple) - check_get_with_default(name='aDict', value={'blah': 1}, dtype=dict) - check_get_with_default(name='aStr', value='blah', - dtype=six.string_types) - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/test/test_mpas_config_parser/analysis.cfg b/mpas_analysis/test/test_mpas_config_parser/analysis.cfg deleted file mode 100644 index b6c999a33..000000000 --- a/mpas_analysis/test/test_mpas_config_parser/analysis.cfg +++ /dev/null @@ -1,47 +0,0 @@ -[sst_modelvsobs] -# colormap for model/observations -cmapModelObs = RdYlBu_r -# colormap for differences -cmapDiff = coolwarm - -# indices into cmapModelObs for contour color -cmapIndicesModelObs = [0, 40, 80, 110, 140, 170, 200, 230, 255] -# indices into cmapModelObs for contour color -cmapIndicesDiff = [0, 40, 80, 120, 140, 170, 210, 255] - -# colormap levels/values for contour boundaries -clevsModelObs = [-2, 0, 2, 6, 10, 16, 22, 26, 28, 32] -clevsDiff = [-5, -3, -2, -1, 0, 1, 2, 3, 5] - -# Times for comparison times (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec, JFM, AMJ, JAS, OND, ANN) -comparisonTimes = ['JFM', 'JAS', 'ANN'] - -[Test] - -testInt = 15 - -testFloat = 18.0 -testFloat2 = 3. - -testBool = True - -testList = [0.5, 0.1, 0.5] - -testTuple = (5, 0.1, 'string') - -testDict = {'key1': 'string', - 'key2': -12, - 'key3': False} - -[TestNumpy] -testNumpyarange0 = arange(0, 1, 10) -testNumpyarange1 = np.arange(0, 1, 10) -testNumpyarange2 = numpy.arange(0, 1, 10) -testNumpylinspace0 = linspace(0, 1, 10) -testNumpylinspace1 = np.linspace(0, 1, 10) -testNumpylinspace2 = numpy.linspace(0, 1, 10) -testNumpypi0 = pi -testNumpypi1 = np.pi -testNumpypi2 = numpy.pi -testNumpyPi = Pi -testBadStr = __bad_string__ From b374be0681ce7d062074a6cbc64c5a4ff874f534 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Fri, 15 Apr 2022 15:12:56 +0200 Subject: [PATCH 05/40] Update main method to use MpasConfigParser --- mpas_analysis/__main__.py | 84 ++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 45 deletions(-) diff --git a/mpas_analysis/__main__.py b/mpas_analysis/__main__.py index ab9aef2f0..4b1054b49 100755 --- a/mpas_analysis/__main__.py +++ b/mpas_analysis/__main__.py @@ -26,7 +26,6 @@ import argparse import traceback import sys -from importlib.resources import path import shutil import os from collections import OrderedDict @@ -34,13 +33,12 @@ import logging import xarray import time -import configparser from mache import discover_machine, MachineInfo -from mpas_analysis.shared.analysis_task import AnalysisFormatter +from mpas_tools.config import MpasConfigParser -from mpas_analysis.configuration import MpasAnalysisConfigParser +from mpas_analysis.shared.analysis_task import AnalysisFormatter from mpas_analysis.shared.io.utility import build_config_full_path, \ make_directories, copyfile @@ -693,10 +691,10 @@ def purge_output(config): shutil.rmtree(directory) -def symlink_main_run(config, defaultConfig): +def symlink_main_run(config): ''' Create symlinks to the climatology and time-series directories for the - main run that has aleady been computed so we don't have to recompute + main run that has already been computed so we don't have to recompute the analysis. ''' @@ -722,11 +720,9 @@ def link_dir(section, option): if not os.path.exists(mainConfigFile): raise OSError('A main config file {} was specified but the ' 'file does not exist'.format(mainConfigFile)) - mainConfigFiles = [mainConfigFile] - if defaultConfig is not None: - mainConfigFiles = [defaultConfig] + mainConfigFiles - mainConfig = MpasAnalysisConfigParser() - mainConfig.read(mainConfigFiles) + mainConfig = MpasConfigParser() + mainConfig.add_from_package('mpas_analysis', 'default.cfg') + mainConfig.add_user_config(mainConfigFile) for subdirectory in ['mpasClimatology', 'timeSeries', 'mapping', 'mask', 'profiles']: @@ -768,8 +764,8 @@ def main(): parser.add_argument("-p", "--purge", dest="purge", action='store_true', help="Purge the analysis by deleting the output" "directory before running") - parser.add_argument('config_files', metavar='CONFIG', - type=str, nargs='*', help='config file') + parser.add_argument("config_file", metavar="CONFIG", type=str, nargs='*', + help="config file") parser.add_argument("--plot_colormaps", dest="plot_colormaps", action='store_true', help="Make a plot displaying all available colormaps") @@ -789,16 +785,11 @@ def main(): parser.print_help() sys.exit(0) - for config_file in args.config_files: - if not os.path.exists(config_file): - raise OSError(f'Config file {config_file} not found.') - - shared_configs = list() + config = MpasConfigParser() # add default.cfg to cover default not included in the config files # provided on the command line - with path('mpas_analysis', 'default.cfg') as default_config: - shared_configs.append(str(default_config)) + config.add_from_package('mpas_analysis', 'default.cfg') # Add config options for E3SM supported machines from the mache package machine = args.machine @@ -811,12 +802,10 @@ def main(): if machine is not None: print(f'Detected E3SM supported machine: {machine}') - with path('mache.machines', f'{machine}.cfg') as machine_config: - shared_configs.append(str(machine_config)) + config.add_from_package('mache.machines', f'{machine}.cfg') try: - with path('mpas_analysis.configuration', f'{machine}.cfg') \ - as machine_config: - shared_configs.append(str(machine_config)) + config.add_from_package('mpas_analysis.configuration', + f'{machine}.cfg') except FileNotFoundError: # we don't have a config file for this machine, so we'll just # skip it. @@ -825,24 +814,29 @@ def main(): pass if args.polar_regions: - with path('mpas_analysis', 'polar_regions.cfg') as polar_config: - shared_configs.append(str(polar_config)) + config.add_from_package('mpas_analysis', 'polar_regions.cfg') - main_configs = shared_configs + args.config_files - print('Using the following config files:') - for config_file in main_configs: - if not os.path.exists(config_file): - raise OSError('Config file {config_file} not found.') - print(f' {config_file}') - - config = MpasAnalysisConfigParser( - interpolation=configparser.ExtendedInterpolation()) if machine is not None: # set the username so we can use it in the htmlSubdirectory machine_info = MachineInfo(machine=machine) - config.add_section('web_portal') config.set('web_portal', 'username', machine_info.username) - config.read(main_configs) + + shared_configs = config.list_files() + + if len(args.config_file) > 0: + if len(args.config_file) > 1: + raise ValueError('Only one user config file is supported') + + user_config = args.config_file[0] + print(user_config) + if not os.path.exists(user_config): + raise OSError(f'Config file {user_config} not found.') + + config.add_user_config(user_config) + + print('Using the following config files:') + for config_file in config.list_files(): + print(f' {config_file}') if args.list: # set this config option so we don't have issues @@ -864,11 +858,11 @@ def main(): if not os.path.exists(control_config_file): raise OSError('A control config file {} was specified but the ' 'file does not exist'.format(control_config_file)) - control_configs = shared_configs + [control_config_file] - control_config = MpasAnalysisConfigParser( - interpolation=configparser.ExtendedInterpolation()) - control_config.read(control_configs) + control_config = MpasConfigParser() + for config_file in shared_configs: + control_config.add_from_file(config_file) + control_config.add_user_config(control_config_file) # replace the log directory so log files get written to this run's # log directory, not the control run's @@ -887,7 +881,7 @@ def main(): purge_output(config) if config.has_option('runs', 'mainRunConfigFile'): - symlink_main_run(config, default_config) + symlink_main_run(config) if args.generate: update_generate(config, args.generate) @@ -915,7 +909,7 @@ def main(): html_base_directory = build_config_full_path(config, 'output', 'htmlSubdirectory') make_directories(html_base_directory) - for config_filename in args.config_files: + for config_filename in args.config_file: config_filename = os.path.abspath(config_filename) print(f'copying {config_filename} to HTML dir.') basename = os.path.basename(config_filename) @@ -937,7 +931,7 @@ def main(): print('Total run time: {}:{:02d}:{:05.2f}'.format(h, m, s)) if not args.setup_only: - generate_html(config, analyses, control_config, args.config_files) + generate_html(config, analyses, control_config, args.config_file) if __name__ == "__main__": From b5d4eb2b96bdf2e8ff3d2148d2212f81141d9343 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Fri, 15 Apr 2022 15:13:28 +0200 Subject: [PATCH 06/40] Update RefYerMpasClimatologyTask to use MpasConfigParser --- .../shared/climatology/ref_year_mpas_climatology_task.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/mpas_analysis/shared/climatology/ref_year_mpas_climatology_task.py b/mpas_analysis/shared/climatology/ref_year_mpas_climatology_task.py index 709bc96d5..caae55419 100644 --- a/mpas_analysis/shared/climatology/ref_year_mpas_climatology_task.py +++ b/mpas_analysis/shared/climatology/ref_year_mpas_climatology_task.py @@ -14,7 +14,7 @@ from six import StringIO -from mpas_analysis.configuration import MpasAnalysisConfigParser +from mpas_tools.config import MpasConfigParser from mpas_analysis.shared.climatology import MpasClimatologyTask from mpas_analysis.shared.timekeeping.utility import get_simulation_start_time @@ -63,12 +63,7 @@ def __init__(self, config, componentName, taskName=None): # {{{ # make a deep copy of the config so we can change the start and end # years and dates without causing trouble for other tasks - config_string = StringIO() - config.write(config_string) - # We must reset the buffer to make it ready for reading. - config_string.seek(0) - new_config = MpasAnalysisConfigParser() - new_config.read_file(config_string) + new_config = config.copy() # call the constructor from the base class (AnalysisTask) super(RefYearMpasClimatologyTask, self).__init__( From 2d5056f58a9801539473f7cad44d2871778c859d Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Fri, 15 Apr 2022 15:13:55 +0200 Subject: [PATCH 07/40] Update tests to use MpasConfigParser --- mpas_analysis/test/test_analysis_task.py | 7 ++++--- mpas_analysis/test/test_climatology.py | 12 ++++-------- mpas_analysis/test/test_generalized_reader.py | 7 ++++--- mpas_analysis/test/test_mpas_climatology_task.py | 7 ++++--- .../test/test_mpas_climatology_task/QU240.cfg | 1 + mpas_analysis/test/test_remap_obs_clim_subtask.py | 7 ++++--- .../test/test_remap_obs_clim_subtask/remap_obs.cfg | 1 + 7 files changed, 22 insertions(+), 20 deletions(-) diff --git a/mpas_analysis/test/test_analysis_task.py b/mpas_analysis/test/test_analysis_task.py index c521ac234..83142e8e0 100644 --- a/mpas_analysis/test/test_analysis_task.py +++ b/mpas_analysis/test/test_analysis_task.py @@ -18,9 +18,11 @@ unicode_literals import pytest + +from mpas_tools.config import MpasConfigParser + from mpas_analysis.test import TestCase from mpas_analysis.shared.analysis_task import AnalysisTask -from mpas_analysis.configuration import MpasAnalysisConfigParser class TestAnalysisTask(TestCase): @@ -28,8 +30,7 @@ class TestAnalysisTask(TestCase): def test_checkGenerate(self): def doTest(generate, expectedResults): - config = MpasAnalysisConfigParser() - config.add_section('output') + config = MpasConfigParser() config.set('output', 'generate', generate) for taskName in expectedResults: genericTask = AnalysisTask(config=config, diff --git a/mpas_analysis/test/test_climatology.py b/mpas_analysis/test/test_climatology.py index bcfa4d9f3..e7391d168 100644 --- a/mpas_analysis/test/test_climatology.py +++ b/mpas_analysis/test/test_climatology.py @@ -26,10 +26,11 @@ import xarray from pyremap import MpasMeshDescriptor, LatLonGridDescriptor +from mpas_tools.config import MpasConfigParser + from mpas_analysis.test import TestCase, loaddatadir from mpas_analysis.shared.generalized_reader.generalized_reader \ import open_multifile_dataset -from mpas_analysis.configuration import MpasAnalysisConfigParser from mpas_analysis.shared.climatology import \ get_comparison_descriptor, get_remapper, \ add_years_months_days_in_month, compute_climatology, \ @@ -49,26 +50,22 @@ def tearDown(self): shutil.rmtree(self.test_dir) def setup_config(self, maxChunkSize=10000): - config = MpasAnalysisConfigParser() + config = MpasConfigParser() - config.add_section('execute') config.set('execute', 'mapParallelExec', 'None') + config.set('execute', 'mapMpiTasks', '1') - config.add_section('diagnostics') config.set('diagnostics', 'base_path', self.test_dir) config.set('diagnostics', 'customDirectory', 'none') config.set('diagnostics', 'mappingSubdirectory', 'maps') - config.add_section('input') config.set('input', 'maxChunkSize', str(maxChunkSize)) config.set('input', 'mpasMeshName', 'QU240') - config.add_section('output') config.set('output', 'baseDirectory', self.test_dir) config.set('output', 'mappingSubdirectory', '.') config.set('output', 'mpasClimatologySubdirectory', 'clim/mpas') - config.add_section('climatology') config.set('climatology', 'startYear', '2') config.set('climatology', 'endYear', '2') config.set('climatology', 'comparisonLatResolution', '0.5') @@ -76,7 +73,6 @@ def setup_config(self, maxChunkSize=10000): config.set('climatology', 'mpasInterpolationMethod', 'bilinear') - config.add_section('oceanObservations') config.set('oceanObservations', 'interpolationMethod', 'bilinear') config.set('oceanObservations', 'climatologySubdirectory', 'clim/obs') config.set('oceanObservations', 'remappedClimSubdirectory', diff --git a/mpas_analysis/test/test_generalized_reader.py b/mpas_analysis/test/test_generalized_reader.py index 5fb20a995..ca8835301 100644 --- a/mpas_analysis/test/test_generalized_reader.py +++ b/mpas_analysis/test/test_generalized_reader.py @@ -20,18 +20,19 @@ import numpy import pytest + +from mpas_tools.config import MpasConfigParser + from mpas_analysis.test import TestCase, loaddatadir from mpas_analysis.shared.generalized_reader.generalized_reader \ import open_multifile_dataset -from mpas_analysis.configuration import MpasAnalysisConfigParser @pytest.mark.usefixtures("loaddatadir") class TestGeneralizedReader(TestCase): def setup_config(self, maxChunkSize=10000): - config = MpasAnalysisConfigParser() - config.add_section('input') + config = MpasConfigParser() config.set('input', 'maxChunkSize', str(maxChunkSize)) return config diff --git a/mpas_analysis/test/test_mpas_climatology_task.py b/mpas_analysis/test/test_mpas_climatology_task.py index 36c438b6c..703168ce2 100644 --- a/mpas_analysis/test/test_mpas_climatology_task.py +++ b/mpas_analysis/test/test_mpas_climatology_task.py @@ -22,8 +22,9 @@ import shutil import os +from mpas_tools.config import MpasConfigParser + from mpas_analysis.test import TestCase, loaddatadir -from mpas_analysis.configuration import MpasAnalysisConfigParser from mpas_analysis.shared.climatology import MpasClimatologyTask, \ RemapMpasClimatologySubtask from mpas_analysis.shared import AnalysisTask @@ -46,8 +47,8 @@ def tearDown(self): def setup_config(self): configPath = self.datadir.join('QU240.cfg') - config = MpasAnalysisConfigParser() - config.read(str(configPath)) + config = MpasConfigParser() + config.add_from_file(str(configPath)) config.set('input', 'baseDirectory', str(self.datadir)) config.set('output', 'baseDirectory', str(self.test_dir)) return config diff --git a/mpas_analysis/test/test_mpas_climatology_task/QU240.cfg b/mpas_analysis/test/test_mpas_climatology_task/QU240.cfg index 25dbeef8d..ae43c0a7c 100644 --- a/mpas_analysis/test/test_mpas_climatology_task/QU240.cfg +++ b/mpas_analysis/test/test_mpas_climatology_task/QU240.cfg @@ -5,6 +5,7 @@ mainRunName = runName parallelTaskCount = 1 ncclimoParallelMode = serial mapParallelExec = None +mapMpiTasks = 1 ncremapParallelExec = None [diagnostics] diff --git a/mpas_analysis/test/test_remap_obs_clim_subtask.py b/mpas_analysis/test/test_remap_obs_clim_subtask.py index e3e182e89..dede3ae77 100644 --- a/mpas_analysis/test/test_remap_obs_clim_subtask.py +++ b/mpas_analysis/test/test_remap_obs_clim_subtask.py @@ -24,8 +24,9 @@ import xarray from pyremap import LatLonGridDescriptor +from mpas_tools.config import MpasConfigParser + from mpas_analysis.test import TestCase, loaddatadir -from mpas_analysis.configuration import MpasAnalysisConfigParser from mpas_analysis.shared.climatology import RemapObservedClimatologySubtask from mpas_analysis.shared import AnalysisTask from mpas_analysis.shared.io.utility import build_config_full_path, \ @@ -107,8 +108,8 @@ def tearDown(self): def setup_config(self): configPath = self.datadir.join('remap_obs.cfg') - config = MpasAnalysisConfigParser() - config.read(str(configPath)) + config = MpasConfigParser() + config.add_from_file(str(configPath)) config.set('input', 'baseDirectory', str(self.datadir)) config.set('diagnostics', 'base_path', str(self.datadir)) config.set('oceanObservations', 'obsSubdirectory', '.') diff --git a/mpas_analysis/test/test_remap_obs_clim_subtask/remap_obs.cfg b/mpas_analysis/test/test_remap_obs_clim_subtask/remap_obs.cfg index ab39679e5..5e76b7577 100644 --- a/mpas_analysis/test/test_remap_obs_clim_subtask/remap_obs.cfg +++ b/mpas_analysis/test/test_remap_obs_clim_subtask/remap_obs.cfg @@ -1,5 +1,6 @@ [execute] mapParallelExec = None +mapMpiTasks = 1 ncremapParallelExec = None [diagnostics] From ec994d4eb499a555b2e772a8624fd38dd882005f Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Fri, 15 Apr 2022 15:20:48 +0200 Subject: [PATCH 08/40] Switch to MpasConfigParser in docstrings --- mpas_analysis/__main__.py | 10 ++++---- mpas_analysis/analysis_task_template.py | 6 ++--- .../ocean/climatology_map_antarctic_melt.py | 6 ++--- mpas_analysis/ocean/climatology_map_argo.py | 8 +++---- mpas_analysis/ocean/climatology_map_bgc.py | 4 ++-- mpas_analysis/ocean/climatology_map_eke.py | 4 ++-- mpas_analysis/ocean/climatology_map_mld.py | 4 ++-- .../ocean/climatology_map_mld_min_max.py | 4 ++-- .../ocean/climatology_map_ohc_anomaly.py | 4 ++-- .../ocean/climatology_map_schmidtko.py | 4 ++-- mpas_analysis/ocean/climatology_map_sose.py | 4 ++-- mpas_analysis/ocean/climatology_map_ssh.py | 4 ++-- mpas_analysis/ocean/climatology_map_sss.py | 4 ++-- mpas_analysis/ocean/climatology_map_sst.py | 4 ++-- mpas_analysis/ocean/climatology_map_woa.py | 4 ++-- .../ocean/compute_transects_subtask.py | 4 ++-- mpas_analysis/ocean/geojson_transects.py | 4 ++-- .../ocean/hovmoller_ocean_regions.py | 4 ++-- mpas_analysis/ocean/index_nino34.py | 6 ++--- .../ocean/meridional_heat_transport.py | 6 ++--- .../ocean/ocean_regional_profiles.py | 8 +++---- .../ocean/plot_climatology_map_subtask.py | 2 +- ...ot_depth_integrated_time_series_subtask.py | 4 ++-- mpas_analysis/ocean/plot_hovmoller_subtask.py | 4 ++-- mpas_analysis/ocean/plot_transect_subtask.py | 4 ++-- mpas_analysis/ocean/regional_ts_diagrams.py | 12 +++++----- mpas_analysis/ocean/sose_transects.py | 6 ++--- mpas_analysis/ocean/streamfunction_moc.py | 10 ++++---- .../ocean/time_series_antarctic_melt.py | 8 +++---- .../ocean/time_series_ocean_regions.py | 8 +++---- .../ocean/time_series_ohc_anomaly.py | 4 ++-- .../ocean/time_series_salinity_anomaly.py | 2 +- .../ocean/time_series_ssh_anomaly.py | 6 ++--- mpas_analysis/ocean/time_series_sst.py | 6 ++--- .../ocean/time_series_temperature_anomaly.py | 2 +- mpas_analysis/ocean/time_series_transport.py | 8 +++---- mpas_analysis/ocean/woce_transects.py | 4 ++-- .../sea_ice/climatology_map_berg_conc.py | 4 ++-- .../sea_ice/climatology_map_sea_ice_conc.py | 4 ++-- .../sea_ice/climatology_map_sea_ice_thick.py | 4 ++-- .../sea_ice/plot_climatology_map_subtask.py | 4 ++-- mpas_analysis/sea_ice/time_series.py | 6 ++--- mpas_analysis/shared/analysis_task.py | 4 ++-- .../shared/climatology/climatology.py | 12 +++++----- .../climatology/comparison_descriptors.py | 6 ++--- .../climatology/mpas_climatology_task.py | 2 +- .../ref_year_mpas_climatology_task.py | 2 +- .../generalized_reader/generalized_reader.py | 2 +- mpas_analysis/shared/html/image_xml.py | 2 +- mpas_analysis/shared/html/pages.py | 24 +++++++++---------- mpas_analysis/shared/io/utility.py | 6 ++--- mpas_analysis/shared/plot/climatology_map.py | 6 ++--- mpas_analysis/shared/plot/save.py | 2 +- .../shared/regions/compute_region_masks.py | 2 +- .../time_series/mpas_time_series_task.py | 2 +- 55 files changed, 145 insertions(+), 145 deletions(-) diff --git a/mpas_analysis/__main__.py b/mpas_analysis/__main__.py index 4b1054b49..c7ad1ac47 100755 --- a/mpas_analysis/__main__.py +++ b/mpas_analysis/__main__.py @@ -69,7 +69,7 @@ def update_time_bounds_in_config(config): # {{{ Parameters ---------- - config : ``MpasAnalysisConfigParser`` object + config : mpas_tools.config.MpasConfigParser contains config options """ @@ -88,10 +88,10 @@ def build_analysis_list(config, controlConfig): # {{{ Parameters ---------- - config : ``MpasAnalysisConfigParser`` object + config : mpas_tools.config.MpasConfigParser contains config options - controlConfig : ``MpasAnalysisConfigParser`` object + controlConfig : mpas_tools.config.MpasConfigParser contains config options for a control run, or ``None`` if no config file for a control run was specified @@ -418,7 +418,7 @@ def update_generate(config, generate): # {{{ Parameters ---------- - config : ``MpasAnalysisConfigParser`` object + config : mpas_tools.config.MpasConfigParser contains config options generate : str @@ -445,7 +445,7 @@ def run_analysis(config, analyses): # {{{ Parameters ---------- - config : ``MpasAnalysisConfigParser`` object + config : mpas_tools.config.MpasConfigParser contains config options analyses : OrderedDict of ``AnalysisTask`` objects diff --git a/mpas_analysis/analysis_task_template.py b/mpas_analysis/analysis_task_template.py index e4ff9dd2a..2ae0c4765 100644 --- a/mpas_analysis/analysis_task_template.py +++ b/mpas_analysis/analysis_task_template.py @@ -86,8 +86,8 @@ class MyTask(AnalysisTask): # {{{ # python class start with the argument self, which is not included in # the list of arguments when you call a method of an object (because it # is always included automatically). - # config is an MpasAnalysisConfigParser object that can be used to get - # configuration options stored in default.cfg or a custom config + # config is an mpas_tools.config.MpasConfigParser object that can be used + # to get configuration options stored in default.cfg or a custom config # file specific to a given simulation. See examples below or in # existing analysis tasks. # myArg should either be modified or removed. An example might be if you @@ -105,7 +105,7 @@ def __init__(self, config, prerequsiteTask, myArg='myDefaultValue'): # {{{ Parameters ---------- - config : instance of MpasAnalysisConfigParser + config : mpas_tools.config.MpasConfigParser Contains configuration options prerequsiteTask : ``AnotherTaskClass`` diff --git a/mpas_analysis/ocean/climatology_map_antarctic_melt.py b/mpas_analysis/ocean/climatology_map_antarctic_melt.py index dfa6d2e75..1a55647a9 100644 --- a/mpas_analysis/ocean/climatology_map_antarctic_melt.py +++ b/mpas_analysis/ocean/climatology_map_antarctic_melt.py @@ -52,7 +52,7 @@ def __init__(self, config, mpasClimatologyTask, regionMasksTask, Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options mpasClimatologyTask : ``MpasClimatologyTask`` @@ -61,7 +61,7 @@ def __init__(self, config, mpasClimatologyTask, regionMasksTask, regionMasksTask : ``ComputeRegionMasks`` A task for computing region masks - controlConfig : ``MpasAnalysisConfigParser`` + controlconfig : mpas_tools.config.MpasConfigParser Configuration options for a control run """ # Authors @@ -342,7 +342,7 @@ def __init__(self, parentTask, mpasClimatologyTask, controlConfig, mpasClimatologyTask : ``MpasClimatologyTask`` The task that produced the climatology to be remapped and plotted - controlConfig : ``MpasAnalysisConfigParser`` + controlconfig : mpas_tools.config.MpasConfigParser Configuration options for a control run (if any) regionMasksTask : ``ComputeRegionMasks`` diff --git a/mpas_analysis/ocean/climatology_map_argo.py b/mpas_analysis/ocean/climatology_map_argo.py index f68267d3c..c518cf3ab 100644 --- a/mpas_analysis/ocean/climatology_map_argo.py +++ b/mpas_analysis/ocean/climatology_map_argo.py @@ -49,13 +49,13 @@ def __init__(self, config, mpasClimatologyTask, Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options mpasClimatologyTask : ``MpasClimatologyTask`` The task that produced the climatology to be remapped and plotted - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors @@ -191,13 +191,13 @@ def __init__(self, config, mpasClimatologyTask, Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options mpasClimatologyTask : ``MpasClimatologyTask`` The task that produced the climatology to be remapped and plotted - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors diff --git a/mpas_analysis/ocean/climatology_map_bgc.py b/mpas_analysis/ocean/climatology_map_bgc.py index ce4841333..5f60a5315 100644 --- a/mpas_analysis/ocean/climatology_map_bgc.py +++ b/mpas_analysis/ocean/climatology_map_bgc.py @@ -41,13 +41,13 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): # {{{ Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options mpasClimatologyTask : ``MpasClimatologyTask`` The task that produced the climatology to be remapped and plotted - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) Authors diff --git a/mpas_analysis/ocean/climatology_map_eke.py b/mpas_analysis/ocean/climatology_map_eke.py index b4826c76b..fdfd44586 100644 --- a/mpas_analysis/ocean/climatology_map_eke.py +++ b/mpas_analysis/ocean/climatology_map_eke.py @@ -41,13 +41,13 @@ def __init__(self, config, mpasClimatologyTask, Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options mpasClimatologyTask : ``MpasClimatologyTask`` The task that produced the climatology to be remapped and plotted - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors diff --git a/mpas_analysis/ocean/climatology_map_mld.py b/mpas_analysis/ocean/climatology_map_mld.py index c1b7e89f3..626f4e48d 100644 --- a/mpas_analysis/ocean/climatology_map_mld.py +++ b/mpas_analysis/ocean/climatology_map_mld.py @@ -42,13 +42,13 @@ def __init__(self, config, mpasClimatologyTask, Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options mpasClimatologyTask : ``MpasClimatologyTask`` The task that produced the climatology to be remapped and plotted - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors diff --git a/mpas_analysis/ocean/climatology_map_mld_min_max.py b/mpas_analysis/ocean/climatology_map_mld_min_max.py index cc85ade86..6b1575c8d 100644 --- a/mpas_analysis/ocean/climatology_map_mld_min_max.py +++ b/mpas_analysis/ocean/climatology_map_mld_min_max.py @@ -35,14 +35,14 @@ def __init__(self, config, mpasClimatologyTasks, controlConfig=None): Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options mpasClimatologyTasks : dict of ``MpasClimatologyTask`` The tasks that produced the climatology of monthly min and max to be remapped and plotted - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors diff --git a/mpas_analysis/ocean/climatology_map_ohc_anomaly.py b/mpas_analysis/ocean/climatology_map_ohc_anomaly.py index f1d86cd1c..3f411a04c 100644 --- a/mpas_analysis/ocean/climatology_map_ohc_anomaly.py +++ b/mpas_analysis/ocean/climatology_map_ohc_anomaly.py @@ -49,7 +49,7 @@ def __init__(self, config, mpasClimatologyTask, refYearClimatolgyTask, Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options mpasClimatologyTask : ``MpasClimatologyTask`` @@ -59,7 +59,7 @@ def __init__(self, config, mpasClimatologyTask, refYearClimatolgyTask, The task that produced the climatology from the first year to be remapped and then subtracted from the main climatology - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors diff --git a/mpas_analysis/ocean/climatology_map_schmidtko.py b/mpas_analysis/ocean/climatology_map_schmidtko.py index a091f8a15..357410d7c 100644 --- a/mpas_analysis/ocean/climatology_map_schmidtko.py +++ b/mpas_analysis/ocean/climatology_map_schmidtko.py @@ -47,13 +47,13 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): # {{{ Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options mpasClimatologyTask : ``MpasClimatologyTask`` The task that produced the climatology to be remapped and plotted - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors diff --git a/mpas_analysis/ocean/climatology_map_sose.py b/mpas_analysis/ocean/climatology_map_sose.py index 73f22fa6c..9631cf677 100644 --- a/mpas_analysis/ocean/climatology_map_sose.py +++ b/mpas_analysis/ocean/climatology_map_sose.py @@ -47,13 +47,13 @@ def __init__(self, config, mpasClimatologyTask, Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options mpasClimatologyTask : ``MpasClimatologyTask`` The task that produced the climatology to be remapped and plotted - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors diff --git a/mpas_analysis/ocean/climatology_map_ssh.py b/mpas_analysis/ocean/climatology_map_ssh.py index 297ba2d7f..37d740278 100644 --- a/mpas_analysis/ocean/climatology_map_ssh.py +++ b/mpas_analysis/ocean/climatology_map_ssh.py @@ -43,13 +43,13 @@ def __init__(self, config, mpasClimatologyTask, Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options mpasClimatologyTask : ``MpasClimatologyTask`` The task that produced the climatology to be remapped and plotted - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors diff --git a/mpas_analysis/ocean/climatology_map_sss.py b/mpas_analysis/ocean/climatology_map_sss.py index 29aa9076f..6951549c5 100644 --- a/mpas_analysis/ocean/climatology_map_sss.py +++ b/mpas_analysis/ocean/climatology_map_sss.py @@ -42,13 +42,13 @@ def __init__(self, config, mpasClimatologyTask, Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options mpasClimatologyTask : ``MpasClimatologyTask`` The task that produced the climatology to be remapped and plotted - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors diff --git a/mpas_analysis/ocean/climatology_map_sst.py b/mpas_analysis/ocean/climatology_map_sst.py index 2f4e4793d..0bc19d5c2 100644 --- a/mpas_analysis/ocean/climatology_map_sst.py +++ b/mpas_analysis/ocean/climatology_map_sst.py @@ -43,13 +43,13 @@ def __init__(self, config, mpasClimatologyTask, Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options mpasClimatologyTask : ``MpasClimatologyTask`` The task that produced the climatology to be remapped and plotted - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors diff --git a/mpas_analysis/ocean/climatology_map_woa.py b/mpas_analysis/ocean/climatology_map_woa.py index 2bfbd4880..7ce2b06dd 100644 --- a/mpas_analysis/ocean/climatology_map_woa.py +++ b/mpas_analysis/ocean/climatology_map_woa.py @@ -48,13 +48,13 @@ def __init__(self, config, mpasClimatologyTask, Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options mpasClimatologyTask : ``MpasClimatologyTask`` The task that produced the climatology to be remapped and plotted - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors diff --git a/mpas_analysis/ocean/compute_transects_subtask.py b/mpas_analysis/ocean/compute_transects_subtask.py index 5b0c6fbab..6ba6c46d1 100644 --- a/mpas_analysis/ocean/compute_transects_subtask.py +++ b/mpas_analysis/ocean/compute_transects_subtask.py @@ -585,7 +585,7 @@ class TransectsObservations(object): # {{{ Attributes ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options obsFileNames : OrderedDict @@ -615,7 +615,7 @@ def __init__(self, config, obsFileNames, horizontalResolution, Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options obsFileNames : OrderedDict diff --git a/mpas_analysis/ocean/geojson_transects.py b/mpas_analysis/ocean/geojson_transects.py index 4ccbbeda9..253de6945 100644 --- a/mpas_analysis/ocean/geojson_transects.py +++ b/mpas_analysis/ocean/geojson_transects.py @@ -40,14 +40,14 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options mpasClimatologyTask : ``MpasClimatologyTask`` The task that produced the climatology to be remapped and plotted as a transect - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) ''' # Authors diff --git a/mpas_analysis/ocean/hovmoller_ocean_regions.py b/mpas_analysis/ocean/hovmoller_ocean_regions.py index 7b92d4d4d..2ac580ba3 100644 --- a/mpas_analysis/ocean/hovmoller_ocean_regions.py +++ b/mpas_analysis/ocean/hovmoller_ocean_regions.py @@ -48,7 +48,7 @@ def __init__(self, config, regionMasksTask, oceanRegionalProfilesTask, Parameters ---------- - config : instance of MpasAnalysisConfigParser + config : mpas_tools.config.MpasConfigParser Contains configuration options regionMasksTask : ``ComputeRegionMasks`` @@ -57,7 +57,7 @@ def __init__(self, config, regionMasksTask, oceanRegionalProfilesTask, oceanRegionalProfilesTask : mpas_analysis.ocean.OceanRegionalProfiles A task for computing ocean regional profiles - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors diff --git a/mpas_analysis/ocean/index_nino34.py b/mpas_analysis/ocean/index_nino34.py index f5d315b5d..8fde2a52d 100644 --- a/mpas_analysis/ocean/index_nino34.py +++ b/mpas_analysis/ocean/index_nino34.py @@ -52,7 +52,7 @@ class IndexNino34(AnalysisTask): # {{{ mpasTimeSeriesTask : ``MpasTimeSeriesTask`` The task that extracts the time series from MPAS monthly output - controlConfig : ``MpasAnalysisConfigParser`` + controlconfig : mpas_tools.config.MpasConfigParser Configuration options for a control run (if any) ''' # Authors @@ -66,13 +66,13 @@ def __init__(self, config, mpasTimeSeriesTask, controlConfig=None): Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options mpasTimeSeriesTask : ``MpasTimeSeriesTask`` The task that extracts the time series from MPAS monthly output - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) ''' # Authors diff --git a/mpas_analysis/ocean/meridional_heat_transport.py b/mpas_analysis/ocean/meridional_heat_transport.py index 9e5e6fec3..f924c0037 100644 --- a/mpas_analysis/ocean/meridional_heat_transport.py +++ b/mpas_analysis/ocean/meridional_heat_transport.py @@ -38,7 +38,7 @@ class MeridionalHeatTransport(AnalysisTask): # {{{ mpasClimatologyTask : ``MpasClimatologyTask`` The task that produced the climatology to be remapped and plotted - controlConfig : ``MpasAnalysisConfigParser`` + controlconfig : mpas_tools.config.MpasConfigParser Configuration options for a control run (if any) ''' # Authors @@ -51,13 +51,13 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): # {{{ Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options mpasClimatologyTask : ``MpasClimatologyTask`` The task that produced the climatology to be remapped and plotted - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) ''' # Authors diff --git a/mpas_analysis/ocean/ocean_regional_profiles.py b/mpas_analysis/ocean/ocean_regional_profiles.py index bd157cd6e..b73f75315 100644 --- a/mpas_analysis/ocean/ocean_regional_profiles.py +++ b/mpas_analysis/ocean/ocean_regional_profiles.py @@ -47,13 +47,13 @@ def __init__(self, config, regionMasksTask, controlConfig=None): # {{{ Parameters ---------- - config : instance of MpasAnalysisConfigParser + config : mpas_tools.config.MpasConfigParser Contains configuration options regionMasksTask : ``ComputeRegionMasks`` A task for computing region masks - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors @@ -603,7 +603,7 @@ class PlotRegionalProfileTimeSeriesSubtask(AnalysisTask): # {{{ field : dict Information about the field (e.g. temperature) being plotted - controlConfig : ``MpasAnalysisConfigParser`` + controlconfig : mpas_tools.config.MpasConfigParser Configuration options for a control run (if any) """ # Authors @@ -640,7 +640,7 @@ def __init__(self, parentTask, masksSubtask, season, regionName, field, startYear, endYear : int The beginning and end of the time series to compute - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors diff --git a/mpas_analysis/ocean/plot_climatology_map_subtask.py b/mpas_analysis/ocean/plot_climatology_map_subtask.py index 5840bfac8..502ac7975 100644 --- a/mpas_analysis/ocean/plot_climatology_map_subtask.py +++ b/mpas_analysis/ocean/plot_climatology_map_subtask.py @@ -144,7 +144,7 @@ def __init__(self, parentTask, season, comparisonGridName, A second subtask for remapping another MPAS climatology to plot in the second panel and compare with in the third panel - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) depth : {float, 'top', 'bot'}, optional diff --git a/mpas_analysis/ocean/plot_depth_integrated_time_series_subtask.py b/mpas_analysis/ocean/plot_depth_integrated_time_series_subtask.py index 6eecf9ad6..237943eda 100644 --- a/mpas_analysis/ocean/plot_depth_integrated_time_series_subtask.py +++ b/mpas_analysis/ocean/plot_depth_integrated_time_series_subtask.py @@ -85,7 +85,7 @@ class PlotDepthIntegratedTimeSeriesSubtask(AnalysisTask): galleryName : str The name of the gallery in which this plot belongs - controlConfig : ``MpasAnalysisConfigParser`` + controlConfig : mpas_tools.config.MpasConfigParser The configuration options for the control run (if any) """ # Authors @@ -151,7 +151,7 @@ def __init__(self, parentTask, regionName, inFileName, outFileLabel, subtaskName : str, optional The name of the subtask (``plotTimeSeries`` by default) - controlConfig : ``MpasAnalysisConfigParser``, optional + controlConfig : mpas_tools.config.MpasConfigParser, optional The configuration options for the control run (if any) """ # Authors diff --git a/mpas_analysis/ocean/plot_hovmoller_subtask.py b/mpas_analysis/ocean/plot_hovmoller_subtask.py index 3b7a038b5..f5cff4b58 100644 --- a/mpas_analysis/ocean/plot_hovmoller_subtask.py +++ b/mpas_analysis/ocean/plot_hovmoller_subtask.py @@ -37,7 +37,7 @@ class PlotHovmollerSubtask(AnalysisTask): Attributes ---------- - controlConfig : ``MpasAnalysisConfigParser`` + controlconfig : mpas_tools.config.MpasConfigParser Configuration options for a control run (if any) regionName : str @@ -151,7 +151,7 @@ def __init__(self, parentTask, regionName, inFileName, outFileLabel, subtaskName : str, optional The name of the subtask (``plotHovmoller`` by default) - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) regionMaskFile : str, optional diff --git a/mpas_analysis/ocean/plot_transect_subtask.py b/mpas_analysis/ocean/plot_transect_subtask.py index 61c6f8cfa..133f9e016 100644 --- a/mpas_analysis/ocean/plot_transect_subtask.py +++ b/mpas_analysis/ocean/plot_transect_subtask.py @@ -59,7 +59,7 @@ class PlotTransectSubtask(AnalysisTask): # {{{ plotObs : bool, optional Whether to plot against observations. - controlConfig : ``MpasAnalysisConfigParser`` + controlconfig : mpas_tools.config.MpasConfigParser Configuration options for a control run (if any), ignored if ``plotObs == True`` @@ -136,7 +136,7 @@ def __init__(self, parentTask, season, transectName, fieldName, plotObs : bool, optional Whether to plot against observations. - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any), ignored if ``plotObs == True`` diff --git a/mpas_analysis/ocean/regional_ts_diagrams.py b/mpas_analysis/ocean/regional_ts_diagrams.py index 2469499bd..bc5ed9b1c 100644 --- a/mpas_analysis/ocean/regional_ts_diagrams.py +++ b/mpas_analysis/ocean/regional_ts_diagrams.py @@ -71,7 +71,7 @@ def __init__(self, config, mpasClimatologyTask, regionMasksTask, Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options mpasClimatologyTask : ``MpasClimatologyTask`` @@ -80,7 +80,7 @@ def __init__(self, config, mpasClimatologyTask, regionMasksTask, regionMasksTask : ``ComputeRegionMasks`` A task for computing region masks - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors @@ -476,7 +476,7 @@ class ComputeRegionTSSubtask(AnalysisTask): sectionName : str The section of the config file to get options from - controlConfig : ``MpasAnalysisConfigParser`` + controlConfig : mpas_tools.config.MpasConfigParser The configuration options for the control run (if any) mpasClimatologyTask : ``MpasClimatologyTask`` @@ -515,7 +515,7 @@ def __init__(self, parentTask, regionGroup, regionName, controlConfig, regionName : str Name of the region to plot - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) sectionName : str @@ -808,7 +808,7 @@ class PlotRegionTSDiagramSubtask(AnalysisTask): sectionName : str The section of the config file to get options from - controlConfig : ``MpasAnalysisConfigParser`` + controlConfig : mpas_tools.config.MpasConfigParser The configuration options for the control run (if any) mpasClimatologyTask : ``MpasClimatologyTask`` @@ -847,7 +847,7 @@ def __init__(self, parentTask, regionGroup, regionName, controlConfig, regionName : str Name of the region to plot - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) sectionName : str diff --git a/mpas_analysis/ocean/sose_transects.py b/mpas_analysis/ocean/sose_transects.py index 31e7caf90..00ac07eb1 100644 --- a/mpas_analysis/ocean/sose_transects.py +++ b/mpas_analysis/ocean/sose_transects.py @@ -49,14 +49,14 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options mpasClimatologyTask : ``MpasClimatologyTask`` The task that produced the climatology to be remapped and plotted as a transect - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) ''' # Authors @@ -236,7 +236,7 @@ def __init__(self, config, horizontalResolution, Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options horizontalResolution : str diff --git a/mpas_analysis/ocean/streamfunction_moc.py b/mpas_analysis/ocean/streamfunction_moc.py index c192e484e..1b0aa3548 100644 --- a/mpas_analysis/ocean/streamfunction_moc.py +++ b/mpas_analysis/ocean/streamfunction_moc.py @@ -61,13 +61,13 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): # {{{ Parameters ---------- - config : instance of MpasAnalysisConfigParser + config : mpas_tools.config.MpasConfigParser Contains configuration options mpasClimatologyTask : ``MpasClimatologyTask`` The task that produced the climatology to be remapped and plotted - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors @@ -640,7 +640,7 @@ def __init__(self, parentTask, controlConfig): # {{{ parentTask : ``StreamfunctionMOC`` The main task of which this is a subtask - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors @@ -1262,7 +1262,7 @@ def __init__(self, parentTask, startYears, endYears): # {{{ parentTask : ``StreamfunctionMOC`` The main task of which this is a subtask - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors @@ -1336,7 +1336,7 @@ def __init__(self, parentTask, controlConfig): # {{{ parentTask : ``StreamfunctionMOC`` The main task of which this is a subtask - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors diff --git a/mpas_analysis/ocean/time_series_antarctic_melt.py b/mpas_analysis/ocean/time_series_antarctic_melt.py index 8b5b0e09f..b713fe17d 100644 --- a/mpas_analysis/ocean/time_series_antarctic_melt.py +++ b/mpas_analysis/ocean/time_series_antarctic_melt.py @@ -51,7 +51,7 @@ def __init__(self, config, mpasTimeSeriesTask, regionMasksTask, Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options mpasTimeSeriesTask : ``MpasTimeSeriesTask`` @@ -60,7 +60,7 @@ def __init__(self, config, mpasTimeSeriesTask, regionMasksTask, regionMasksTask : ``ComputeRegionMasks`` A task for computing region masks - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors @@ -450,7 +450,7 @@ class PlotMeltSubtask(AnalysisTask): regionIndex : int The index into the dimension ``nRegions`` of the ice shelf to plot - controlConfig : ``MpasAnalysisConfigParser`` + controlConfig : mpas_tools.config.MpasConfigParser The configuration options for the control run (if any) """ @@ -475,7 +475,7 @@ def __init__(self, parentTask, iceShelf, regionIndex, controlConfig): regionIndex : int The index into the dimension ``nRegions`` of the ice shelf to plot - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors diff --git a/mpas_analysis/ocean/time_series_ocean_regions.py b/mpas_analysis/ocean/time_series_ocean_regions.py index 69a07906b..b2ce00127 100644 --- a/mpas_analysis/ocean/time_series_ocean_regions.py +++ b/mpas_analysis/ocean/time_series_ocean_regions.py @@ -52,13 +52,13 @@ def __init__(self, config, regionMasksTask, controlConfig=None): Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options regionMasksTask : ``ComputeRegionMasks`` A task for computing region masks - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors @@ -1023,7 +1023,7 @@ class PlotRegionTimeSeriesSubtask(AnalysisTask): sectionName : str The section of the config file to get options from - controlConfig : ``MpasAnalysisConfigParser`` + controlConfig : mpas_tools.config.MpasConfigParser The configuration options for the control run (if any) """ @@ -1053,7 +1053,7 @@ def __init__(self, parentTask, regionGroup, regionName, regionIndex, regionIndex : int The index into the dimension ``nRegions`` of the region to plot - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) sectionName : str diff --git a/mpas_analysis/ocean/time_series_ohc_anomaly.py b/mpas_analysis/ocean/time_series_ohc_anomaly.py index cb38cd2fb..79c1546c1 100644 --- a/mpas_analysis/ocean/time_series_ohc_anomaly.py +++ b/mpas_analysis/ocean/time_series_ohc_anomaly.py @@ -45,13 +45,13 @@ def __init__(self, config, mpasTimeSeriesTask, controlConfig=None): Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options mpasTimeSeriesTask : ``MpasTimeSeriesTask`` The task that extracts the time series from MPAS monthly output - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors diff --git a/mpas_analysis/ocean/time_series_salinity_anomaly.py b/mpas_analysis/ocean/time_series_salinity_anomaly.py index 36fdb75ee..00c5ee156 100644 --- a/mpas_analysis/ocean/time_series_salinity_anomaly.py +++ b/mpas_analysis/ocean/time_series_salinity_anomaly.py @@ -35,7 +35,7 @@ def __init__(self, config, mpasTimeSeriesTask): # {{{ Parameters ---------- - config : instance of MpasAnalysisConfigParser + config : mpas_tools.config.MpasConfigParser Contains configuration options mpasTimeSeriesTask : ``MpasTimeSeriesTask`` diff --git a/mpas_analysis/ocean/time_series_ssh_anomaly.py b/mpas_analysis/ocean/time_series_ssh_anomaly.py index b76a30957..1c71b766c 100644 --- a/mpas_analysis/ocean/time_series_ssh_anomaly.py +++ b/mpas_analysis/ocean/time_series_ssh_anomaly.py @@ -36,7 +36,7 @@ class TimeSeriesSSHAnomaly(AnalysisTask): timeSeriesFileName : str The name of the file where the ssh anomaly is stored - controlConfig : mpas_analysis.configuration.MpasAnalysisConfigParser + controlConfig : mpas_tools.config.MpasConfigParser Configuration options for a control run (if one is provided) filePrefix : str @@ -53,13 +53,13 @@ def __init__(self, config, mpasTimeSeriesTask, controlConfig): Parameters ---------- - config : mpas_analysis.configuration.MpasAnalysisConfigParser + config : mpas_tools.config.MpasConfigParser Configuration options mpasTimeSeriesTask : mpas_analysis.shared.time_series.MpasTimeSeriesTask The task that extracts the time series from MPAS monthly output - controlConfig : mpas_analysis.configuration.MpasAnalysisConfigParser + controlConfig : mpas_tools.config.MpasConfigParser Configuration options for a control run (if any) """ # Authors diff --git a/mpas_analysis/ocean/time_series_sst.py b/mpas_analysis/ocean/time_series_sst.py index 56f29c80c..7c5f2835b 100644 --- a/mpas_analysis/ocean/time_series_sst.py +++ b/mpas_analysis/ocean/time_series_sst.py @@ -38,7 +38,7 @@ class TimeSeriesSST(AnalysisTask): mpasTimeSeriesTask : ``MpasTimeSeriesTask`` The task that extracts the time series from MPAS monthly output - controlConfig : ``MpasAnalysisConfigParser`` + controlconfig : mpas_tools.config.MpasConfigParser Configuration options for a control run (if any) """ # Authors @@ -52,13 +52,13 @@ def __init__(self, config, mpasTimeSeriesTask, controlConfig=None): Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options mpasTimeSeriesTask : ``MpasTimeSeriesTask`` The task that extracts the time series from MPAS monthly output - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors diff --git a/mpas_analysis/ocean/time_series_temperature_anomaly.py b/mpas_analysis/ocean/time_series_temperature_anomaly.py index 6d7febc42..52e2d836b 100644 --- a/mpas_analysis/ocean/time_series_temperature_anomaly.py +++ b/mpas_analysis/ocean/time_series_temperature_anomaly.py @@ -35,7 +35,7 @@ def __init__(self, config, mpasTimeSeriesTask): # {{{ Parameters ---------- - config : instance of MpasAnalysisConfigParser + config : mpas_tools.config.MpasConfigParser Contains configuration options mpasTimeSeriesTask : ``MpasTimeSeriesTask`` diff --git a/mpas_analysis/ocean/time_series_transport.py b/mpas_analysis/ocean/time_series_transport.py index 2935ee3cc..6d4973e5b 100644 --- a/mpas_analysis/ocean/time_series_transport.py +++ b/mpas_analysis/ocean/time_series_transport.py @@ -51,10 +51,10 @@ def __init__(self, config, controlConfig=None): Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors @@ -477,7 +477,7 @@ class PlotTransportSubtask(AnalysisTask): transectIndex : int The index into the dimension ``nTransects`` of the transect to plot - controlConfig : ``MpasAnalysisConfigParser`` + controlConfig : mpas_tools.config.MpasConfigParser The configuration options for the control run (if any) """ @@ -503,7 +503,7 @@ def __init__(self, parentTask, transect, transectIndex, controlConfig, transectIndex : int The index into the dimension ``nTransects`` of the transect to plot - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors diff --git a/mpas_analysis/ocean/woce_transects.py b/mpas_analysis/ocean/woce_transects.py index f19c7d4b3..573aeba2f 100644 --- a/mpas_analysis/ocean/woce_transects.py +++ b/mpas_analysis/ocean/woce_transects.py @@ -40,14 +40,14 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options mpasClimatologyTask : ``MpasClimatologyTask`` The task that produced the climatology to be remapped and plotted as a transect - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) ''' # Authors diff --git a/mpas_analysis/sea_ice/climatology_map_berg_conc.py b/mpas_analysis/sea_ice/climatology_map_berg_conc.py index 5604bec46..f0b960dba 100644 --- a/mpas_analysis/sea_ice/climatology_map_berg_conc.py +++ b/mpas_analysis/sea_ice/climatology_map_berg_conc.py @@ -39,7 +39,7 @@ def __init__(self, config, mpasClimatologyTask, hemisphere, Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options mpasClimatologyTask : ``MpasClimatologyTask`` @@ -48,7 +48,7 @@ def __init__(self, config, mpasClimatologyTask, hemisphere, hemisphere : {'NH', 'SH'} The hemisphere to plot - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors diff --git a/mpas_analysis/sea_ice/climatology_map_sea_ice_conc.py b/mpas_analysis/sea_ice/climatology_map_sea_ice_conc.py index ff156f45f..82389d12e 100644 --- a/mpas_analysis/sea_ice/climatology_map_sea_ice_conc.py +++ b/mpas_analysis/sea_ice/climatology_map_sea_ice_conc.py @@ -42,7 +42,7 @@ def __init__(self, config, mpasClimatologyTask, hemisphere, Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options mpasClimatologyTask : ``MpasClimatologyTask`` @@ -51,7 +51,7 @@ def __init__(self, config, mpasClimatologyTask, hemisphere, hemisphere : {'NH', 'SH'} The hemisphere to plot - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors diff --git a/mpas_analysis/sea_ice/climatology_map_sea_ice_thick.py b/mpas_analysis/sea_ice/climatology_map_sea_ice_thick.py index f1f0a6ed9..e0e14f127 100644 --- a/mpas_analysis/sea_ice/climatology_map_sea_ice_thick.py +++ b/mpas_analysis/sea_ice/climatology_map_sea_ice_thick.py @@ -42,7 +42,7 @@ def __init__(self, config, mpasClimatologyTask, hemisphere, Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options mpasClimatologyTask : ``MpasClimatologyTask`` @@ -51,7 +51,7 @@ def __init__(self, config, mpasClimatologyTask, hemisphere, hemisphere : {'NH', 'SH'} The hemisphere to plot - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors diff --git a/mpas_analysis/sea_ice/plot_climatology_map_subtask.py b/mpas_analysis/sea_ice/plot_climatology_map_subtask.py index 955286c4a..c13c63212 100644 --- a/mpas_analysis/sea_ice/plot_climatology_map_subtask.py +++ b/mpas_analysis/sea_ice/plot_climatology_map_subtask.py @@ -52,7 +52,7 @@ class PlotClimatologyMapSubtask(AnalysisTask): # {{{ The subtask for remapping the observational climatology that this subtask will plot - controlConfig : ``MpasAnalysisConfigParser`` + controlconfig : mpas_tools.config.MpasConfigParser Configuration options for a control run (if any) outFileLabel : str @@ -128,7 +128,7 @@ def __init__(self, parentTask, hemisphere, season, comparisonGridName, The subtask for remapping the observational climatology that this subtask will plot - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) subtaskSuffix : str, optional diff --git a/mpas_analysis/sea_ice/time_series.py b/mpas_analysis/sea_ice/time_series.py index 3bc881a38..ce901b2fd 100644 --- a/mpas_analysis/sea_ice/time_series.py +++ b/mpas_analysis/sea_ice/time_series.py @@ -43,7 +43,7 @@ class TimeSeriesSeaIce(AnalysisTask): mpasTimeSeriesTask : ``MpasTimeSeriesTask`` The task that extracts the time series from MPAS monthly output - controlConfig : ``MpasAnalysisConfigParser`` + controlconfig : mpas_tools.config.MpasConfigParser Configuration options for a control run (if any) """ @@ -58,13 +58,13 @@ def __init__(self, config, mpasTimeSeriesTask, Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options mpasTimeSeriesTask : ``MpasTimeSeriesTask`` The task that extracts the time series from MPAS monthly output - controlConfig : ``MpasAnalysisConfigParser``, optional + controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors diff --git a/mpas_analysis/shared/analysis_task.py b/mpas_analysis/shared/analysis_task.py index 031a61993..bd720d3d5 100644 --- a/mpas_analysis/shared/analysis_task.py +++ b/mpas_analysis/shared/analysis_task.py @@ -35,7 +35,7 @@ class AnalysisTask(Process): # {{{ Attributes ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Contains configuration options taskName : str @@ -112,7 +112,7 @@ def __init__(self, config, taskName, componentName, tags=[], Parameters ---------- - config : instance of MpasAnalysisConfigParser + config : mpas_tools.config.MpasConfigParser Contains configuration options taskName : str diff --git a/mpas_analysis/shared/climatology/climatology.py b/mpas_analysis/shared/climatology/climatology.py index 8770542d6..19f29fa35 100644 --- a/mpas_analysis/shared/climatology/climatology.py +++ b/mpas_analysis/shared/climatology/climatology.py @@ -49,7 +49,7 @@ def get_remapper(config, sourceDescriptor, comparisonDescriptor, Parameters ---------- - config : instance of ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Contains configuration options sourceDescriptor : ``MeshDescriptor`` subclass object @@ -320,7 +320,7 @@ def remap_and_write_climatology(config, climatologyDataSet, Parameters ---------- - config : instance of ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Contains configuration options climatologyDataSet : ``xarray.DataSet`` or ``xarray.DataArray`` object @@ -391,7 +391,7 @@ def get_unmasked_mpas_climatology_directory(config, op='avg'): # {{{ Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser configuration options op : {'avg', 'min', 'max'} @@ -420,7 +420,7 @@ def get_unmasked_mpas_climatology_file_name(config, season, componentName, Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser configuration options season : str @@ -472,7 +472,7 @@ def get_masked_mpas_climatology_file_name(config, season, componentName, Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options season : str @@ -539,7 +539,7 @@ def get_remapped_mpas_climatology_file_name(config, season, componentName, Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options season : str diff --git a/mpas_analysis/shared/climatology/comparison_descriptors.py b/mpas_analysis/shared/climatology/comparison_descriptors.py index 6ab30d4b2..91efd4feb 100644 --- a/mpas_analysis/shared/climatology/comparison_descriptors.py +++ b/mpas_analysis/shared/climatology/comparison_descriptors.py @@ -33,7 +33,7 @@ def get_comparison_descriptor(config, comparison_grid_name): Parameters ---------- - config : mpas_analysis.configuration.MpasAnalysisConfigParser + config : mpas_tools.config.MpasConfigParser Contains configuration options comparison_grid_name : {'latlon', 'antarctic', 'arctic', 'north_atlantic', @@ -70,7 +70,7 @@ def _get_lat_lon_comparison_descriptor(config): Parameters ---------- - config : mpas_analysis.configuration.MpasAnalysisConfigParser + config : mpas_tools.config.MpasConfigParser Contains configuration options Returns @@ -106,7 +106,7 @@ def _get_projection_comparison_descriptor(config, comparison_grid_name): Parameters ---------- - config : mpas_analysis.configuration.MpasAnalysisConfigParser + config : mpas_tools.config.MpasConfigParser Contains configuration options comparison_grid_name : str diff --git a/mpas_analysis/shared/climatology/mpas_climatology_task.py b/mpas_analysis/shared/climatology/mpas_climatology_task.py index 4529c2e95..36f1b173d 100644 --- a/mpas_analysis/shared/climatology/mpas_climatology_task.py +++ b/mpas_analysis/shared/climatology/mpas_climatology_task.py @@ -89,7 +89,7 @@ def __init__(self, config, componentName, taskName=None, op='avg'): # {{{ Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Contains configuration options componentName : {'ocean', 'seaIce'} diff --git a/mpas_analysis/shared/climatology/ref_year_mpas_climatology_task.py b/mpas_analysis/shared/climatology/ref_year_mpas_climatology_task.py index caae55419..d834e250d 100644 --- a/mpas_analysis/shared/climatology/ref_year_mpas_climatology_task.py +++ b/mpas_analysis/shared/climatology/ref_year_mpas_climatology_task.py @@ -42,7 +42,7 @@ def __init__(self, config, componentName, taskName=None): # {{{ Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Contains configuration options componentName : {'ocean', 'seaIce'} diff --git a/mpas_analysis/shared/generalized_reader/generalized_reader.py b/mpas_analysis/shared/generalized_reader/generalized_reader.py index 71e8474b3..1507d9cc7 100644 --- a/mpas_analysis/shared/generalized_reader/generalized_reader.py +++ b/mpas_analysis/shared/generalized_reader/generalized_reader.py @@ -54,7 +54,7 @@ def open_multifile_dataset(fileNames, calendar, config, calendar : {``'gregorian'``, ``'gregorian_noleap'``}, optional The name of one of the calendars supported by MPAS cores - config : instance of ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Contains configuration options simulationStartTime : string, optional diff --git a/mpas_analysis/shared/html/image_xml.py b/mpas_analysis/shared/html/image_xml.py index 89acc81e4..f0810f48c 100644 --- a/mpas_analysis/shared/html/image_xml.py +++ b/mpas_analysis/shared/html/image_xml.py @@ -34,7 +34,7 @@ def write_image_xml(config, filePrefix, componentName, componentSubdirectory, Parameters ---------- - config : ``MpasAnalysisConfigParser`` object + config : mpas_tools.config.MpasConfigParser contains config options filePrefix : str diff --git a/mpas_analysis/shared/html/pages.py b/mpas_analysis/shared/html/pages.py index caf46b641..0d0c52441 100644 --- a/mpas_analysis/shared/html/pages.py +++ b/mpas_analysis/shared/html/pages.py @@ -31,7 +31,7 @@ def generate_html(config, analyses, controlConfig, customConfigFiles): Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Config options analysis : ``OrderedDict`` of ``AnalysisTask`` objects @@ -40,7 +40,7 @@ def generate_html(config, analyses, controlConfig, customConfigFiles): the list of files to include on the webpage for the associated component. - controlConfig : ``MpasAnalysisConfigParser`` + controlConfig : mpas_tools.config.MpasConfigParser Config options for a control run customConfigFiles : list of str @@ -108,10 +108,10 @@ class MainPage(object): Attributes ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Config options - controlConfig : ``MpasAnalysisConfigParser`` + controlConfig : mpas_tools.config.MpasConfigParser Config options for a control run customConfigFiles : list of str @@ -135,10 +135,10 @@ def __init__(self, config, controlConfig, customConfigFiles): Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Config options - controlConfig : ``MpasAnalysisConfigParser`` + controlConfig : mpas_tools.config.MpasConfigParser Config options for a control run customConfigFiles : list of str @@ -318,10 +318,10 @@ class ComponentPage(object): Attributes ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Config options - controlConfig : ``MpasAnalysisConfigParser`` + controlConfig : mpas_tools.config.MpasConfigParser Config options for a control run name : str @@ -349,7 +349,7 @@ def __init__(self, config, name, subdirectory, controlConfig=None): Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Config options name : str @@ -360,7 +360,7 @@ def __init__(self, config, name, subdirectory, controlConfig=None): subdirecory : str The subdirectory for the component's webpage - controlConfig : ``MpasAnalysisConfigParser``, optional + controlConfig : mpas_tools.config.MpasConfigParser, optional Config options for a control run """ # Authors @@ -404,7 +404,7 @@ def add_image(xmlFileName, config, components, controlConfig=None): xmlFileName : str The full path to the XML file describing the image to be added - config : ``MpasAnalysisConfigParser`` object + config : mpas_tools.config.MpasConfigParser contains config options components : OrederdDict of dict @@ -413,7 +413,7 @@ def add_image(xmlFileName, config, components, controlConfig=None): be added. ``components`` should be viewed as an input and output parameter, since it is modified by this function. - controlConfig : ``MpasAnalysisConfigParser``, optional + controlConfig : mpas_tools.config.MpasConfigParser, optional Config options for a control run """ # Authors diff --git a/mpas_analysis/shared/io/utility.py b/mpas_analysis/shared/io/utility.py index 050a5823e..85870d075 100644 --- a/mpas_analysis/shared/io/utility.py +++ b/mpas_analysis/shared/io/utility.py @@ -115,7 +115,7 @@ def build_config_full_path(config, section, relativePathOption, Parameters ---------- - config : MpasAnalysisConfigParser object + config : mpas_tools.config.MpasConfigParser configuration from which to read the path section : str @@ -166,7 +166,7 @@ def get_region_mask(config, regionMaskFile): # {{{ Parameters ---------- - config : MpasAnalysisConfigParser object + config : mpas_tools.config.MpasConfigParser configuration from which to read the path regionMaskFile : str @@ -226,7 +226,7 @@ def build_obs_path(config, component, relativePathOption=None, Parameters ---------- - config : MpasAnalysisConfigParser object + config : mpas_tools.config.MpasConfigParser configuration from which to read the path component : {'ocean', 'seaIce', 'iceberg'} diff --git a/mpas_analysis/shared/plot/climatology_map.py b/mpas_analysis/shared/plot/climatology_map.py index 287b99001..1db678d28 100644 --- a/mpas_analysis/shared/plot/climatology_map.py +++ b/mpas_analysis/shared/plot/climatology_map.py @@ -63,7 +63,7 @@ def plot_polar_comparison( Parameters ---------- - config : mpas_analysis.configuration.MpasAnalysisConfigParser + config : mpas_tools.config.MpasConfigParser the configuration, containing a [plot] section with options that control plotting @@ -274,7 +274,7 @@ def plot_global_comparison( Parameters ---------- - config : mpas_analysis.configuration.MpasAnalysisConfigParser + config : mpas_tools.config.MpasConfigParser the configuration, containing a [plot] section with options that control plotting @@ -460,7 +460,7 @@ def plot_projection_comparison( Parameters ---------- - config : mpas_analysis.configuration.MpasAnalysisConfigParser + config : mpas_tools.config.MpasConfigParser the configuration, containing a [plot] section with options that control plotting diff --git a/mpas_analysis/shared/plot/save.py b/mpas_analysis/shared/plot/save.py index 413ab10c3..bc6ac00c7 100644 --- a/mpas_analysis/shared/plot/save.py +++ b/mpas_analysis/shared/plot/save.py @@ -26,7 +26,7 @@ def savefig(filename, config, tight=True, pad_inches=0.1): filename : str the file name to be written - config : mpas_analysis.configuration.MpasAnalysisConfigParser + config : mpas_tools.config.MpasConfigParser Configuration options tight : bool, optional diff --git a/mpas_analysis/shared/regions/compute_region_masks.py b/mpas_analysis/shared/regions/compute_region_masks.py index dd7673ebc..b958292d5 100644 --- a/mpas_analysis/shared/regions/compute_region_masks.py +++ b/mpas_analysis/shared/regions/compute_region_masks.py @@ -31,7 +31,7 @@ def __init__(self, config, conponentName): Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Configuration options conponentName : str diff --git a/mpas_analysis/shared/time_series/mpas_time_series_task.py b/mpas_analysis/shared/time_series/mpas_time_series_task.py index 307a45fad..9867a25af 100644 --- a/mpas_analysis/shared/time_series/mpas_time_series_task.py +++ b/mpas_analysis/shared/time_series/mpas_time_series_task.py @@ -61,7 +61,7 @@ def __init__(self, config, componentName, taskName=None, Parameters ---------- - config : ``MpasAnalysisConfigParser`` + config : mpas_tools.config.MpasConfigParser Contains configuration options componentName : {'ocean', 'seaIce'} From 3578d8aed82fefa1d762f7d5d8ff112af4118315 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Fri, 15 Apr 2022 15:25:18 +0200 Subject: [PATCH 09/40] Update to mpas_tools>=0.14.0 --- ci/recipe/meta.yaml | 2 +- dev-spec.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/recipe/meta.yaml b/ci/recipe/meta.yaml index 9320bbed4..676863695 100644 --- a/ci/recipe/meta.yaml +++ b/ci/recipe/meta.yaml @@ -32,7 +32,7 @@ requirements: - lxml - mache >=1.1.2 - matplotlib-base >=3.0.2 - - mpas_tools >=0.5.1 + - mpas_tools >=0.14.0 - nco >=4.8.1 - netcdf4 - numpy diff --git a/dev-spec.txt b/dev-spec.txt index 953855b5f..c940e7a35 100644 --- a/dev-spec.txt +++ b/dev-spec.txt @@ -13,7 +13,7 @@ gsw lxml mache >=1.1.2 matplotlib-base>=3.0.2 -mpas_tools>=0.5.1 +mpas_tools>=0.14.0 nco>=4.8.1 netcdf4 numpy From c87fd21f35c28c49c6449e757f372ed7761ca642 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Fri, 15 Apr 2022 16:05:42 +0200 Subject: [PATCH 10/40] remote getWithDefault, update getexpression --- mpas_analysis/__main__.py | 3 +-- mpas_analysis/analysis_task_template.py | 2 +- .../ocean/climatology_map_antarctic_melt.py | 6 ++--- mpas_analysis/ocean/climatology_map_argo.py | 12 +++++----- mpas_analysis/ocean/climatology_map_bgc.py | 6 ++--- mpas_analysis/ocean/climatology_map_eke.py | 4 ++-- mpas_analysis/ocean/climatology_map_mld.py | 4 ++-- .../ocean/climatology_map_mld_min_max.py | 4 ++-- .../ocean/climatology_map_ohc_anomaly.py | 8 +++---- .../ocean/climatology_map_schmidtko.py | 4 ++-- mpas_analysis/ocean/climatology_map_sose.py | 8 +++---- mpas_analysis/ocean/climatology_map_ssh.py | 4 ++-- mpas_analysis/ocean/climatology_map_sss.py | 4 ++-- mpas_analysis/ocean/climatology_map_sst.py | 4 ++-- mpas_analysis/ocean/climatology_map_woa.py | 8 +++---- mpas_analysis/ocean/geojson_transects.py | 12 +++++----- .../ocean/hovmoller_ocean_regions.py | 6 ++--- mpas_analysis/ocean/index_nino34.py | 2 +- .../ocean/meridional_heat_transport.py | 4 ++-- .../ocean/ocean_regional_profiles.py | 10 ++++----- ...ot_depth_integrated_time_series_subtask.py | 6 ++--- mpas_analysis/ocean/plot_hovmoller_subtask.py | 14 ++++++------ mpas_analysis/ocean/regional_ts_diagrams.py | 22 +++++++++---------- mpas_analysis/ocean/sose_transects.py | 18 +++++++-------- mpas_analysis/ocean/streamfunction_moc.py | 18 +++++++-------- .../ocean/time_series_antarctic_melt.py | 2 +- .../ocean/time_series_ocean_regions.py | 10 ++++----- .../ocean/time_series_ohc_anomaly.py | 4 ++-- .../ocean/time_series_salinity_anomaly.py | 2 +- mpas_analysis/ocean/time_series_sst.py | 8 +++---- .../ocean/time_series_temperature_anomaly.py | 2 +- mpas_analysis/ocean/time_series_transport.py | 2 +- mpas_analysis/ocean/woce_transects.py | 10 ++++----- .../sea_ice/climatology_map_berg_conc.py | 4 ++-- .../sea_ice/climatology_map_sea_ice_conc.py | 6 ++--- .../sea_ice/climatology_map_sea_ice_thick.py | 4 ++-- .../sea_ice/plot_climatology_map_subtask.py | 2 +- mpas_analysis/shared/analysis_task.py | 2 +- .../shared/climatology/climatology.py | 2 +- .../climatology/comparison_descriptors.py | 6 ++--- mpas_analysis/shared/constants/constants.py | 2 -- mpas_analysis/shared/plot/climatology_map.py | 10 ++++----- mpas_analysis/shared/plot/colormap.py | 22 +++++++++---------- .../shared/regions/compute_region_masks.py | 4 +--- .../compute_transect_masks_subtask.py | 4 ++-- 45 files changed, 146 insertions(+), 155 deletions(-) diff --git a/mpas_analysis/__main__.py b/mpas_analysis/__main__.py index c7ad1ac47..5d9c44d36 100755 --- a/mpas_analysis/__main__.py +++ b/mpas_analysis/__main__.py @@ -472,8 +472,7 @@ def run_analysis(config, analyses): # {{{ config.write(configFile) configFile.close() - parallelTaskCount = config.getWithDefault('execute', 'parallelTaskCount', - default=1) + parallelTaskCount = config.getint('execute', 'parallelTaskCount') isParallel = parallelTaskCount > 1 and len(analyses) > 1 diff --git a/mpas_analysis/analysis_task_template.py b/mpas_analysis/analysis_task_template.py index 2ae0c4765..c025808ba 100644 --- a/mpas_analysis/analysis_task_template.py +++ b/mpas_analysis/analysis_task_template.py @@ -300,7 +300,7 @@ def setup_and_check(self): # {{{ # plotParameters is a list of parameters, a stand-ins for whatever # you might want to include in each plot name, for example, seasons or # types of observation. - self.plotParameters = self.config.getExpression(self.taskName, + self.plotParameters = self.config.getexpression(self.taskName, 'plotParameters') mainRunName = self.config.get('runs', 'mainRunName') diff --git a/mpas_analysis/ocean/climatology_map_antarctic_melt.py b/mpas_analysis/ocean/climatology_map_antarctic_melt.py index 1a55647a9..bf89ef932 100644 --- a/mpas_analysis/ocean/climatology_map_antarctic_melt.py +++ b/mpas_analysis/ocean/climatology_map_antarctic_melt.py @@ -82,13 +82,13 @@ def __init__(self, config, mpasClimatologyTask, regionMasksTask, iselValues = None # read in what seasons we want to plot - seasons = config.getExpression(sectionName, 'seasons') + seasons = config.getexpression(sectionName, 'seasons') if len(seasons) == 0: raise ValueError('config section {} does not contain valid list ' 'of seasons'.format(sectionName)) - comparisonGridNames = config.getExpression(sectionName, + comparisonGridNames = config.getexpression(sectionName, 'comparisonGrids') makeTables = config.getboolean(sectionName, 'makeTables') @@ -395,7 +395,7 @@ def run_task(self): # {{{ config = self.config sectionName = self.taskName - iceShelvesInTable = config.getExpression(sectionName, + iceShelvesInTable = config.getexpression(sectionName, 'iceShelvesInTable') if len(iceShelvesInTable) == 0: return diff --git a/mpas_analysis/ocean/climatology_map_argo.py b/mpas_analysis/ocean/climatology_map_argo.py index c518cf3ab..80df326c9 100644 --- a/mpas_analysis/ocean/climatology_map_argo.py +++ b/mpas_analysis/ocean/climatology_map_argo.py @@ -76,20 +76,20 @@ def __init__(self, config, mpasClimatologyTask, iselValues = None # read in what seasons we want to plot - seasons = config.getExpression(sectionName, 'seasons') + seasons = config.getexpression(sectionName, 'seasons') if len(seasons) == 0: raise ValueError('config section {} does not contain valid list ' 'of seasons'.format(sectionName)) - comparisonGridNames = config.getExpression(sectionName, + comparisonGridNames = config.getexpression(sectionName, 'comparisonGrids') if len(comparisonGridNames) == 0: raise ValueError('config section {} does not contain valid list ' 'of comparison grids'.format(sectionName)) - depths = config.getExpression(sectionName, 'depths') + depths = config.getexpression(sectionName, 'depths') if len(depths) == 0: raise ValueError('config section {} does not contain valid ' @@ -217,20 +217,20 @@ def __init__(self, config, mpasClimatologyTask, iselValues = None # read in what seasons we want to plot - seasons = config.getExpression(sectionName, 'seasons') + seasons = config.getexpression(sectionName, 'seasons') if len(seasons) == 0: raise ValueError('config section {} does not contain valid list ' 'of seasons'.format(sectionName)) - comparisonGridNames = config.getExpression(sectionName, + comparisonGridNames = config.getexpression(sectionName, 'comparisonGrids') if len(comparisonGridNames) == 0: raise ValueError('config section {} does not contain valid list ' 'of comparison grids'.format(sectionName)) - depths = config.getExpression(sectionName, 'depths') + depths = config.getexpression(sectionName, 'depths') if len(depths) == 0: raise ValueError('config section {} does not contain valid ' diff --git a/mpas_analysis/ocean/climatology_map_bgc.py b/mpas_analysis/ocean/climatology_map_bgc.py index 5f60a5315..7b8cf93c3 100644 --- a/mpas_analysis/ocean/climatology_map_bgc.py +++ b/mpas_analysis/ocean/climatology_map_bgc.py @@ -56,7 +56,7 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): # {{{ """ # call the constructor from the base class (AnalysisTask) - bgcVars = config.getExpression('climatologyMapBGC', 'variables') + bgcVars = config.getexpression('climatologyMapBGC', 'variables') super(ClimatologyMapBGC, self).__init__( config=config, taskName='climatologyMapBGC', @@ -66,13 +66,13 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): # {{{ sectionName = 'climatologyMapBGC' # read in what seasons we want to plot - seasons = config.getExpression(sectionName, 'seasons') + seasons = config.getexpression(sectionName, 'seasons') if len(seasons) == 0: raise ValueError('config section {} does not contain valid list ' 'of seasons'.format(sectionName)) - comparisonGridNames = config.getExpression(sectionName, + comparisonGridNames = config.getexpression(sectionName, 'comparisonGrids') if len(comparisonGridNames) == 0: diff --git a/mpas_analysis/ocean/climatology_map_eke.py b/mpas_analysis/ocean/climatology_map_eke.py index fdfd44586..77580e79c 100644 --- a/mpas_analysis/ocean/climatology_map_eke.py +++ b/mpas_analysis/ocean/climatology_map_eke.py @@ -67,7 +67,7 @@ def __init__(self, config, mpasClimatologyTask, sectionName = self.taskName # read in what seasons we want to plot - seasons = config.getExpression(sectionName, 'seasons') + seasons = config.getexpression(sectionName, 'seasons') # EKE observations are annual climatology so only accept annual # climatology **should move this to setup_and_check() @@ -76,7 +76,7 @@ def __init__(self, config, mpasClimatologyTask, 'of seasons. For EKE, may only request annual ' 'climatology'.format(sectionName)) - comparisonGridNames = config.getExpression(sectionName, + comparisonGridNames = config.getexpression(sectionName, 'comparisonGrids') if len(comparisonGridNames) == 0: diff --git a/mpas_analysis/ocean/climatology_map_mld.py b/mpas_analysis/ocean/climatology_map_mld.py index 626f4e48d..2b7c03276 100644 --- a/mpas_analysis/ocean/climatology_map_mld.py +++ b/mpas_analysis/ocean/climatology_map_mld.py @@ -68,13 +68,13 @@ def __init__(self, config, mpasClimatologyTask, iselValues = None # read in what seasons we want to plot - seasons = config.getExpression(sectionName, 'seasons') + seasons = config.getexpression(sectionName, 'seasons') if len(seasons) == 0: raise ValueError('config section {} does not contain valid list ' 'of seasons'.format(sectionName)) - comparisonGridNames = config.getExpression(sectionName, + comparisonGridNames = config.getexpression(sectionName, 'comparisonGrids') if len(comparisonGridNames) == 0: diff --git a/mpas_analysis/ocean/climatology_map_mld_min_max.py b/mpas_analysis/ocean/climatology_map_mld_min_max.py index 6b1575c8d..a28ba461e 100644 --- a/mpas_analysis/ocean/climatology_map_mld_min_max.py +++ b/mpas_analysis/ocean/climatology_map_mld_min_max.py @@ -110,13 +110,13 @@ def _add_tasks(self, config, mpasClimatologyTasks, controlConfig, iselValues = None # read in what seasons we want to plot - seasons = config.getExpression(self.taskName, 'seasons') + seasons = config.getexpression(self.taskName, 'seasons') if len(seasons) == 0: raise ValueError('config section {} does not contain valid list ' 'of seasons'.format(self.taskName)) - comparisonGridNames = config.getExpression(self.taskName, + comparisonGridNames = config.getexpression(self.taskName, 'comparisonGrids') if len(comparisonGridNames) == 0: diff --git a/mpas_analysis/ocean/climatology_map_ohc_anomaly.py b/mpas_analysis/ocean/climatology_map_ohc_anomaly.py index 3f411a04c..29337a895 100644 --- a/mpas_analysis/ocean/climatology_map_ohc_anomaly.py +++ b/mpas_analysis/ocean/climatology_map_ohc_anomaly.py @@ -79,13 +79,13 @@ def __init__(self, config, mpasClimatologyTask, refYearClimatolgyTask, mpasFieldName = 'deltaOHC' # read in what seasons we want to plot - seasons = config.getExpression(sectionName, 'seasons') + seasons = config.getexpression(sectionName, 'seasons') if len(seasons) == 0: raise ValueError('config section {} does not contain valid list ' 'of seasons'.format(sectionName)) - comparisonGridNames = config.getExpression(sectionName, + comparisonGridNames = config.getexpression(sectionName, 'comparisonGrids') if len(comparisonGridNames) == 0: @@ -95,9 +95,9 @@ def __init__(self, config, mpasClimatologyTask, refYearClimatolgyTask, variableList = ['timeMonthly_avg_activeTracers_temperature', 'timeMonthly_avg_layerThickness'] - depthRanges = config.getExpression('climatologyMapOHCAnomaly', + depthRanges = config.getexpression('climatologyMapOHCAnomaly', 'depthRanges', - usenumpyfunc=True) + use_numpyfunc=True) self.mpasClimatologyTask = mpasClimatologyTask self.refYearClimatolgyTask = refYearClimatolgyTask diff --git a/mpas_analysis/ocean/climatology_map_schmidtko.py b/mpas_analysis/ocean/climatology_map_schmidtko.py index 357410d7c..e669130f7 100644 --- a/mpas_analysis/ocean/climatology_map_schmidtko.py +++ b/mpas_analysis/ocean/climatology_map_schmidtko.py @@ -88,13 +88,13 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): # {{{ sectionName = self.taskName # read in what seasons we want to plot - seasons = config.getExpression(sectionName, 'seasons') + seasons = config.getexpression(sectionName, 'seasons') if len(seasons) == 0: raise ValueError('config section {} does not contain valid list ' 'of seasons'.format(sectionName)) - comparisonGridNames = config.getExpression(sectionName, + comparisonGridNames = config.getexpression(sectionName, 'comparisonGrids') if len(comparisonGridNames) == 0: diff --git a/mpas_analysis/ocean/climatology_map_sose.py b/mpas_analysis/ocean/climatology_map_sose.py index 9631cf677..8452dc33c 100644 --- a/mpas_analysis/ocean/climatology_map_sose.py +++ b/mpas_analysis/ocean/climatology_map_sose.py @@ -133,17 +133,17 @@ def __init__(self, config, mpasClimatologyTask, if fileSuffix.endswith('.nc'): fileSuffix = fileSuffix.strip('.nc') - fieldList = config.getExpression(sectionName, 'fieldList') + fieldList = config.getexpression(sectionName, 'fieldList') fields = [field for field in fields if field['prefix'] in fieldList] # read in what seasons we want to plot - seasons = config.getExpression(sectionName, 'seasons') + seasons = config.getexpression(sectionName, 'seasons') if len(seasons) == 0: raise ValueError('config section {} does not contain valid ' 'list of seasons'.format(sectionName)) - comparisonGridNames = config.getExpression(sectionName, + comparisonGridNames = config.getexpression(sectionName, 'comparisonGrids') if len(comparisonGridNames) == 0: @@ -154,7 +154,7 @@ def __init__(self, config, mpasClimatologyTask, if not numpy.any([field['3D'] for field in fields]): depths = None else: - depths = config.getExpression(sectionName, 'depths') + depths = config.getexpression(sectionName, 'depths') if len(depths) == 0: raise ValueError('config section {} does not contain valid ' diff --git a/mpas_analysis/ocean/climatology_map_ssh.py b/mpas_analysis/ocean/climatology_map_ssh.py index 37d740278..f99526856 100644 --- a/mpas_analysis/ocean/climatology_map_ssh.py +++ b/mpas_analysis/ocean/climatology_map_ssh.py @@ -70,13 +70,13 @@ def __init__(self, config, mpasClimatologyTask, sectionName = self.taskName # read in what seasons we want to plot - seasons = config.getExpression(sectionName, 'seasons') + seasons = config.getexpression(sectionName, 'seasons') if len(seasons) == 0: raise ValueError('config section {} does not contain valid list ' 'of seasons'.format(sectionName)) - comparisonGridNames = config.getExpression(sectionName, + comparisonGridNames = config.getexpression(sectionName, 'comparisonGrids') if len(comparisonGridNames) == 0: diff --git a/mpas_analysis/ocean/climatology_map_sss.py b/mpas_analysis/ocean/climatology_map_sss.py index 6951549c5..165c9b52c 100644 --- a/mpas_analysis/ocean/climatology_map_sss.py +++ b/mpas_analysis/ocean/climatology_map_sss.py @@ -68,13 +68,13 @@ def __init__(self, config, mpasClimatologyTask, sectionName = self.taskName # read in what seasons we want to plot - seasons = config.getExpression(sectionName, 'seasons') + seasons = config.getexpression(sectionName, 'seasons') if len(seasons) == 0: raise ValueError('config section {} does not contain valid list ' 'of seasons'.format(sectionName)) - comparisonGridNames = config.getExpression(sectionName, + comparisonGridNames = config.getexpression(sectionName, 'comparisonGrids') if len(comparisonGridNames) == 0: diff --git a/mpas_analysis/ocean/climatology_map_sst.py b/mpas_analysis/ocean/climatology_map_sst.py index 0bc19d5c2..ee92fc785 100644 --- a/mpas_analysis/ocean/climatology_map_sst.py +++ b/mpas_analysis/ocean/climatology_map_sst.py @@ -72,13 +72,13 @@ def __init__(self, config, mpasClimatologyTask, climEndYear = config.getint(sectionName, 'obsEndYear') # read in what seasons we want to plot - seasons = config.getExpression(sectionName, 'seasons') + seasons = config.getexpression(sectionName, 'seasons') if len(seasons) == 0: raise ValueError('config section {} does not contain valid list ' 'of seasons'.format(sectionName)) - comparisonGridNames = config.getExpression(sectionName, + comparisonGridNames = config.getexpression(sectionName, 'comparisonGrids') if len(comparisonGridNames) == 0: diff --git a/mpas_analysis/ocean/climatology_map_woa.py b/mpas_analysis/ocean/climatology_map_woa.py index 7ce2b06dd..37bffd914 100644 --- a/mpas_analysis/ocean/climatology_map_woa.py +++ b/mpas_analysis/ocean/climatology_map_woa.py @@ -84,24 +84,24 @@ def __init__(self, config, mpasClimatologyTask, sectionName = self.taskName - fieldList = config.getExpression(sectionName, 'fieldList') + fieldList = config.getexpression(sectionName, 'fieldList') fields = [field for field in fields if field['prefix'] in fieldList] # read in what seasons we want to plot - seasons = config.getExpression(sectionName, 'seasons') + seasons = config.getexpression(sectionName, 'seasons') if len(seasons) == 0: raise ValueError('config section {} does not contain valid list ' 'of seasons'.format(sectionName)) - comparisonGridNames = config.getExpression(sectionName, + comparisonGridNames = config.getexpression(sectionName, 'comparisonGrids') if len(comparisonGridNames) == 0: raise ValueError('config section {} does not contain valid list ' 'of comparison grids'.format(sectionName)) - depths = config.getExpression(sectionName, 'depths') + depths = config.getexpression(sectionName, 'depths') if len(depths) == 0: raise ValueError('config section {} does not contain valid ' diff --git a/mpas_analysis/ocean/geojson_transects.py b/mpas_analysis/ocean/geojson_transects.py index 253de6945..ccf3af2dd 100644 --- a/mpas_analysis/ocean/geojson_transects.py +++ b/mpas_analysis/ocean/geojson_transects.py @@ -64,11 +64,11 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): sectionName = self.taskName - geojsonFiles = config.getExpression(sectionName, 'geojsonFiles') + geojsonFiles = config.getexpression(sectionName, 'geojsonFiles') if len(geojsonFiles) == 0: return - seasons = config.getExpression(sectionName, 'seasons') + seasons = config.getexpression(sectionName, 'seasons') horizontalResolution = config.get(sectionName, 'horizontalResolution') @@ -78,12 +78,12 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): if verticalComparisonGridName in ['mpas', 'obs']: verticalComparisonGrid = None else: - verticalComparisonGrid = config.getExpression( - sectionName, 'verticalComparisonGrid', usenumpyfunc=True) + verticalComparisonGrid = config.getexpression( + sectionName, 'verticalComparisonGrid', use_numpyfunc=True) - verticalBounds = config.getExpression(sectionName, 'verticalBounds') + verticalBounds = config.getexpression(sectionName, 'verticalBounds') - fields = config.getExpression(sectionName, 'fields') + fields = config.getexpression(sectionName, 'fields') obsFileNames = OrderedDict() for fileName in geojsonFiles: diff --git a/mpas_analysis/ocean/hovmoller_ocean_regions.py b/mpas_analysis/ocean/hovmoller_ocean_regions.py index 2ac580ba3..a4db281ce 100644 --- a/mpas_analysis/ocean/hovmoller_ocean_regions.py +++ b/mpas_analysis/ocean/hovmoller_ocean_regions.py @@ -80,13 +80,13 @@ def __init__(self, config, regionMasksTask, oceanRegionalProfilesTask, else: endYear = int(endYear) - regionGroups = config.getExpression('hovmollerOceanRegions', + regionGroups = config.getexpression('hovmollerOceanRegions', 'regionGroups') for regionGroup in regionGroups: suffix = regionGroup[0].upper() + regionGroup[1:].replace(' ', '') regionGroupSection = 'hovmoller{}'.format(suffix) - regionNames = config.getExpression(regionGroupSection, + regionNames = config.getexpression(regionGroupSection, 'regionNames') if len(regionNames) == 0: return @@ -94,7 +94,7 @@ def __init__(self, config, regionMasksTask, oceanRegionalProfilesTask, computeAnomaly = config.getboolean(regionGroupSection, 'computeAnomaly') - fields = config.getExpression(regionGroupSection, 'fields') + fields = config.getexpression(regionGroupSection, 'fields') masksSubtask = regionMasksTask.add_mask_subtask(regionGroup) masksFile = masksSubtask.geojsonFileName diff --git a/mpas_analysis/ocean/index_nino34.py b/mpas_analysis/ocean/index_nino34.py index 8fde2a52d..a541bd9e1 100644 --- a/mpas_analysis/ocean/index_nino34.py +++ b/mpas_analysis/ocean/index_nino34.py @@ -199,7 +199,7 @@ def run_task(self): # {{{ # regionIndex should correspond to NINO34 in surface weighted Average # AM - regions = config.getExpression('regions', 'regions') + regions = config.getexpression('regions', 'regions') regionToPlot = config.get('indexNino34', 'region') regionIndex = regions.index(regionToPlot) diff --git a/mpas_analysis/ocean/meridional_heat_transport.py b/mpas_analysis/ocean/meridional_heat_transport.py index f924c0037..d38c24f17 100644 --- a/mpas_analysis/ocean/meridional_heat_transport.py +++ b/mpas_analysis/ocean/meridional_heat_transport.py @@ -164,9 +164,9 @@ def run_task(self): # {{{ mainRunName = config.get('runs', 'mainRunName') - depthLimGlobal = config.getExpression(self.sectionName, + depthLimGlobal = config.getexpression(self.sectionName, 'depthLimGlobal') - xLimGlobal = config.getExpression(self.sectionName, 'xLimGlobal') + xLimGlobal = config.getexpression(self.sectionName, 'xLimGlobal') movingAveragePoints = config.getint('meridionalHeatTransport', 'movingAveragePoints') diff --git a/mpas_analysis/ocean/ocean_regional_profiles.py b/mpas_analysis/ocean/ocean_regional_profiles.py index b73f75315..2cb9e16b9 100644 --- a/mpas_analysis/ocean/ocean_regional_profiles.py +++ b/mpas_analysis/ocean/ocean_regional_profiles.py @@ -74,18 +74,18 @@ def __init__(self, config, regionMasksTask, controlConfig=None): # {{{ startYear = config.getint('climatology', 'startYear') endYear = config.getint('climatology', 'endYear') - regionGroups = config.getExpression('oceanRegionalProfiles', + regionGroups = config.getexpression('oceanRegionalProfiles', 'regionGroups') for regionGroup in regionGroups: regionGroupSection = 'profiles{}'.format( regionGroup.replace(' ', '')) - fields = config.getExpression(regionGroupSection, 'fields') + fields = config.getexpression(regionGroupSection, 'fields') - seasons = config.getExpression(regionGroupSection, 'seasons') + seasons = config.getexpression(regionGroupSection, 'seasons') - regionNames = config.getExpression(regionGroupSection, + regionNames = config.getexpression(regionGroupSection, 'regionNames') if len(regionNames) == 0: return @@ -799,7 +799,7 @@ def run_task(self): # {{{ fieldArrays.append(dsControl[meanFieldName].values) errArrays.append(dsControl[stdFieldName].values) - depthRange = config.getExpression(regionGroupSection, 'depthRange') + depthRange = config.getexpression(regionGroupSection, 'depthRange') if len(depthRange) == 0: depthRange = None diff --git a/mpas_analysis/ocean/plot_depth_integrated_time_series_subtask.py b/mpas_analysis/ocean/plot_depth_integrated_time_series_subtask.py index 237943eda..f7e5ced65 100644 --- a/mpas_analysis/ocean/plot_depth_integrated_time_series_subtask.py +++ b/mpas_analysis/ocean/plot_depth_integrated_time_series_subtask.py @@ -268,8 +268,8 @@ def run_task(self): # {{{ mainRunName = config.get('runs', 'mainRunName') - plotTitles = config.getExpression('regions', 'plotTitles') - allRegionNames = config.getExpression('regions', 'regions') + plotTitles = config.getexpression('regions', 'plotTitles') + allRegionNames = config.getexpression('regions', 'regions') regionIndex = allRegionNames.index(self.regionName) regionNameInTitle = plotTitles[regionIndex] @@ -288,7 +288,7 @@ def run_task(self): # {{{ depths = ds.depth.values - divisionDepths = config.getExpression(self.sectionName, 'depths') + divisionDepths = config.getexpression(self.sectionName, 'depths') # for each depth interval to plot, determine the top and bottom depth topDepths = [0, 0] + divisionDepths diff --git a/mpas_analysis/ocean/plot_hovmoller_subtask.py b/mpas_analysis/ocean/plot_hovmoller_subtask.py index f5cff4b58..6234ec8a1 100644 --- a/mpas_analysis/ocean/plot_hovmoller_subtask.py +++ b/mpas_analysis/ocean/plot_hovmoller_subtask.py @@ -264,8 +264,8 @@ def run_task(self): # {{{ regionNameInTitle = self.regionName.replace('_', ' ') regionDim = ds.regionNames.dims[0] else: - plotTitles = config.getExpression('regions', 'plotTitles') - allRegionNames = config.getExpression('regions', 'regions') + plotTitles = config.getexpression('regions', 'plotTitles') + allRegionNames = config.getexpression('regions', 'regions') regionIndex = allRegionNames.index(self.regionName) regionNameInTitle = plotTitles[regionIndex] regionDim = 'nOceanRegionsTmp' @@ -316,11 +316,11 @@ def run_task(self): # {{{ else: yearStrideXTicks = None - movingAverageMonths = config.getWithDefault( - sectionName, 'movingAverageMonths', 1) + movingAverageMonths = config.getint( + sectionName, 'movingAverageMonths') if config.has_option(sectionName, 'yLim'): - yLim = config.getExpression(sectionName, 'yLim') + yLim = config.getexpression(sectionName, 'yLim') else: yLim = None @@ -339,9 +339,9 @@ def run_task(self): # {{{ regionNameInTitle = self.regionName.replace('_', ' ') regionDim = dsRef.regionNames.dims[0] else: - plotTitles = controlConfig.getExpression('regions', + plotTitles = controlConfig.getexpression('regions', 'plotTitles') - allRegionNames = controlConfig.getExpression('regions', + allRegionNames = controlConfig.getexpression('regions', 'regions') regionIndex = allRegionNames.index(self.regionName) regionNameInTitle = plotTitles[regionIndex] diff --git a/mpas_analysis/ocean/regional_ts_diagrams.py b/mpas_analysis/ocean/regional_ts_diagrams.py index bc5ed9b1c..07de4d28b 100644 --- a/mpas_analysis/ocean/regional_ts_diagrams.py +++ b/mpas_analysis/ocean/regional_ts_diagrams.py @@ -97,9 +97,9 @@ def __init__(self, config, mpasClimatologyTask, regionMasksTask, self.run_after(mpasClimatologyTask) self.mpasClimatologyTask = mpasClimatologyTask - regionGroups = config.getExpression(self.taskName, 'regionGroups') + regionGroups = config.getexpression(self.taskName, 'regionGroups') - self.seasons = config.getExpression(self.taskName, 'seasons') + self.seasons = config.getexpression(self.taskName, 'seasons') obsDicts = { 'SOSE': { @@ -146,7 +146,7 @@ def __init__(self, config, mpasClimatologyTask, regionMasksTask, sectionSuffix = regionGroup[0].upper() + \ regionGroup[1:].replace(' ', '') sectionName = 'TSDiagramsFor{}'.format(sectionSuffix) - obsList = config.getExpression(sectionName, 'obs') + obsList = config.getexpression(sectionName, 'obs') allObsUsed = allObsUsed + obsList allObsUsed = set(allObsUsed) @@ -166,7 +166,7 @@ def __init__(self, config, mpasClimatologyTask, regionMasksTask, regionGroup[1:].replace(' ', '') sectionName = 'TSDiagramsFor{}'.format(sectionSuffix) - regionNames = config.getExpression(sectionName, 'regionNames') + regionNames = config.getexpression(sectionName, 'regionNames') if len(regionNames) == 0: continue @@ -175,7 +175,7 @@ def __init__(self, config, mpasClimatologyTask, regionMasksTask, regionNames = mpasMasksSubtask.expand_region_names(regionNames) - obsList = config.getExpression(sectionName, 'obs') + obsList = config.getexpression(sectionName, 'obs') groupObsDicts = {} for obsName in obsList: @@ -1024,8 +1024,8 @@ def run_task(self): # {{{ plotFields.append({'S': obsS, 'T': obsT, 'z': obsZ, 'vol': obsVol, 'title': obsName}) - Tbins = config.getExpression(sectionName, 'Tbins', usenumpyfunc=True) - Sbins = config.getExpression(sectionName, 'Sbins', usenumpyfunc=True) + Tbins = config.getexpression(sectionName, 'Tbins', use_numpyfunc=True) + Sbins = config.getexpression(sectionName, 'Sbins', use_numpyfunc=True) normType = config.get(sectionName, 'normType') @@ -1222,10 +1222,10 @@ def _plot_volumetric_panel(self, T, S, volume): # {{{ config = self.config sectionName = self.sectionName cmap = config.get(sectionName, 'colorMap') - Tbins = config.getExpression(sectionName, 'Tbins', - usenumpyfunc=True) - Sbins = config.getExpression(sectionName, 'Sbins', - usenumpyfunc=True) + Tbins = config.getexpression(sectionName, 'Tbins', + use_numpyfunc=True) + Sbins = config.getexpression(sectionName, 'Sbins', + use_numpyfunc=True) hist, _, _, panel = plt.hist2d(S, T, bins=[Sbins, Tbins], weights=volume, cmap=cmap, zorder=1, diff --git a/mpas_analysis/ocean/sose_transects.py b/mpas_analysis/ocean/sose_transects.py index 00ac07eb1..358edadb2 100644 --- a/mpas_analysis/ocean/sose_transects.py +++ b/mpas_analysis/ocean/sose_transects.py @@ -73,7 +73,7 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): sectionName = self.taskName - seasons = config.getExpression(sectionName, 'seasons') + seasons = config.getexpression(sectionName, 'seasons') horizontalResolution = config.get(sectionName, 'horizontalResolution') @@ -83,13 +83,13 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): if verticalComparisonGridName in ['mpas', 'obs']: verticalComparisonGrid = None else: - verticalComparisonGrid = config.getExpression( - sectionName, 'verticalComparisonGrid', usenumpyfunc=True) + verticalComparisonGrid = config.getexpression( + sectionName, 'verticalComparisonGrid', use_numpyfunc=True) - verticalBounds = config.getExpression(sectionName, 'verticalBounds') + verticalBounds = config.getexpression(sectionName, 'verticalBounds') - longitudes = sorted(config.getExpression(sectionName, 'longitudes', - usenumpyfunc=True)) + longitudes = sorted(config.getexpression(sectionName, 'longitudes', + use_numpyfunc=True)) fields = \ [{'prefix': 'temperature', @@ -129,7 +129,7 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): 'obsFilePrefix': None, 'obsFieldName': 'velMag'}] - fieldList = config.getExpression(sectionName, 'fieldList') + fieldList = config.getexpression(sectionName, 'fieldList') fields = [field for field in fields if field['prefix'] in fieldList] variableList = [field['mpas'] for field in fields @@ -297,8 +297,8 @@ def combine_observations(self): # {{{ config = self.config - longitudes = sorted(config.getExpression('soseTransects', 'longitudes', - usenumpyfunc=True)) + longitudes = sorted(config.getexpression('soseTransects', 'longitudes', + use_numpyfunc=True)) observationsDirectory = build_obs_path( config, 'ocean', 'soseSubdirectory') diff --git a/mpas_analysis/ocean/streamfunction_moc.py b/mpas_analysis/ocean/streamfunction_moc.py index 1b0aa3548..d390e4e5b 100644 --- a/mpas_analysis/ocean/streamfunction_moc.py +++ b/mpas_analysis/ocean/streamfunction_moc.py @@ -149,9 +149,7 @@ def __init__(self, parentTask): meshName = config.get('input', 'mpasMeshName') regionGroup = 'MOC Basins' - subprocessCount = config.getWithDefault('execute', - 'parallelTaskCount', - default=1) + subprocessCount = config.getint('execute', 'parallelTaskCount') # call the constructor from the base class (ComputeRegionMasksSubtask) super().__init__( @@ -299,7 +297,7 @@ def setup_and_check(self): # {{{ self.sectionName = 'streamfunctionMOC' - self.usePostprocessing = config.getExpression( + self.usePostprocessing = config.getexpression( self.sectionName, 'usePostprocessingScript') if not self.usePostprocessing and self.mocAnalysisMemberEnabled: @@ -364,7 +362,7 @@ def _compute_moc_climo_analysismember(self): # {{{ if os.path.exists(outputFileName): return - regionNames = config.getExpression(self.sectionName, 'regionNames') + regionNames = config.getexpression(self.sectionName, 'regionNames') regionNames.append('Global') # Read in depth and bin latitudes @@ -498,7 +496,7 @@ def _compute_moc_climo_postprocess(self): # {{{ dvEdge, areaCell, refBottomDepth, latCell, nVertLevels, \ refTopDepth, refLayerThickness = _load_mesh(self.runStreams) - regionNames = config.getExpression(self.sectionName, 'regionNames') + regionNames = config.getexpression(self.sectionName, 'regionNames') # Load basin region related variables and save them to dictionary mpasMeshName = config.get('input', 'mpasMeshName') @@ -692,7 +690,7 @@ def setup_and_check(self): # {{{ mainRunName = config.get('runs', 'mainRunName') - self.regionNames = ['Global'] + config.getExpression(self.sectionName, + self.regionNames = ['Global'] + config.getexpression(self.sectionName, 'regionNames') for region in self.regionNames: @@ -750,9 +748,9 @@ def run_task(self): # {{{ z = depth regionMOC = moc[region] # Subset lat range - minLat = config.getExpression('streamfunctionMOC{}'.format(region), + minLat = config.getexpression('streamfunctionMOC{}'.format(region), 'latBinMin') - maxLat = config.getExpression('streamfunctionMOC{}'.format(region), + maxLat = config.getexpression('streamfunctionMOC{}'.format(region), 'latBinMax') indLat = np.logical_and(x >= minLat, x <= maxLat) x = x.where(indLat, drop=True) @@ -898,7 +896,7 @@ def setup_and_check(self): # {{{ self.sectionName = 'streamfunctionMOC' - self.usePostprocessing = config.getExpression( + self.usePostprocessing = config.getexpression( self.sectionName, 'usePostprocessingScript') if not self.usePostprocessing and self.mocAnalysisMemberEnabled: diff --git a/mpas_analysis/ocean/time_series_antarctic_melt.py b/mpas_analysis/ocean/time_series_antarctic_melt.py index b713fe17d..73699e0ca 100644 --- a/mpas_analysis/ocean/time_series_antarctic_melt.py +++ b/mpas_analysis/ocean/time_series_antarctic_melt.py @@ -75,7 +75,7 @@ def __init__(self, config, mpasTimeSeriesTask, regionMasksTask, tags=['timeSeries', 'melt', 'landIceCavities', 'antarctic']) regionGroup = 'Ice Shelves' - iceShelvesToPlot = config.getExpression('timeSeriesAntarcticMelt', + iceShelvesToPlot = config.getexpression('timeSeriesAntarcticMelt', 'iceShelvesToPlot') if len(iceShelvesToPlot) == 0: # nothing else to do diff --git a/mpas_analysis/ocean/time_series_ocean_regions.py b/mpas_analysis/ocean/time_series_ocean_regions.py index b2ce00127..4ed632737 100644 --- a/mpas_analysis/ocean/time_series_ocean_regions.py +++ b/mpas_analysis/ocean/time_series_ocean_regions.py @@ -81,7 +81,7 @@ def __init__(self, config, regionMasksTask, controlConfig=None): else: endYear = int(endYear) - regionGroups = config.getExpression(self.taskName, 'regionGroups') + regionGroups = config.getexpression(self.taskName, 'regionGroups') obsDicts = { 'SOSE': { @@ -124,7 +124,7 @@ def __init__(self, config, regionMasksTask, controlConfig=None): regionGroup[1:].replace(' ', '') sectionName = 'timeSeries{}'.format(sectionSuffix) - regionNames = config.getExpression(sectionName, 'regionNames') + regionNames = config.getexpression(sectionName, 'regionNames') if len(regionNames) == 0: # no regions in this group were requested continue @@ -136,7 +136,7 @@ def __init__(self, config, regionMasksTask, controlConfig=None): years = list(range(startYear, endYear + 1)) - obsList = config.getExpression(sectionName, 'obs') + obsList = config.getexpression(sectionName, 'obs') groupObsDicts = {} for obsName in obsList: @@ -528,7 +528,7 @@ def run_task(self): # {{{ self.historyStreams, 'timeSeriesStatsMonthlyOutput') - variables = config.getExpression(sectionName, 'variables') + variables = config.getexpression(sectionName, 'variables') variableList = {'timeMonthly_avg_layerThickness'} @@ -1114,7 +1114,7 @@ def setup_and_check(self): # {{{ # self.calendar super(PlotRegionTimeSeriesSubtask, self).setup_and_check() - self.variables = self.config.getExpression(self.sectionName, + self.variables = self.config.getexpression(self.sectionName, 'variables') self.xmlFileNames = [] diff --git a/mpas_analysis/ocean/time_series_ohc_anomaly.py b/mpas_analysis/ocean/time_series_ohc_anomaly.py index 79c1546c1..4d2d01a74 100644 --- a/mpas_analysis/ocean/time_series_ohc_anomaly.py +++ b/mpas_analysis/ocean/time_series_ohc_anomaly.py @@ -66,7 +66,7 @@ def __init__(self, config, mpasTimeSeriesTask, controlConfig=None): tags=['timeSeries', 'ohc', 'publicObs', 'anomaly']) sectionName = 'timeSeriesOHCAnomaly' - regionNames = config.getExpression(sectionName, 'regions') + regionNames = config.getexpression(sectionName, 'regions') movingAveragePoints = config.getint(sectionName, 'movingAveragePoints') self.variableDict = {} @@ -139,7 +139,7 @@ def _compute_ohc(self, ds): # {{{ Compute the OHC time series. ''' - # regionNames = self.config.getExpression('regions', 'regions') + # regionNames = self.config.getexpression('regions', 'regions') # ds['regionNames'] = ('nOceanRegionsTmp', regionNames) # for convenience, rename the variables to simpler, shorter names diff --git a/mpas_analysis/ocean/time_series_salinity_anomaly.py b/mpas_analysis/ocean/time_series_salinity_anomaly.py index 00c5ee156..d87593824 100644 --- a/mpas_analysis/ocean/time_series_salinity_anomaly.py +++ b/mpas_analysis/ocean/time_series_salinity_anomaly.py @@ -53,7 +53,7 @@ def __init__(self, config, mpasTimeSeriesTask): # {{{ tags=['timeSeries', 'salinity', 'publicObs', 'anomaly']) sectionName = 'hovmollerSalinityAnomaly' - regionNames = config.getExpression(sectionName, 'regions') + regionNames = config.getexpression(sectionName, 'regions') movingAveragePoints = config.getint(sectionName, 'movingAveragePoints') mpasFieldName = 'timeMonthly_avg_avgValueWithinOceanLayerRegion_' \ diff --git a/mpas_analysis/ocean/time_series_sst.py b/mpas_analysis/ocean/time_series_sst.py index 7c5f2835b..f1f1c5e98 100644 --- a/mpas_analysis/ocean/time_series_sst.py +++ b/mpas_analysis/ocean/time_series_sst.py @@ -114,7 +114,7 @@ def setup_and_check(self): # {{{ self.inputFile = self.mpasTimeSeriesTask.outputFile mainRunName = config.get('runs', 'mainRunName') - regions = config.getExpression('timeSeriesSST', 'regions') + regions = config.getexpression('timeSeriesSST', 'regions') self.xmlFileNames = [] self.filePrefixes = {} @@ -152,9 +152,9 @@ def run_task(self): # {{{ movingAveragePoints = config.getint('timeSeriesSST', 'movingAveragePoints') - regions = config.getExpression('regions', 'regions') - plotTitles = config.getExpression('regions', 'plotTitles') - regionsToPlot = config.getExpression('timeSeriesSST', 'regions') + regions = config.getexpression('regions', 'regions') + plotTitles = config.getexpression('regions', 'plotTitles') + regionsToPlot = config.getexpression('timeSeriesSST', 'regions') regionIndicesToPlot = [regions.index(region) for region in regionsToPlot] diff --git a/mpas_analysis/ocean/time_series_temperature_anomaly.py b/mpas_analysis/ocean/time_series_temperature_anomaly.py index 52e2d836b..281f6629f 100644 --- a/mpas_analysis/ocean/time_series_temperature_anomaly.py +++ b/mpas_analysis/ocean/time_series_temperature_anomaly.py @@ -53,7 +53,7 @@ def __init__(self, config, mpasTimeSeriesTask): # {{{ tags=['timeSeries', 'temperature', 'publicObs', 'anomaly']) sectionName = 'hovmollerTemperatureAnomaly' - regionNames = config.getExpression(sectionName, 'regions') + regionNames = config.getexpression(sectionName, 'regions') movingAveragePoints = config.getint(sectionName, 'movingAveragePoints') mpasFieldName = 'timeMonthly_avg_avgValueWithinOceanLayerRegion_' \ diff --git a/mpas_analysis/ocean/time_series_transport.py b/mpas_analysis/ocean/time_series_transport.py index 6d4973e5b..70fa66bfd 100644 --- a/mpas_analysis/ocean/time_series_transport.py +++ b/mpas_analysis/ocean/time_series_transport.py @@ -79,7 +79,7 @@ def __init__(self, config, controlConfig=None): years = [year for year in range(startYear, endYear + 1)] - transectsToPlot = config.getExpression('timeSeriesTransport', + transectsToPlot = config.getexpression('timeSeriesTransport', 'transectsToPlot') if len(transectsToPlot) == 0: return diff --git a/mpas_analysis/ocean/woce_transects.py b/mpas_analysis/ocean/woce_transects.py index 573aeba2f..a3c327328 100644 --- a/mpas_analysis/ocean/woce_transects.py +++ b/mpas_analysis/ocean/woce_transects.py @@ -64,7 +64,7 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): sectionName = self.taskName - seasons = config.getExpression(sectionName, 'seasons') + seasons = config.getexpression(sectionName, 'seasons') horizontalResolution = config.get(sectionName, 'horizontalResolution') @@ -74,12 +74,12 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): if verticalComparisonGridName in ['mpas', 'obs']: verticalComparisonGrid = None else: - verticalComparisonGrid = config.getExpression( - sectionName, 'verticalComparisonGrid', usenumpyfunc=True) + verticalComparisonGrid = config.getexpression( + sectionName, 'verticalComparisonGrid', use_numpyfunc=True) - verticalBounds = config.getExpression(sectionName, 'verticalBounds') + verticalBounds = config.getexpression(sectionName, 'verticalBounds') - horizontalBounds = config.getExpression( + horizontalBounds = config.getexpression( sectionName, 'horizontalBounds') observationsDirectory = build_obs_path( diff --git a/mpas_analysis/sea_ice/climatology_map_berg_conc.py b/mpas_analysis/sea_ice/climatology_map_berg_conc.py index f0b960dba..341758ab3 100644 --- a/mpas_analysis/sea_ice/climatology_map_berg_conc.py +++ b/mpas_analysis/sea_ice/climatology_map_berg_conc.py @@ -82,13 +82,13 @@ def __init__(self, config, mpasClimatologyTask, hemisphere, hemisphereLong = 'Southern' # read in what seasons we want to plot - seasons = config.getExpression(sectionName, 'seasons') + seasons = config.getexpression(sectionName, 'seasons') if len(seasons) == 0: raise ValueError('config section {} does not contain valid list ' 'of seasons'.format(sectionName)) - comparisonGridNames = config.getExpression(sectionName, + comparisonGridNames = config.getexpression(sectionName, 'comparisonGrids') if len(comparisonGridNames) == 0: diff --git a/mpas_analysis/sea_ice/climatology_map_sea_ice_conc.py b/mpas_analysis/sea_ice/climatology_map_sea_ice_conc.py index 82389d12e..5881fe9ae 100644 --- a/mpas_analysis/sea_ice/climatology_map_sea_ice_conc.py +++ b/mpas_analysis/sea_ice/climatology_map_sea_ice_conc.py @@ -85,13 +85,13 @@ def __init__(self, config, mpasClimatologyTask, hemisphere, hemisphereLong = 'Southern' # read in what seasons we want to plot - seasons = config.getExpression(sectionName, 'seasons') + seasons = config.getexpression(sectionName, 'seasons') if len(seasons) == 0: raise ValueError('config section {} does not contain valid list ' 'of seasons'.format(sectionName)) - comparisonGridNames = config.getExpression(sectionName, + comparisonGridNames = config.getexpression(sectionName, 'comparisonGrids') if len(comparisonGridNames) == 0: @@ -127,7 +127,7 @@ def _add_obs_tasks(self, seasons, comparisonGridNames, hemisphere, obsFieldName = 'seaIceConc' sectionName = self.taskName - observationPrefixes = config.getExpression(sectionName, + observationPrefixes = config.getexpression(sectionName, 'observationPrefixes') for prefix in observationPrefixes: for season in seasons: diff --git a/mpas_analysis/sea_ice/climatology_map_sea_ice_thick.py b/mpas_analysis/sea_ice/climatology_map_sea_ice_thick.py index e0e14f127..72b2e3348 100644 --- a/mpas_analysis/sea_ice/climatology_map_sea_ice_thick.py +++ b/mpas_analysis/sea_ice/climatology_map_sea_ice_thick.py @@ -85,13 +85,13 @@ def __init__(self, config, mpasClimatologyTask, hemisphere, hemisphereLong = 'Southern' # read in what seasons we want to plot - seasons = config.getExpression(sectionName, 'seasons') + seasons = config.getexpression(sectionName, 'seasons') if len(seasons) == 0: raise ValueError('config section {} does not contain valid list ' 'of seasons'.format(sectionName)) - comparisonGridNames = config.getExpression(sectionName, + comparisonGridNames = config.getexpression(sectionName, 'comparisonGrids') if len(comparisonGridNames) == 0: diff --git a/mpas_analysis/sea_ice/plot_climatology_map_subtask.py b/mpas_analysis/sea_ice/plot_climatology_map_subtask.py index c13c63212..49bfd9ec8 100644 --- a/mpas_analysis/sea_ice/plot_climatology_map_subtask.py +++ b/mpas_analysis/sea_ice/plot_climatology_map_subtask.py @@ -374,7 +374,7 @@ def run_task(self): # {{{ # for log plots, make sure the data is all positive to avoid masking if config.has_option(sectionName, 'normTypeResult'): normType = config.get(sectionName, 'normTypeResult') - normArgs = config.getExpression(sectionName, 'normArgsResult') + normArgs = config.getexpression(sectionName, 'normArgsResult') if normType == 'log': epsilon = 1e-2 * normArgs['vmin'] modelOutput = np.maximum(modelOutput, epsilon) diff --git a/mpas_analysis/shared/analysis_task.py b/mpas_analysis/shared/analysis_task.py index bd720d3d5..177a02971 100644 --- a/mpas_analysis/shared/analysis_task.py +++ b/mpas_analysis/shared/analysis_task.py @@ -389,7 +389,7 @@ def check_generate(self): 'must be None or a list of strings.') config = self.config - generateList = config.getExpression('output', 'generate') + generateList = config.getexpression('output', 'generate') if len(generateList) > 0 and generateList[0][0:5] == 'only_': # add 'all' if the first item in the list has the 'only' prefix. # Otherwise, we would not run any tasks diff --git a/mpas_analysis/shared/climatology/climatology.py b/mpas_analysis/shared/climatology/climatology.py index 19f29fa35..fab7442d9 100644 --- a/mpas_analysis/shared/climatology/climatology.py +++ b/mpas_analysis/shared/climatology/climatology.py @@ -120,7 +120,7 @@ def get_remapper(config, sourceDescriptor, comparisonDescriptor, remapper = Remapper(sourceDescriptor, comparisonDescriptor, mappingFileName) - mpiTasks = config.getWithDefault('execute', 'mapMpiTasks', 1) + mpiTasks = config.getint('execute', 'mapMpiTasks') esmf_parallel_exec = config.get('execute', 'mapParallelExec') if esmf_parallel_exec == 'None': esmf_parallel_exec = None diff --git a/mpas_analysis/shared/climatology/comparison_descriptors.py b/mpas_analysis/shared/climatology/comparison_descriptors.py index 91efd4feb..7697d1775 100644 --- a/mpas_analysis/shared/climatology/comparison_descriptors.py +++ b/mpas_analysis/shared/climatology/comparison_descriptors.py @@ -84,10 +84,8 @@ def _get_lat_lon_comparison_descriptor(config): section = 'climatology' - lat_res = config.getWithDefault(section, 'comparisonLatResolution', - constants.dLatitude) - lon_res = config.getWithDefault(section, 'comparisonLatResolution', - constants.dLongitude) + lat_res = config.getfloat(section, 'comparisonLatResolution') + lon_res = config.getfloat(section, 'comparisonLatResolution') nlat = int((constants.latmax - constants.latmin) / lat_res) + 1 nlon = int((constants.lonmax - constants.lonmin) / lon_res) + 1 diff --git a/mpas_analysis/shared/constants/constants.py b/mpas_analysis/shared/constants/constants.py index ecbb5cabe..3792adad5 100644 --- a/mpas_analysis/shared/constants/constants.py +++ b/mpas_analysis/shared/constants/constants.py @@ -21,8 +21,6 @@ import numpy as np # set parameters for default climatology comparison grid -dLongitude = 0.5 -dLatitude = 0.5 lonmin = -180. lonmax = 180. latmin = -90. diff --git a/mpas_analysis/shared/plot/climatology_map.py b/mpas_analysis/shared/plot/climatology_map.py index 1db678d28..101fbc382 100644 --- a/mpas_analysis/shared/plot/climatology_map.py +++ b/mpas_analysis/shared/plot/climatology_map.py @@ -592,17 +592,17 @@ def plot_panel(ax, title, array, colormap, norm, levels, ticks, contours, useCartopyCoastline = config.getboolean(section, 'useCartopyCoastline') if refArray is None: - figsize = config.getExpression(section, 'onePanelFigSize') + figsize = config.getexpression(section, 'onePanelFigSize') subplots = [111] elif vertical: - figsize = config.getExpression(section, 'threePanelVertFigSize') + figsize = config.getexpression(section, 'threePanelVertFigSize') subplots = [311, 312, 313] else: - figsize = config.getExpression(section, 'threePanelHorizFigSize') + figsize = config.getexpression(section, 'threePanelHorizFigSize') subplots = [131, 132, 133] - latLines = config.getExpression(section, 'latLines', usenumpyfunc=True) - lonLines = config.getExpression(section, 'lonLines', usenumpyfunc=True) + latLines = config.getexpression(section, 'latLines', use_numpyfunc=True) + lonLines = config.getexpression(section, 'lonLines', use_numpyfunc=True) # put latitude labels on the left unless we're in a polar projection left_labels = projectionName not in ['arctic', 'antarctic'] diff --git a/mpas_analysis/shared/plot/colormap.py b/mpas_analysis/shared/plot/colormap.py index 4780ff798..5222855fa 100644 --- a/mpas_analysis/shared/plot/colormap.py +++ b/mpas_analysis/shared/plot/colormap.py @@ -88,9 +88,9 @@ def setup_colormap(config, configSectionName, suffix=''): option = 'contourLevels{}'.format(suffix) if config.has_option(configSectionName, option): - contours = config.getExpression(configSectionName, + contours = config.getexpression(configSectionName, option, - usenumpyfunc=True) + use_numpyfunc=True) if isinstance(contours, string_types) and contours == 'none': contours = None else: @@ -344,7 +344,7 @@ def _setup_colormap_and_norm(config, configSectionName, suffix=''): normType = config.get(configSectionName, 'normType{}'.format(suffix)) - kwargs = config.getExpression(configSectionName, + kwargs = config.getexpression(configSectionName, 'normArgs{}'.format(suffix)) if normType == 'symLog': @@ -358,9 +358,9 @@ def _setup_colormap_and_norm(config, configSectionName, suffix=''): normType, configSectionName)) try: - ticks = config.getExpression( + ticks = config.getexpression( configSectionName, 'colorbarTicks{}'.format(suffix), - usenumpyfunc=True) + use_numpyfunc=True) except(configparser.NoOptionError): ticks = None @@ -403,14 +403,14 @@ def _setup_indexed_colormap(config, configSectionName, suffix=''): colormap = plt.get_cmap(config.get(configSectionName, 'colormapName{}'.format(suffix))) - indices = config.getExpression(configSectionName, + indices = config.getexpression(configSectionName, 'colormapIndices{}'.format(suffix), - usenumpyfunc=True) + use_numpyfunc=True) try: - levels = config.getExpression( + levels = config.getexpression( configSectionName, 'colorbarLevels{}'.format(suffix), - usenumpyfunc=True) + use_numpyfunc=True) except(configparser.NoOptionError): levels = None @@ -435,9 +435,9 @@ def _setup_indexed_colormap(config, configSectionName, suffix=''): norm = cols.BoundaryNorm(levels, colormap.N) try: - ticks = config.getExpression( + ticks = config.getexpression( configSectionName, 'colorbarTicks{}'.format(suffix), - usenumpyfunc=True) + use_numpyfunc=True) except(configparser.NoOptionError): ticks = levels diff --git a/mpas_analysis/shared/regions/compute_region_masks.py b/mpas_analysis/shared/regions/compute_region_masks.py index b958292d5..e6c73f312 100644 --- a/mpas_analysis/shared/regions/compute_region_masks.py +++ b/mpas_analysis/shared/regions/compute_region_masks.py @@ -92,9 +92,7 @@ def add_mask_subtask(self, regionGroup, obsFileName=None, lonVar='lon', if key not in self.regionMaskSubtasks: - subprocessCount = config.getWithDefault('execute', - 'parallelTaskCount', - default=1) + subprocessCount = config.getint('execute', 'parallelTaskCount') if obsFileName is not None: useMpasMaskCreator = False diff --git a/mpas_analysis/shared/transects/compute_transect_masks_subtask.py b/mpas_analysis/shared/transects/compute_transect_masks_subtask.py index a6a2f16b2..7f6560e1b 100644 --- a/mpas_analysis/shared/transects/compute_transect_masks_subtask.py +++ b/mpas_analysis/shared/transects/compute_transect_masks_subtask.py @@ -124,8 +124,8 @@ def __init__(self, parentTask, transectGroup, subprocessCount=None): tags=[]) if subprocessCount is None: - self.subprocessCount = self.config.getWithDefault( - 'execute', 'parallelTaskCount', default=1) + self.subprocessCount = self.config.getint( + 'execute', 'parallelTaskCount') else: self.subprocessCount = subprocessCount From 32f0fddf932767964621063b9b7e733124061ba7 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Sun, 17 Apr 2022 05:03:01 -0500 Subject: [PATCH 11/40] Fix ESMF calls in test suite --- suite/setup.py | 16 +--------------- suite/template.cfg | 9 ++++++++- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/suite/setup.py b/suite/setup.py index 903d2f63c..723984e47 100755 --- a/suite/setup.py +++ b/suite/setup.py @@ -132,27 +132,13 @@ def main(): out_subdir = os.path.join(machine, args.branch, args.run) out_common_dir = os.path.join(machine, args.branch) - if machine == 'cori-haswell': - execute_options = \ - '# the number of MPI tasks to use in creating mapping files (1 means tasks run in\n' \ - '# serial, the default)\n' \ - 'mapMpiTasks = 1\n' \ - '\n' \ - '# "None" if ESMF should perform mapping file generation in serial without a\n' \ - '# command, or one of "srun" or "mpirun" if it should be run in parallel (or ins\n' \ - '# serial but with a command)\n' \ - 'mapParallelExec = None' - else: - execute_options = '' - with open(os.path.join('suite', 'template.cfg')) as template_file: template_data = template_file.read() template = Template(template_data) config_text = template.render( run_name=args.run, input_base=input_base, simulation=simulation, mesh=mesh, output_base=output_base, html_base=html_base, - out_subdir=out_subdir, generate=generate, end_year=end_year, - execute_options=execute_options) + out_subdir=out_subdir, generate=generate, end_year=end_year) with open(config, 'w') as config_file: config_file.write(config_text) diff --git a/suite/template.cfg b/suite/template.cfg index 5b13144a5..f29bae6f1 100644 --- a/suite/template.cfg +++ b/suite/template.cfg @@ -22,7 +22,14 @@ mainRunName = {{ run_name }} [execute] ## options related to executing parallel tasks -{{ execute_options }} +# the number of MPI tasks to use in creating mapping files (1 means tasks run in +# serial, the default) +mapMpiTasks = 1 + +# "None" if ESMF should perform mapping file generation in serial without a +# command, or one of "srun" or "mpirun" if it should be run in parallel (or in +# serial but with a command) +mapParallelExec = None [input] ## options related to reading in the results to be analyzed From 81f2a8bda7133216eb25e1909f8aa272d5eeae51 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Sun, 17 Apr 2022 07:30:53 -0500 Subject: [PATCH 12/40] Update movingAverageMonths --> movingAveragePoints Some namelist options are not finding the correct option because of confusions between these names. --- mpas_analysis/default.cfg | 13 ++++++++---- .../ocean/hovmoller_ocean_regions.py | 20 +++++++++---------- mpas_analysis/ocean/plot_hovmoller_subtask.py | 6 +++--- .../ocean/time_series_antarctic_melt.py | 8 ++++---- .../ocean/time_series_ocean_regions.py | 4 ++-- mpas_analysis/ocean/time_series_transport.py | 6 +++--- mpas_analysis/polar_regions.cfg | 10 +++++----- 7 files changed, 36 insertions(+), 31 deletions(-) diff --git a/mpas_analysis/default.cfg b/mpas_analysis/default.cfg index b3af43e18..93084efef 100644 --- a/mpas_analysis/default.cfg +++ b/mpas_analysis/default.cfg @@ -579,6 +579,11 @@ contourLevelsResult = np.arange(-2.5, 2.6, 0.5) # commented out to determine the distance between ticks automatically. # yearStrideXTicks = 1 +# Number of points over which to compute moving average(e.g., for monthly +# output, movingAveragePoints=12 corresponds to a 12-month moving average +# window) +movingAveragePoints = 12 + [hovmollerTemperatureAnomaly] ## options related to plotting time series of potential temperature vs. depth @@ -1473,7 +1478,7 @@ iceShelvesToPlot = ['Antarctica', 'Peninsula', 'West Antarctica', 'Thwaites', 'Pine_Island', 'Abbot', 'George_VI'] # Number of months over which to compute moving average -movingAverageMonths = 1 +movingAveragePoints = 1 # An optional first year for the tick marks on the x axis. Leave commented out # to start at the beginning of the time series. @@ -1548,7 +1553,7 @@ transectsToPlot = ['Drake Passage', 'Tasmania-Ant', 'Africa-Ant', 'Denmark Strait', 'Iceland-Faroe-Scotland'] # Number of months over which to compute moving average -movingAverageMonths = 1 +movingAveragePoints = 1 # An optional first year for the tick marks on the x axis. Leave commented out # to start at the beginning of the time series. @@ -3325,9 +3330,9 @@ regionNames = ["Atlantic_Basin", "Pacific_Basin", "Indian_Basin", computeAnomaly = False # Number of points over which to compute moving average(e.g., for monthly -# output, movingAverageMonths=12 corresponds to a 12-month moving average +# output, movingAveragePoints=12 corresponds to a 12-month moving average # window) -movingAverageMonths = 12 +movingAveragePoints = 12 [hovmollerOceanRegionsPotentialTemperature] diff --git a/mpas_analysis/ocean/hovmoller_ocean_regions.py b/mpas_analysis/ocean/hovmoller_ocean_regions.py index a4db281ce..1dfebc3e0 100644 --- a/mpas_analysis/ocean/hovmoller_ocean_regions.py +++ b/mpas_analysis/ocean/hovmoller_ocean_regions.py @@ -111,8 +111,8 @@ def __init__(self, config, regionMasksTask, oceanRegionalProfilesTask, combineSubtask = oceanRegionalProfilesTask.combineSubtasks[ regionGroup][(startYear, endYear)] - movingAverageMonths = config.getint( - regionGroupSection, 'movingAverageMonths') + movingAveragePoints = config.getint( + regionGroupSection, 'movingAveragePoints') baseDirectory = build_config_full_path( config, 'output', 'timeSeriesSubdirectory') @@ -130,7 +130,7 @@ def __init__(self, config, regionMasksTask, oceanRegionalProfilesTask, startYear, endYear) outFullPath = '{}/{}'.format(baseDirectory, outFileName) anomalySubtask = ComputeHovmollerAnomalySubtask( - self, inFullPath, outFullPath, movingAverageMonths) + self, inFullPath, outFullPath, movingAveragePoints) self.add_subtask(anomalySubtask) anomalySubtask.run_after(combineSubtask) # PlotHovmollerSubtask requires a relative path @@ -143,8 +143,8 @@ def __init__(self, config, regionMasksTask, oceanRegionalProfilesTask, suffix = prefix[0].upper() + prefix[1:] fieldSectionName = 'hovmollerOceanRegions{}'.format(suffix) - config.set(fieldSectionName, 'movingAverageMonths', - '{}'.format(movingAverageMonths)) + config.set(fieldSectionName, 'movingAveragePoints', + '{}'.format(movingAveragePoints)) for regionName in regionNames: if computeAnomaly: @@ -217,7 +217,7 @@ class ComputeHovmollerAnomalySubtask(AnalysisTask): # Xylar Asay-Davis def __init__(self, parentTask, inFileName, outFileName, - movingAverageMonths, subtaskName='computeAnomaly'): # {{{ + movingAveragePoints, subtaskName='computeAnomaly'): # {{{ """ Construct the analysis task. @@ -232,7 +232,7 @@ def __init__(self, parentTask, inFileName, outFileName, outFileName : str The file name for the anomaly - movingAverageMonths : int + movingAveragePoints : int The number of months used in the moving average used to smooth the data set @@ -253,7 +253,7 @@ def __init__(self, parentTask, inFileName, outFileName, self.inFileName = inFileName self.outFileName = outFileName - self.movingAverageMonths = movingAverageMonths + self.movingAveragePoints = movingAveragePoints # }}} @@ -281,7 +281,7 @@ def setup_and_check(self): # {{{ months = delta.months + 12*delta.years - if months <= self.movingAverageMonths: + if months <= self.movingAveragePoints: raise ValueError('Cannot meaningfully perform a rolling mean ' 'because the time series is too short.') @@ -301,7 +301,7 @@ def run_task(self): # {{{ ds = xarray.open_dataset(self.inFileName) - dsStart = ds.isel(Time=slice(0, self.movingAverageMonths)).mean('Time') + dsStart = ds.isel(Time=slice(0, self.movingAveragePoints)).mean('Time') for variable in ds.data_vars: ds[variable] = ds[variable] - dsStart[variable] diff --git a/mpas_analysis/ocean/plot_hovmoller_subtask.py b/mpas_analysis/ocean/plot_hovmoller_subtask.py index 6234ec8a1..b18ff1306 100644 --- a/mpas_analysis/ocean/plot_hovmoller_subtask.py +++ b/mpas_analysis/ocean/plot_hovmoller_subtask.py @@ -316,8 +316,8 @@ def run_task(self): # {{{ else: yearStrideXTicks = None - movingAverageMonths = config.getint( - sectionName, 'movingAverageMonths') + movingAveragePoints = config.getint( + sectionName, 'movingAveragePoints') if config.has_option(sectionName, 'yLim'): yLim = config.getexpression(sectionName, 'yLim') @@ -379,7 +379,7 @@ def run_task(self): # {{{ zCoord=z, colorbarLabel=self.unitsLabel, title=title, modelTitle=mainRunName, refTitle=refTitle, diffTitle=diffTitle, xlabels=xLabel, ylabel=yLabel, lineWidth=1, xCoordIsTime=True, - movingAveragePoints=movingAverageMonths, calendar=self.calendar, + movingAveragePoints=movingAveragePoints, calendar=self.calendar, firstYearXTicks=firstYearXTicks, yearStrideXTicks=yearStrideXTicks, yLim=yLim, invertYAxis=False, titleFontSize=titleFontSize, axisFontSize=axisFontSize, defaultFontSize=defaultFontSize) diff --git a/mpas_analysis/ocean/time_series_antarctic_melt.py b/mpas_analysis/ocean/time_series_antarctic_melt.py index 73699e0ca..4f88c96a1 100644 --- a/mpas_analysis/ocean/time_series_antarctic_melt.py +++ b/mpas_analysis/ocean/time_series_antarctic_melt.py @@ -599,8 +599,8 @@ def run_task(self): # {{{ # If areas from obs file used need to be converted from sq km to sq m mainRunName = config.get('runs', 'mainRunName') - movingAverageMonths = config.getint('timeSeriesAntarcticMelt', - 'movingAverageMonths') + movingAveragePoints = config.getint('timeSeriesAntarcticMelt', + 'movingAveragePoints') outputDirectory = build_config_full_path(config, 'output', 'timeseriesSubdirectory') @@ -684,7 +684,7 @@ def run_task(self): # {{{ fig = timeseries_analysis_plot(config, fields, calendar=calendar, title=title, xlabel=xLabel, ylabel=yLabel, - movingAveragePoints=movingAverageMonths, + movingAveragePoints=movingAveragePoints, lineColors=lineColors, lineWidths=lineWidths, legendText=legendText, @@ -752,7 +752,7 @@ def run_task(self): # {{{ fig = timeseries_analysis_plot(config, fields, calendar=calendar, title=title, xlabel=xLabel, ylabel=yLabel, - movingAveragePoints=movingAverageMonths, + movingAveragePoints=movingAveragePoints, lineColors=lineColors, lineWidths=lineWidths, legendText=legendText, diff --git a/mpas_analysis/ocean/time_series_ocean_regions.py b/mpas_analysis/ocean/time_series_ocean_regions.py index 4ed632737..f6fed467a 100644 --- a/mpas_analysis/ocean/time_series_ocean_regions.py +++ b/mpas_analysis/ocean/time_series_ocean_regions.py @@ -1181,7 +1181,7 @@ def run_task(self): # {{{ zboundsRef = dsRef.zbounds.values mainRunName = config.get('runs', 'mainRunName') - movingAverageMonths = 1 + movingAveragePoints = 1 self.logger.info(' Make plots...') @@ -1265,7 +1265,7 @@ def run_task(self): # {{{ fig = timeseries_analysis_plot( config, fields, calendar=calendar, title=title, xlabel=xLabel, - ylabel=yLabel, movingAveragePoints=movingAverageMonths, + ylabel=yLabel, movingAveragePoints=movingAveragePoints, lineColors=lineColors, lineWidths=lineWidths, legendText=legendText, titleFontSize=titleFontSize, defaultFontSize=defaultFontSize) diff --git a/mpas_analysis/ocean/time_series_transport.py b/mpas_analysis/ocean/time_series_transport.py index 70fa66bfd..aa7462827 100644 --- a/mpas_analysis/ocean/time_series_transport.py +++ b/mpas_analysis/ocean/time_series_transport.py @@ -602,8 +602,8 @@ def run_task(self): # {{{ plotControl = self.controlConfig is not None mainRunName = config.get('runs', 'mainRunName') - movingAverageMonths = config.getint('timeSeriesTransport', - 'movingAverageMonths') + movingAveragePoints = config.getint('timeSeriesTransport', + 'movingAveragePoints') self.logger.info(' Plotting...') @@ -651,7 +651,7 @@ def run_task(self): # {{{ fig = timeseries_analysis_plot(config, fields, calendar=calendar, title=title, xlabel=xLabel, ylabel=yLabel, - movingAveragePoints=movingAverageMonths, + movingAveragePoints=movingAveragePoints, lineColors=lineColors, lineWidths=lineWidths, legendText=legendText, diff --git a/mpas_analysis/polar_regions.cfg b/mpas_analysis/polar_regions.cfg index c8aa4abd3..df06f2371 100644 --- a/mpas_analysis/polar_regions.cfg +++ b/mpas_analysis/polar_regions.cfg @@ -347,9 +347,9 @@ regionNames = ["Southern Ocean 60S", "Weddell Sea Shelf", computeAnomaly = False # Number of points over which to compute moving average(e.g., for monthly -# output, movingAverageMonths=12 corresponds to a 12-month moving average +# output, movingAveragePoints=12 corresponds to a 12-month moving average # window) -movingAverageMonths = 12 +movingAveragePoints = 12 [hovmollerOceanRegionsPotentialTemperature] @@ -361,7 +361,7 @@ normArgsResult = {'vmin': -2., 'vmax': 3.} normArgsDifference = {'vmin': -2., 'vmax': 2.} # Number of months over which to compute moving average -movingAverageMonths = 12 +movingAveragePoints = 12 # limits on depth, the full range by default yLim = [-600., -5.] @@ -375,7 +375,7 @@ normArgsResult = {'vmin': 33., 'vmax': 35.} normArgsDifference = {'vmin': -0.5, 'vmax': 0.5} # Number of months over which to compute moving average -movingAverageMonths = 12 +movingAveragePoints = 12 # limits on depth, the full range by default yLim = [-600., -5.] @@ -390,7 +390,7 @@ normArgsResult = {'vmin': 1026.5, 'vmax': 1028.} normArgsDifference = {'vmin': -0.3, 'vmax': 0.3} # Number of months over which to compute moving average -movingAverageMonths = 12 +movingAveragePoints = 12 # limits on depth, the full range by default yLim = [-600., -5.] From 42c3d6804a89f469c856da75244de35f69fa0d5c Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Sun, 17 Apr 2022 11:23:37 -0500 Subject: [PATCH 13/40] Rename complete config file (.cfg extension) This is for consistency with other code --- mpas_analysis/shared/html/pages.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mpas_analysis/shared/html/pages.py b/mpas_analysis/shared/html/pages.py index 0d0c52441..4862fa198 100644 --- a/mpas_analysis/shared/html/pages.py +++ b/mpas_analysis/shared/html/pages.py @@ -253,7 +253,7 @@ def generate(self): configsText = configsText + \ _replace_tempate_text(self.configTemplate, replacements) - replacements = {'@configName': 'config.complete.{}'.format(runName), + replacements = {'@configName': 'complete.{}.cfg'.format(runName), '@configDesc': 'Complete Configuration File'} configsText = configsText + \ From 7a0a15bd9af3d4d8cb33d72935a2d7b6882a97fb Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Sun, 17 Apr 2022 18:31:05 +0200 Subject: [PATCH 14/40] Allow more than one user config file --- mpas_analysis/__main__.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/mpas_analysis/__main__.py b/mpas_analysis/__main__.py index 5d9c44d36..b429da1bc 100755 --- a/mpas_analysis/__main__.py +++ b/mpas_analysis/__main__.py @@ -822,12 +822,7 @@ def main(): shared_configs = config.list_files() - if len(args.config_file) > 0: - if len(args.config_file) > 1: - raise ValueError('Only one user config file is supported') - - user_config = args.config_file[0] - print(user_config) + for user_config in args.config_file: if not os.path.exists(user_config): raise OSError(f'Config file {user_config} not found.') From 75baa1c6b323157a4406777dc33ae7783cf7b964 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Mon, 18 Apr 2022 06:45:47 -0500 Subject: [PATCH 15/40] Skip python files when adding shared configs --- mpas_analysis/__main__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mpas_analysis/__main__.py b/mpas_analysis/__main__.py index b429da1bc..2bcca9d66 100755 --- a/mpas_analysis/__main__.py +++ b/mpas_analysis/__main__.py @@ -855,6 +855,9 @@ def main(): control_config = MpasConfigParser() for config_file in shared_configs: + if config_file.endswith('.py'): + # we'll skip config options set in python files + continue control_config.add_from_file(config_file) control_config.add_user_config(control_config_file) From 31ebb2e70e9136a12c881cb5f630678ce46d5360 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Wed, 20 Apr 2022 09:14:57 +0200 Subject: [PATCH 16/40] Update test suite to kill jobs with invalid deps On Anvil, the test suite has been leaving behind main vs. control jobs when the main job fails. With a flag (`--kill-on-ivalid-dep=yes`), this shouldn't happen anymore. --- suite/run_suite.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/suite/run_suite.bash b/suite/run_suite.bash index 67836c504..059324343 100755 --- a/suite/run_suite.bash +++ b/suite/run_suite.bash @@ -72,7 +72,7 @@ cd .. cd main_vs_ctrl echo main_vs_ctrl -sbatch --dependency=afterok:${RES##* } job_script.bash +sbatch --dependency=afterok:${RES##* } job_script.bash --kill-on-invalid-dep=yes cd .. for run in main_py${alt_py} wc_defaults no_ncclimo no_polar_regions \ From 8c8c2b4b14b94cfb7699b97605d67b030104fd41 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Wed, 20 Apr 2022 15:01:00 +0200 Subject: [PATCH 17/40] Add f90nml as a dependency --- ci/recipe/meta.yaml | 1 + dev-spec.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/ci/recipe/meta.yaml b/ci/recipe/meta.yaml index 676863695..d0399b258 100644 --- a/ci/recipe/meta.yaml +++ b/ci/recipe/meta.yaml @@ -27,6 +27,7 @@ requirements: - cartopy_offlinedata - cmocean - dask + - f90nml - geometric_features >=0.5.0 - gsw - lxml diff --git a/dev-spec.txt b/dev-spec.txt index c940e7a35..a6682137b 100644 --- a/dev-spec.txt +++ b/dev-spec.txt @@ -8,6 +8,7 @@ cartopy >=0.18.0 cartopy_offlinedata cmocean dask +f90nml geometric_features>=0.5.0 gsw lxml From 700b30f98b1838830932c567a0c52fe1ab05d57f Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Wed, 20 Apr 2022 15:01:10 +0200 Subject: [PATCH 18/40] Switch to using f90nml for reading namelists --- .../shared/io/namelist_streams_interface.py | 47 ++++++++++--------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/mpas_analysis/shared/io/namelist_streams_interface.py b/mpas_analysis/shared/io/namelist_streams_interface.py index ce16825f5..d3ffe8d17 100644 --- a/mpas_analysis/shared/io/namelist_streams_interface.py +++ b/mpas_analysis/shared/io/namelist_streams_interface.py @@ -24,6 +24,8 @@ from lxml import etree import re import os.path +import f90nml +import json from mpas_analysis.shared.containers import ReadOnlyDict from mpas_analysis.shared.io.utility import paths @@ -41,21 +43,25 @@ def convert_namelist_to_dict(fname, readonly=True): readonly : bool, optional Should the resulting dictionary read-only? + + Returns + ------- + nml : dict + A dictionary where keys are namelist options and values are namelist """ - # Authors - # ------- - # Phillip J Wolfram - - # form dictionary - nml = dict() - - regex = re.compile(r"^\s*(.*?)\s*=\s*['\"]*(.*?)['\"]*\s*\n") - with open(fname) as f: - for line in f: - match = regex.findall(line) - if len(match) > 0: - # assumes that there is only one match per line - nml[match[0][0].lower()] = match[0][1] + nml = f90nml.read(fname).todict() + + # convert ordered dict to dict (Python 3 dict is ordered) + # https://stackoverflow.com/a/27373027/7728169 + nml = json.loads(json.dumps(nml)) + + # flatten the dict + flat = dict() + for section in nml: + for key in nml[section]: + flat[key.lower()] = nml[section][key] + nml = flat + if readonly: nml = ReadOnlyDict(nml) @@ -124,7 +130,7 @@ def __getattr__(self, key): # provide accessor for dictionary notation (returns string) def __getitem__(self, key): """ - Accessor for bracket noation, e.g., nml['field'] + Accessor for bracket notation, e.g., nml['field'] Parameters ---------- @@ -133,7 +139,7 @@ def __getitem__(self, key): Returns ------- - value : str + value : Any The value associated with ``key`` """ # Authors @@ -155,7 +161,7 @@ def get(self, key): Returns ------- - value : str + value : Any The value associated with ``key`` """ # Authors @@ -222,10 +228,9 @@ def getbool(self, key): # ------- # Phillip Wolfram, Xylar Asay-Davis - if 'True' in self.nml[key.lower()] or 'true' in self.nml[key.lower()]: - return True - else: - return False + value = self.nml[key.lower()] + assert type(value) is bool + return value def find_option(self, possibleOptions): """ From b2aa78d658ab6ef0bc55139ca8952ee459e0cfbd Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Wed, 20 Apr 2022 17:16:12 +0200 Subject: [PATCH 19/40] Fix test --- .../test/test_namelist_streams_interface/namelist.ocean | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mpas_analysis/test/test_namelist_streams_interface/namelist.ocean b/mpas_analysis/test/test_namelist_streams_interface/namelist.ocean index 8867cdf5c..e51e9e314 100644 --- a/mpas_analysis/test/test_namelist_streams_interface/namelist.ocean +++ b/mpas_analysis/test/test_namelist_streams_interface/namelist.ocean @@ -1,4 +1,4 @@ -# note, some entires are not for illustration and not used in MPAS +# note, some entries are not for illustration and not used in MPAS &run_modes config_ocean_run_mode = 'forward' / @@ -32,3 +32,4 @@ &debug_checking_NOT_REAL config_test_extra_equals1 = 'a = b' config_test_extra_equals2 = "a = b" +/ From 4febd7d57e8f7c878770ac4c96d886e3e7ab663b Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Wed, 20 Apr 2022 20:51:26 +0200 Subject: [PATCH 20/40] Get rid of __future__ imports These are not needed in python 3 --- mpas_analysis/__main__.py | 3 --- mpas_analysis/analysis_task_template.py | 3 --- mpas_analysis/download_data.py | 3 --- mpas_analysis/obs/make_obs_readme_bibtex.py | 3 --- mpas_analysis/ocean/climatology_map_antarctic_melt.py | 3 --- mpas_analysis/ocean/climatology_map_bgc.py | 3 --- mpas_analysis/ocean/climatology_map_eke.py | 3 --- mpas_analysis/ocean/climatology_map_mld.py | 3 --- mpas_analysis/ocean/climatology_map_mld_min_max.py | 3 --- mpas_analysis/ocean/climatology_map_ohc_anomaly.py | 3 --- mpas_analysis/ocean/climatology_map_ssh.py | 3 --- mpas_analysis/ocean/climatology_map_sss.py | 3 --- mpas_analysis/ocean/climatology_map_sst.py | 3 --- mpas_analysis/ocean/compute_anomaly_subtask.py | 3 --- mpas_analysis/ocean/compute_transects_subtask.py | 3 --- mpas_analysis/ocean/compute_transects_with_vel_mag.py | 3 --- mpas_analysis/ocean/geojson_transects.py | 3 --- mpas_analysis/ocean/index_nino34.py | 3 --- mpas_analysis/ocean/meridional_heat_transport.py | 3 --- mpas_analysis/ocean/plot_climatology_map_subtask.py | 3 --- .../ocean/plot_depth_integrated_time_series_subtask.py | 3 --- mpas_analysis/ocean/plot_hovmoller_subtask.py | 3 --- mpas_analysis/ocean/plot_transect_subtask.py | 3 --- mpas_analysis/ocean/regional_ts_diagrams.py | 3 --- mpas_analysis/ocean/remap_depth_slices_subtask.py | 3 --- mpas_analysis/ocean/sose_transects.py | 3 --- mpas_analysis/ocean/streamfunction_moc.py | 3 --- mpas_analysis/ocean/time_series_antarctic_melt.py | 3 --- mpas_analysis/ocean/time_series_ocean_regions.py | 3 --- mpas_analysis/ocean/time_series_ohc_anomaly.py | 3 --- mpas_analysis/ocean/time_series_salinity_anomaly.py | 3 --- mpas_analysis/ocean/time_series_sst.py | 3 --- mpas_analysis/ocean/time_series_temperature_anomaly.py | 3 --- mpas_analysis/ocean/time_series_transport.py | 3 --- mpas_analysis/ocean/utility.py | 3 --- mpas_analysis/ocean/woce_transects.py | 3 --- mpas_analysis/sea_ice/climatology_map_berg_conc.py | 3 --- mpas_analysis/sea_ice/climatology_map_sea_ice_conc.py | 3 --- mpas_analysis/sea_ice/climatology_map_sea_ice_thick.py | 3 --- mpas_analysis/sea_ice/plot_climatology_map_subtask.py | 3 --- mpas_analysis/sea_ice/time_series.py | 3 --- mpas_analysis/shared/analysis_task.py | 3 --- mpas_analysis/shared/climatology/climatology.py | 3 --- mpas_analysis/shared/climatology/comparison_descriptors.py | 3 --- mpas_analysis/shared/climatology/mpas_climatology_task.py | 3 --- .../shared/climatology/ref_year_mpas_climatology_task.py | 3 --- .../shared/climatology/remap_mpas_climatology_subtask.py | 3 --- .../shared/climatology/remap_observed_climatology_subtask.py | 3 --- mpas_analysis/shared/constants/constants.py | 3 --- mpas_analysis/shared/containers.py | 3 --- mpas_analysis/shared/generalized_reader/generalized_reader.py | 3 --- mpas_analysis/shared/html/image_xml.py | 3 --- mpas_analysis/shared/html/pages.py | 3 --- mpas_analysis/shared/interpolation/interp_1d.py | 3 --- mpas_analysis/shared/interpolation/utility.py | 3 --- mpas_analysis/shared/io/download.py | 3 --- mpas_analysis/shared/io/mpas_reader.py | 3 --- mpas_analysis/shared/io/namelist_streams_interface.py | 3 --- mpas_analysis/shared/io/utility.py | 3 --- mpas_analysis/shared/io/write_netcdf.py | 3 --- mpas_analysis/shared/mpas_xarray/mpas_xarray.py | 3 --- mpas_analysis/shared/plot/climatology_map.py | 3 --- mpas_analysis/shared/plot/colormap.py | 3 --- mpas_analysis/shared/plot/inset.py | 3 --- mpas_analysis/shared/plot/oned.py | 3 --- mpas_analysis/shared/plot/save.py | 3 --- mpas_analysis/shared/plot/ticks.py | 3 --- mpas_analysis/shared/plot/time_series.py | 3 --- mpas_analysis/shared/plot/vertical_section.py | 3 --- mpas_analysis/shared/time_series/anomaly.py | 3 --- mpas_analysis/shared/time_series/moving_average.py | 3 --- mpas_analysis/shared/time_series/mpas_time_series_task.py | 3 --- mpas_analysis/shared/time_series/time_series.py | 3 --- mpas_analysis/shared/timekeeping/MpasRelativeDelta.py | 3 --- mpas_analysis/shared/timekeeping/utility.py | 3 --- .../shared/transects/compute_transect_masks_subtask.py | 3 --- mpas_analysis/test/__init__.py | 3 --- mpas_analysis/test/test_analysis_task.py | 3 --- mpas_analysis/test/test_climatology.py | 3 --- mpas_analysis/test/test_generalized_reader.py | 3 --- mpas_analysis/test/test_io_utility.py | 3 --- mpas_analysis/test/test_mpas_climatology_task.py | 3 --- mpas_analysis/test/test_mpas_xarray.py | 3 --- mpas_analysis/test/test_namelist_streams_interface.py | 3 --- mpas_analysis/test/test_open_mpas_dataset.py | 3 --- mpas_analysis/test/test_remap_obs_clim_subtask.py | 3 --- mpas_analysis/test/test_timekeeping.py | 3 --- 87 files changed, 261 deletions(-) diff --git a/mpas_analysis/__main__.py b/mpas_analysis/__main__.py index 2bcca9d66..13e29db0f 100755 --- a/mpas_analysis/__main__.py +++ b/mpas_analysis/__main__.py @@ -18,9 +18,6 @@ # ------- # Xylar Asay-Davis, Phillip J. Wolfram, Milena Veneziani -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import mpas_analysis import argparse diff --git a/mpas_analysis/analysis_task_template.py b/mpas_analysis/analysis_task_template.py index c025808ba..e3915c324 100644 --- a/mpas_analysis/analysis_task_template.py +++ b/mpas_analysis/analysis_task_template.py @@ -43,9 +43,6 @@ # ------- # Xylar Asay-Davis -from __future__ import absolute_import, division, print_function, \ - unicode_literals - # import python modules here import numpy import matplotlib.pyplot as plt diff --git a/mpas_analysis/download_data.py b/mpas_analysis/download_data.py index 6399f3336..76ed66501 100755 --- a/mpas_analysis/download_data.py +++ b/mpas_analysis/download_data.py @@ -17,9 +17,6 @@ # ------- # Xylar Asay-Davis, Phillip J. Wolfram, Milena Veneziani -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import argparse import pkg_resources diff --git a/mpas_analysis/obs/make_obs_readme_bibtex.py b/mpas_analysis/obs/make_obs_readme_bibtex.py index 393b7c801..6fc9741ce 100755 --- a/mpas_analysis/obs/make_obs_readme_bibtex.py +++ b/mpas_analysis/obs/make_obs_readme_bibtex.py @@ -18,9 +18,6 @@ Xylar Asay-Davis """ -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import xml.etree.ElementTree as ET import argparse import re diff --git a/mpas_analysis/ocean/climatology_map_antarctic_melt.py b/mpas_analysis/ocean/climatology_map_antarctic_melt.py index bf89ef932..d60801dbe 100644 --- a/mpas_analysis/ocean/climatology_map_antarctic_melt.py +++ b/mpas_analysis/ocean/climatology_map_antarctic_melt.py @@ -8,9 +8,6 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import os import csv import xarray as xr diff --git a/mpas_analysis/ocean/climatology_map_bgc.py b/mpas_analysis/ocean/climatology_map_bgc.py index 7b8cf93c3..ce106fc61 100644 --- a/mpas_analysis/ocean/climatology_map_bgc.py +++ b/mpas_analysis/ocean/climatology_map_bgc.py @@ -5,9 +5,6 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at http://mpas-dev.github.com/license.html # -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import xarray as xr from pyremap import LatLonGridDescriptor diff --git a/mpas_analysis/ocean/climatology_map_eke.py b/mpas_analysis/ocean/climatology_map_eke.py index 77580e79c..3e355c6f8 100644 --- a/mpas_analysis/ocean/climatology_map_eke.py +++ b/mpas_analysis/ocean/climatology_map_eke.py @@ -8,9 +8,6 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import xarray as xr from pyremap import LatLonGridDescriptor diff --git a/mpas_analysis/ocean/climatology_map_mld.py b/mpas_analysis/ocean/climatology_map_mld.py index 2b7c03276..f96c6cf9f 100644 --- a/mpas_analysis/ocean/climatology_map_mld.py +++ b/mpas_analysis/ocean/climatology_map_mld.py @@ -8,9 +8,6 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import xarray as xr import numpy as np from pyremap import LatLonGridDescriptor diff --git a/mpas_analysis/ocean/climatology_map_mld_min_max.py b/mpas_analysis/ocean/climatology_map_mld_min_max.py index a28ba461e..d4cc1b481 100644 --- a/mpas_analysis/ocean/climatology_map_mld_min_max.py +++ b/mpas_analysis/ocean/climatology_map_mld_min_max.py @@ -8,9 +8,6 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - from mpas_analysis.shared import AnalysisTask from mpas_analysis.shared.climatology import RemapMpasClimatologySubtask diff --git a/mpas_analysis/ocean/climatology_map_ohc_anomaly.py b/mpas_analysis/ocean/climatology_map_ohc_anomaly.py index 29337a895..b0dde5fd7 100644 --- a/mpas_analysis/ocean/climatology_map_ohc_anomaly.py +++ b/mpas_analysis/ocean/climatology_map_ohc_anomaly.py @@ -8,9 +8,6 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import xarray import numpy diff --git a/mpas_analysis/ocean/climatology_map_ssh.py b/mpas_analysis/ocean/climatology_map_ssh.py index f99526856..5f09e0f10 100644 --- a/mpas_analysis/ocean/climatology_map_ssh.py +++ b/mpas_analysis/ocean/climatology_map_ssh.py @@ -8,9 +8,6 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import xarray as xr from pyremap import LatLonGridDescriptor diff --git a/mpas_analysis/ocean/climatology_map_sss.py b/mpas_analysis/ocean/climatology_map_sss.py index 165c9b52c..7e508450d 100644 --- a/mpas_analysis/ocean/climatology_map_sss.py +++ b/mpas_analysis/ocean/climatology_map_sss.py @@ -8,9 +8,6 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import xarray as xr import datetime from pyremap import LatLonGridDescriptor diff --git a/mpas_analysis/ocean/climatology_map_sst.py b/mpas_analysis/ocean/climatology_map_sst.py index ee92fc785..afe20ef75 100644 --- a/mpas_analysis/ocean/climatology_map_sst.py +++ b/mpas_analysis/ocean/climatology_map_sst.py @@ -8,9 +8,6 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import xarray as xr import datetime diff --git a/mpas_analysis/ocean/compute_anomaly_subtask.py b/mpas_analysis/ocean/compute_anomaly_subtask.py index 5bce1dfba..2e6495aee 100644 --- a/mpas_analysis/ocean/compute_anomaly_subtask.py +++ b/mpas_analysis/ocean/compute_anomaly_subtask.py @@ -11,9 +11,6 @@ # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE # -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import os from mpas_analysis.shared import AnalysisTask diff --git a/mpas_analysis/ocean/compute_transects_subtask.py b/mpas_analysis/ocean/compute_transects_subtask.py index 6ba6c46d1..b33611f5e 100644 --- a/mpas_analysis/ocean/compute_transects_subtask.py +++ b/mpas_analysis/ocean/compute_transects_subtask.py @@ -8,9 +8,6 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import numpy import xarray as xr import os diff --git a/mpas_analysis/ocean/compute_transects_with_vel_mag.py b/mpas_analysis/ocean/compute_transects_with_vel_mag.py index e1bfc12e6..620e6060f 100644 --- a/mpas_analysis/ocean/compute_transects_with_vel_mag.py +++ b/mpas_analysis/ocean/compute_transects_with_vel_mag.py @@ -8,9 +8,6 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import numpy from mpas_analysis.ocean.compute_transects_subtask import \ diff --git a/mpas_analysis/ocean/geojson_transects.py b/mpas_analysis/ocean/geojson_transects.py index ccf3af2dd..2b4d7d139 100644 --- a/mpas_analysis/ocean/geojson_transects.py +++ b/mpas_analysis/ocean/geojson_transects.py @@ -8,9 +8,6 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - from collections import OrderedDict import json import xarray diff --git a/mpas_analysis/ocean/index_nino34.py b/mpas_analysis/ocean/index_nino34.py index a541bd9e1..a536869f6 100644 --- a/mpas_analysis/ocean/index_nino34.py +++ b/mpas_analysis/ocean/index_nino34.py @@ -11,9 +11,6 @@ # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE # -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import datetime import xarray as xr import pandas as pd diff --git a/mpas_analysis/ocean/meridional_heat_transport.py b/mpas_analysis/ocean/meridional_heat_transport.py index d38c24f17..a0c04c5cd 100644 --- a/mpas_analysis/ocean/meridional_heat_transport.py +++ b/mpas_analysis/ocean/meridional_heat_transport.py @@ -9,9 +9,6 @@ # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import xarray as xr import numpy as np import os diff --git a/mpas_analysis/ocean/plot_climatology_map_subtask.py b/mpas_analysis/ocean/plot_climatology_map_subtask.py index 502ac7975..6e905471d 100644 --- a/mpas_analysis/ocean/plot_climatology_map_subtask.py +++ b/mpas_analysis/ocean/plot_climatology_map_subtask.py @@ -16,9 +16,6 @@ # ------- # Luke Van Roekel, Xylar Asay-Davis, Milena Veneziani -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import xarray as xr import numpy as np diff --git a/mpas_analysis/ocean/plot_depth_integrated_time_series_subtask.py b/mpas_analysis/ocean/plot_depth_integrated_time_series_subtask.py index f7e5ced65..7d3f3a84d 100644 --- a/mpas_analysis/ocean/plot_depth_integrated_time_series_subtask.py +++ b/mpas_analysis/ocean/plot_depth_integrated_time_series_subtask.py @@ -11,9 +11,6 @@ # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE # -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import os import xarray diff --git a/mpas_analysis/ocean/plot_hovmoller_subtask.py b/mpas_analysis/ocean/plot_hovmoller_subtask.py index b18ff1306..47cacadcc 100644 --- a/mpas_analysis/ocean/plot_hovmoller_subtask.py +++ b/mpas_analysis/ocean/plot_hovmoller_subtask.py @@ -11,9 +11,6 @@ # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE # -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import xarray as xr import numpy as np import os diff --git a/mpas_analysis/ocean/plot_transect_subtask.py b/mpas_analysis/ocean/plot_transect_subtask.py index 133f9e016..aaf2518f3 100644 --- a/mpas_analysis/ocean/plot_transect_subtask.py +++ b/mpas_analysis/ocean/plot_transect_subtask.py @@ -16,9 +16,6 @@ # ------- # Xylar Asay-Davis, Greg Streletz -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import xarray as xr import numpy diff --git a/mpas_analysis/ocean/regional_ts_diagrams.py b/mpas_analysis/ocean/regional_ts_diagrams.py index 07de4d28b..168e0d06f 100644 --- a/mpas_analysis/ocean/regional_ts_diagrams.py +++ b/mpas_analysis/ocean/regional_ts_diagrams.py @@ -8,9 +8,6 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import os import xarray import numpy diff --git a/mpas_analysis/ocean/remap_depth_slices_subtask.py b/mpas_analysis/ocean/remap_depth_slices_subtask.py index f1cd082c7..66963c4da 100644 --- a/mpas_analysis/ocean/remap_depth_slices_subtask.py +++ b/mpas_analysis/ocean/remap_depth_slices_subtask.py @@ -8,9 +8,6 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import xarray as xr import numpy as np diff --git a/mpas_analysis/ocean/sose_transects.py b/mpas_analysis/ocean/sose_transects.py index 358edadb2..cef2efc4a 100644 --- a/mpas_analysis/ocean/sose_transects.py +++ b/mpas_analysis/ocean/sose_transects.py @@ -8,9 +8,6 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import xarray as xr import numpy import os diff --git a/mpas_analysis/ocean/streamfunction_moc.py b/mpas_analysis/ocean/streamfunction_moc.py index d390e4e5b..3106e2139 100644 --- a/mpas_analysis/ocean/streamfunction_moc.py +++ b/mpas_analysis/ocean/streamfunction_moc.py @@ -11,9 +11,6 @@ # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE # -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import xarray as xr import numpy as np import netCDF4 diff --git a/mpas_analysis/ocean/time_series_antarctic_melt.py b/mpas_analysis/ocean/time_series_antarctic_melt.py index 4f88c96a1..52437a075 100644 --- a/mpas_analysis/ocean/time_series_antarctic_melt.py +++ b/mpas_analysis/ocean/time_series_antarctic_melt.py @@ -8,9 +8,6 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import os import xarray import numpy diff --git a/mpas_analysis/ocean/time_series_ocean_regions.py b/mpas_analysis/ocean/time_series_ocean_regions.py index f6fed467a..1fe8ec4f0 100644 --- a/mpas_analysis/ocean/time_series_ocean_regions.py +++ b/mpas_analysis/ocean/time_series_ocean_regions.py @@ -8,9 +8,6 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import os import xarray import numpy diff --git a/mpas_analysis/ocean/time_series_ohc_anomaly.py b/mpas_analysis/ocean/time_series_ohc_anomaly.py index 4d2d01a74..f19b164b9 100644 --- a/mpas_analysis/ocean/time_series_ohc_anomaly.py +++ b/mpas_analysis/ocean/time_series_ohc_anomaly.py @@ -11,9 +11,6 @@ # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE # -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import xarray as xr import numpy import matplotlib.pyplot as plt diff --git a/mpas_analysis/ocean/time_series_salinity_anomaly.py b/mpas_analysis/ocean/time_series_salinity_anomaly.py index d87593824..0f5d85f75 100644 --- a/mpas_analysis/ocean/time_series_salinity_anomaly.py +++ b/mpas_analysis/ocean/time_series_salinity_anomaly.py @@ -11,9 +11,6 @@ # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE # -from __future__ import absolute_import, division, print_function, \ - unicode_literals - from mpas_analysis.shared import AnalysisTask from mpas_analysis.ocean.compute_anomaly_subtask import ComputeAnomalySubtask diff --git a/mpas_analysis/ocean/time_series_sst.py b/mpas_analysis/ocean/time_series_sst.py index f1f1c5e98..15d94edbc 100644 --- a/mpas_analysis/ocean/time_series_sst.py +++ b/mpas_analysis/ocean/time_series_sst.py @@ -9,9 +9,6 @@ # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - from mpas_analysis.shared import AnalysisTask from mpas_analysis.shared.plot import timeseries_analysis_plot, savefig diff --git a/mpas_analysis/ocean/time_series_temperature_anomaly.py b/mpas_analysis/ocean/time_series_temperature_anomaly.py index 281f6629f..fd583c20b 100644 --- a/mpas_analysis/ocean/time_series_temperature_anomaly.py +++ b/mpas_analysis/ocean/time_series_temperature_anomaly.py @@ -11,9 +11,6 @@ # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE # -from __future__ import absolute_import, division, print_function, \ - unicode_literals - from mpas_analysis.shared import AnalysisTask from mpas_analysis.ocean.compute_anomaly_subtask import ComputeAnomalySubtask diff --git a/mpas_analysis/ocean/time_series_transport.py b/mpas_analysis/ocean/time_series_transport.py index aa7462827..235f104b5 100644 --- a/mpas_analysis/ocean/time_series_transport.py +++ b/mpas_analysis/ocean/time_series_transport.py @@ -8,9 +8,6 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import os import xarray import numpy diff --git a/mpas_analysis/ocean/utility.py b/mpas_analysis/ocean/utility.py index 9d59b3643..890d27e2c 100644 --- a/mpas_analysis/ocean/utility.py +++ b/mpas_analysis/ocean/utility.py @@ -15,9 +15,6 @@ # ------- # Xylar Asay-Davis -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import numpy import xarray diff --git a/mpas_analysis/ocean/woce_transects.py b/mpas_analysis/ocean/woce_transects.py index a3c327328..dc9671128 100644 --- a/mpas_analysis/ocean/woce_transects.py +++ b/mpas_analysis/ocean/woce_transects.py @@ -8,9 +8,6 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - from mpas_analysis.shared import AnalysisTask from mpas_analysis.ocean.compute_transects_subtask import \ ComputeTransectsSubtask, TransectsObservations diff --git a/mpas_analysis/sea_ice/climatology_map_berg_conc.py b/mpas_analysis/sea_ice/climatology_map_berg_conc.py index 341758ab3..5d17d2548 100644 --- a/mpas_analysis/sea_ice/climatology_map_berg_conc.py +++ b/mpas_analysis/sea_ice/climatology_map_berg_conc.py @@ -6,9 +6,6 @@ # distributed with this code, or at http://mpas-dev.github.com/license.html # -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import xarray as xr from pyremap import LatLonGridDescriptor diff --git a/mpas_analysis/sea_ice/climatology_map_sea_ice_conc.py b/mpas_analysis/sea_ice/climatology_map_sea_ice_conc.py index 5881fe9ae..081dfd11e 100644 --- a/mpas_analysis/sea_ice/climatology_map_sea_ice_conc.py +++ b/mpas_analysis/sea_ice/climatology_map_sea_ice_conc.py @@ -9,9 +9,6 @@ # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import xarray as xr from pyremap import LatLonGridDescriptor diff --git a/mpas_analysis/sea_ice/climatology_map_sea_ice_thick.py b/mpas_analysis/sea_ice/climatology_map_sea_ice_thick.py index 72b2e3348..67c3fbec3 100644 --- a/mpas_analysis/sea_ice/climatology_map_sea_ice_thick.py +++ b/mpas_analysis/sea_ice/climatology_map_sea_ice_thick.py @@ -9,9 +9,6 @@ # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import xarray as xr from pyremap import LatLonGridDescriptor diff --git a/mpas_analysis/sea_ice/plot_climatology_map_subtask.py b/mpas_analysis/sea_ice/plot_climatology_map_subtask.py index 49bfd9ec8..468a5c124 100644 --- a/mpas_analysis/sea_ice/plot_climatology_map_subtask.py +++ b/mpas_analysis/sea_ice/plot_climatology_map_subtask.py @@ -9,9 +9,6 @@ # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import numpy.ma as ma import numpy as np diff --git a/mpas_analysis/sea_ice/time_series.py b/mpas_analysis/sea_ice/time_series.py index ce901b2fd..90fd79745 100644 --- a/mpas_analysis/sea_ice/time_series.py +++ b/mpas_analysis/sea_ice/time_series.py @@ -9,9 +9,6 @@ # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import xarray as xr from mpas_analysis.shared import AnalysisTask diff --git a/mpas_analysis/shared/analysis_task.py b/mpas_analysis/shared/analysis_task.py index 177a02971..b9815bc61 100644 --- a/mpas_analysis/shared/analysis_task.py +++ b/mpas_analysis/shared/analysis_task.py @@ -15,9 +15,6 @@ # ------- # Xylar Asay-Davis -from __future__ import absolute_import, division, print_function, \ - unicode_literals - from multiprocessing import Process, Value import time import traceback diff --git a/mpas_analysis/shared/climatology/climatology.py b/mpas_analysis/shared/climatology/climatology.py index fab7442d9..9fcd50ddd 100644 --- a/mpas_analysis/shared/climatology/climatology.py +++ b/mpas_analysis/shared/climatology/climatology.py @@ -15,9 +15,6 @@ # ------- # Xylar Asay-Davis -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import xarray as xr import os import numpy diff --git a/mpas_analysis/shared/climatology/comparison_descriptors.py b/mpas_analysis/shared/climatology/comparison_descriptors.py index 7697d1775..4f6df6268 100644 --- a/mpas_analysis/shared/climatology/comparison_descriptors.py +++ b/mpas_analysis/shared/climatology/comparison_descriptors.py @@ -15,9 +15,6 @@ # ------- # Xylar Asay-Davis -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import numpy from mpas_analysis.shared.constants import constants diff --git a/mpas_analysis/shared/climatology/mpas_climatology_task.py b/mpas_analysis/shared/climatology/mpas_climatology_task.py index 36f1b173d..b17db90ee 100644 --- a/mpas_analysis/shared/climatology/mpas_climatology_task.py +++ b/mpas_analysis/shared/climatology/mpas_climatology_task.py @@ -9,9 +9,6 @@ # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import xarray import os import subprocess diff --git a/mpas_analysis/shared/climatology/ref_year_mpas_climatology_task.py b/mpas_analysis/shared/climatology/ref_year_mpas_climatology_task.py index d834e250d..b8b0fb679 100644 --- a/mpas_analysis/shared/climatology/ref_year_mpas_climatology_task.py +++ b/mpas_analysis/shared/climatology/ref_year_mpas_climatology_task.py @@ -9,9 +9,6 @@ # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - from six import StringIO from mpas_tools.config import MpasConfigParser diff --git a/mpas_analysis/shared/climatology/remap_mpas_climatology_subtask.py b/mpas_analysis/shared/climatology/remap_mpas_climatology_subtask.py index a793abdf2..5a01a8d60 100644 --- a/mpas_analysis/shared/climatology/remap_mpas_climatology_subtask.py +++ b/mpas_analysis/shared/climatology/remap_mpas_climatology_subtask.py @@ -9,9 +9,6 @@ # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import xarray as xr import numpy import os diff --git a/mpas_analysis/shared/climatology/remap_observed_climatology_subtask.py b/mpas_analysis/shared/climatology/remap_observed_climatology_subtask.py index abe28f820..470eff12c 100644 --- a/mpas_analysis/shared/climatology/remap_observed_climatology_subtask.py +++ b/mpas_analysis/shared/climatology/remap_observed_climatology_subtask.py @@ -8,9 +8,6 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import os import os.path import xarray as xr diff --git a/mpas_analysis/shared/constants/constants.py b/mpas_analysis/shared/constants/constants.py index 3792adad5..6626d3df0 100644 --- a/mpas_analysis/shared/constants/constants.py +++ b/mpas_analysis/shared/constants/constants.py @@ -15,9 +15,6 @@ # ------- # Luke Van Roekel, Xylar Asay-Davis, Milena Veneziani -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import numpy as np # set parameters for default climatology comparison grid diff --git a/mpas_analysis/shared/containers.py b/mpas_analysis/shared/containers.py index f7c7ea87d..6ba6ece8d 100644 --- a/mpas_analysis/shared/containers.py +++ b/mpas_analysis/shared/containers.py @@ -16,9 +16,6 @@ 10/22/2016 """ -from __future__ import absolute_import, division, print_function, \ - unicode_literals - from collections.abc import Mapping diff --git a/mpas_analysis/shared/generalized_reader/generalized_reader.py b/mpas_analysis/shared/generalized_reader/generalized_reader.py index 1507d9cc7..1cc48dd20 100644 --- a/mpas_analysis/shared/generalized_reader/generalized_reader.py +++ b/mpas_analysis/shared/generalized_reader/generalized_reader.py @@ -22,9 +22,6 @@ # ------- # Xylar Asay-Davis -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import six import xarray from functools import partial diff --git a/mpas_analysis/shared/html/image_xml.py b/mpas_analysis/shared/html/image_xml.py index f0810f48c..ffb5b3392 100644 --- a/mpas_analysis/shared/html/image_xml.py +++ b/mpas_analysis/shared/html/image_xml.py @@ -9,9 +9,6 @@ # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import os import sys import socket diff --git a/mpas_analysis/shared/html/pages.py b/mpas_analysis/shared/html/pages.py index 4862fa198..87784b492 100644 --- a/mpas_analysis/shared/html/pages.py +++ b/mpas_analysis/shared/html/pages.py @@ -9,9 +9,6 @@ # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import pkg_resources from os import makedirs from lxml import etree diff --git a/mpas_analysis/shared/interpolation/interp_1d.py b/mpas_analysis/shared/interpolation/interp_1d.py index 7cbd8e370..2b37d8098 100644 --- a/mpas_analysis/shared/interpolation/interp_1d.py +++ b/mpas_analysis/shared/interpolation/interp_1d.py @@ -8,9 +8,6 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import numpy import xarray diff --git a/mpas_analysis/shared/interpolation/utility.py b/mpas_analysis/shared/interpolation/utility.py index 315befa6a..fca84df2f 100644 --- a/mpas_analysis/shared/interpolation/utility.py +++ b/mpas_analysis/shared/interpolation/utility.py @@ -9,9 +9,6 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import numpy import xarray diff --git a/mpas_analysis/shared/io/download.py b/mpas_analysis/shared/io/download.py index 0da45a91d..713f754b0 100644 --- a/mpas_analysis/shared/io/download.py +++ b/mpas_analysis/shared/io/download.py @@ -18,9 +18,6 @@ # Milena Veneziani # Xylar Asay-Davis -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import os import requests diff --git a/mpas_analysis/shared/io/mpas_reader.py b/mpas_analysis/shared/io/mpas_reader.py index 89535f904..42857f5c3 100644 --- a/mpas_analysis/shared/io/mpas_reader.py +++ b/mpas_analysis/shared/io/mpas_reader.py @@ -16,9 +16,6 @@ # ------- # Xylar Asay-Davis -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import six import xarray diff --git a/mpas_analysis/shared/io/namelist_streams_interface.py b/mpas_analysis/shared/io/namelist_streams_interface.py index d3ffe8d17..e38cb01d0 100644 --- a/mpas_analysis/shared/io/namelist_streams_interface.py +++ b/mpas_analysis/shared/io/namelist_streams_interface.py @@ -17,9 +17,6 @@ # ------- # Phillip Wolfram, Xylar Asay-Davis -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import six from lxml import etree import re diff --git a/mpas_analysis/shared/io/utility.py b/mpas_analysis/shared/io/utility.py index 85870d075..6c5a3d0d2 100644 --- a/mpas_analysis/shared/io/utility.py +++ b/mpas_analysis/shared/io/utility.py @@ -14,9 +14,6 @@ Phillip J. Wolfram, Xylar Asay-Davis """ -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import glob import os import random diff --git a/mpas_analysis/shared/io/write_netcdf.py b/mpas_analysis/shared/io/write_netcdf.py index 3fed4b832..a859fbd91 100644 --- a/mpas_analysis/shared/io/write_netcdf.py +++ b/mpas_analysis/shared/io/write_netcdf.py @@ -8,9 +8,6 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import netCDF4 import numpy diff --git a/mpas_analysis/shared/mpas_xarray/mpas_xarray.py b/mpas_analysis/shared/mpas_xarray/mpas_xarray.py index a8a0c622d..605936397 100644 --- a/mpas_analysis/shared/mpas_xarray/mpas_xarray.py +++ b/mpas_analysis/shared/mpas_xarray/mpas_xarray.py @@ -9,9 +9,6 @@ # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import numpy as np import six import xarray diff --git a/mpas_analysis/shared/plot/climatology_map.py b/mpas_analysis/shared/plot/climatology_map.py index 101fbc382..db70b0502 100644 --- a/mpas_analysis/shared/plot/climatology_map.py +++ b/mpas_analysis/shared/plot/climatology_map.py @@ -16,9 +16,6 @@ # ------- # Xylar Asay-Davis, Milena Veneziani, Luke Van Roekel, Greg Streletz -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import matplotlib import matplotlib.pyplot as plt import matplotlib.colors as cols diff --git a/mpas_analysis/shared/plot/colormap.py b/mpas_analysis/shared/plot/colormap.py index 5222855fa..b1673a67d 100644 --- a/mpas_analysis/shared/plot/colormap.py +++ b/mpas_analysis/shared/plot/colormap.py @@ -15,9 +15,6 @@ # ------- # Xylar Asay-Davis, Milena Veneziani, Luke Van Roekel, Greg Streletz -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import matplotlib.pyplot as plt import matplotlib.colors as cols import numpy as np diff --git a/mpas_analysis/shared/plot/inset.py b/mpas_analysis/shared/plot/inset.py index aed9cef60..5906387b6 100644 --- a/mpas_analysis/shared/plot/inset.py +++ b/mpas_analysis/shared/plot/inset.py @@ -15,9 +15,6 @@ # ------- # Xylar Asay-Davis -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import matplotlib.path import matplotlib.ticker as mticker import cartopy diff --git a/mpas_analysis/shared/plot/oned.py b/mpas_analysis/shared/plot/oned.py index 6c9e21462..a88a0cad3 100644 --- a/mpas_analysis/shared/plot/oned.py +++ b/mpas_analysis/shared/plot/oned.py @@ -19,9 +19,6 @@ # ------- # Xylar Asay-Davis, Milena Veneziani, Luke Van Roekel, Greg Streletz -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import matplotlib import matplotlib.pyplot as plt diff --git a/mpas_analysis/shared/plot/save.py b/mpas_analysis/shared/plot/save.py index bc6ac00c7..017669a76 100644 --- a/mpas_analysis/shared/plot/save.py +++ b/mpas_analysis/shared/plot/save.py @@ -9,9 +9,6 @@ # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import os import matplotlib.pyplot as plt diff --git a/mpas_analysis/shared/plot/ticks.py b/mpas_analysis/shared/plot/ticks.py index 1c86e4de5..801cc9dbf 100644 --- a/mpas_analysis/shared/plot/ticks.py +++ b/mpas_analysis/shared/plot/ticks.py @@ -12,9 +12,6 @@ # ------- # Xylar Asay-Davis, Milena Veneziani, Luke Van Roekel, Greg Streletz -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import matplotlib.pyplot as plt from matplotlib.ticker import FuncFormatter, FixedLocator import numpy as np diff --git a/mpas_analysis/shared/plot/time_series.py b/mpas_analysis/shared/plot/time_series.py index ef36ff1b3..c8c3530cd 100644 --- a/mpas_analysis/shared/plot/time_series.py +++ b/mpas_analysis/shared/plot/time_series.py @@ -15,9 +15,6 @@ # ------- # Xylar Asay-Davis, Milena Veneziani, Luke Van Roekel, Greg Streletz -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import matplotlib import matplotlib.pyplot as plt import xarray as xr diff --git a/mpas_analysis/shared/plot/vertical_section.py b/mpas_analysis/shared/plot/vertical_section.py index 6597c420b..f4646dd6a 100644 --- a/mpas_analysis/shared/plot/vertical_section.py +++ b/mpas_analysis/shared/plot/vertical_section.py @@ -16,9 +16,6 @@ # ------- # Xylar Asay-Davis, Milena Veneziani, Luke Van Roekel, Greg Streletz -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import matplotlib import matplotlib.pyplot as plt from matplotlib.tri import Triangulation diff --git a/mpas_analysis/shared/time_series/anomaly.py b/mpas_analysis/shared/time_series/anomaly.py index 21411ccc6..abcb63caf 100644 --- a/mpas_analysis/shared/time_series/anomaly.py +++ b/mpas_analysis/shared/time_series/anomaly.py @@ -11,9 +11,6 @@ # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE # -from __future__ import absolute_import, division, print_function, \ - unicode_literals - from mpas_analysis.shared.io import open_mpas_dataset from mpas_analysis.shared.time_series.moving_average import compute_moving_avg diff --git a/mpas_analysis/shared/time_series/moving_average.py b/mpas_analysis/shared/time_series/moving_average.py index e8a7da62b..f7569c6ae 100644 --- a/mpas_analysis/shared/time_series/moving_average.py +++ b/mpas_analysis/shared/time_series/moving_average.py @@ -11,9 +11,6 @@ # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE # -from __future__ import absolute_import, division, print_function, \ - unicode_literals - def compute_moving_avg(ds, movingAveragePoints=12): # {{{ ''' diff --git a/mpas_analysis/shared/time_series/mpas_time_series_task.py b/mpas_analysis/shared/time_series/mpas_time_series_task.py index 9867a25af..9626f1449 100644 --- a/mpas_analysis/shared/time_series/mpas_time_series_task.py +++ b/mpas_analysis/shared/time_series/mpas_time_series_task.py @@ -9,9 +9,6 @@ # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import os import subprocess from distutils.spawn import find_executable diff --git a/mpas_analysis/shared/time_series/time_series.py b/mpas_analysis/shared/time_series/time_series.py index 4546811e6..0e8f70c17 100644 --- a/mpas_analysis/shared/time_series/time_series.py +++ b/mpas_analysis/shared/time_series/time_series.py @@ -15,9 +15,6 @@ # ------- # Xylar Asay-Davis -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import xarray as xr import numpy import os diff --git a/mpas_analysis/shared/timekeeping/MpasRelativeDelta.py b/mpas_analysis/shared/timekeeping/MpasRelativeDelta.py index 3be676a5c..a72a96542 100644 --- a/mpas_analysis/shared/timekeeping/MpasRelativeDelta.py +++ b/mpas_analysis/shared/timekeeping/MpasRelativeDelta.py @@ -9,9 +9,6 @@ # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import datetime from dateutil.relativedelta import relativedelta from calendar import monthrange, isleap diff --git a/mpas_analysis/shared/timekeeping/utility.py b/mpas_analysis/shared/timekeeping/utility.py index 172637c48..ca3e38220 100644 --- a/mpas_analysis/shared/timekeeping/utility.py +++ b/mpas_analysis/shared/timekeeping/utility.py @@ -15,9 +15,6 @@ # ------- # Xylar Asay-Davis -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import datetime import netCDF4 import xarray diff --git a/mpas_analysis/shared/transects/compute_transect_masks_subtask.py b/mpas_analysis/shared/transects/compute_transect_masks_subtask.py index 7f6560e1b..4a9f1babf 100644 --- a/mpas_analysis/shared/transects/compute_transect_masks_subtask.py +++ b/mpas_analysis/shared/transects/compute_transect_masks_subtask.py @@ -9,9 +9,6 @@ # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import os import xarray as xr diff --git a/mpas_analysis/test/__init__.py b/mpas_analysis/test/__init__.py index bdd789373..8d116ac95 100644 --- a/mpas_analysis/test/__init__.py +++ b/mpas_analysis/test/__init__.py @@ -5,9 +5,6 @@ 04/06/2017 """ -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import warnings from contextlib import contextmanager diff --git a/mpas_analysis/test/test_analysis_task.py b/mpas_analysis/test/test_analysis_task.py index 83142e8e0..33bbf8b44 100644 --- a/mpas_analysis/test/test_analysis_task.py +++ b/mpas_analysis/test/test_analysis_task.py @@ -14,9 +14,6 @@ Xylar Asay-Davis """ -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import pytest from mpas_tools.config import MpasConfigParser diff --git a/mpas_analysis/test/test_climatology.py b/mpas_analysis/test/test_climatology.py index e7391d168..b9a9e12cc 100644 --- a/mpas_analysis/test/test_climatology.py +++ b/mpas_analysis/test/test_climatology.py @@ -15,9 +15,6 @@ 04/11/2017 """ -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import pytest import tempfile import shutil diff --git a/mpas_analysis/test/test_generalized_reader.py b/mpas_analysis/test/test_generalized_reader.py index ca8835301..99c3953dc 100644 --- a/mpas_analysis/test/test_generalized_reader.py +++ b/mpas_analysis/test/test_generalized_reader.py @@ -15,9 +15,6 @@ 02/16/2017 """ -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import numpy import pytest diff --git a/mpas_analysis/test/test_io_utility.py b/mpas_analysis/test/test_io_utility.py index 3b1ddf63c..9628864c1 100644 --- a/mpas_analysis/test/test_io_utility.py +++ b/mpas_analysis/test/test_io_utility.py @@ -15,9 +15,6 @@ 10/07/2016 """ -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import os import pytest from mpas_analysis.test import TestCase, loaddatadir diff --git a/mpas_analysis/test/test_mpas_climatology_task.py b/mpas_analysis/test/test_mpas_climatology_task.py index 703168ce2..ee6864f64 100644 --- a/mpas_analysis/test/test_mpas_climatology_task.py +++ b/mpas_analysis/test/test_mpas_climatology_task.py @@ -14,9 +14,6 @@ Xylar Asay-Davis """ -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import pytest import tempfile import shutil diff --git a/mpas_analysis/test/test_mpas_xarray.py b/mpas_analysis/test/test_mpas_xarray.py index 0b911b237..9ecbd941a 100644 --- a/mpas_analysis/test/test_mpas_xarray.py +++ b/mpas_analysis/test/test_mpas_xarray.py @@ -15,9 +15,6 @@ 02/15/2017 """ -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import numpy import six diff --git a/mpas_analysis/test/test_namelist_streams_interface.py b/mpas_analysis/test/test_namelist_streams_interface.py index 3e4f6fedc..1bbc5147a 100644 --- a/mpas_analysis/test/test_namelist_streams_interface.py +++ b/mpas_analysis/test/test_namelist_streams_interface.py @@ -16,9 +16,6 @@ 10/26/2016 """ -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import pytest from mpas_analysis.test import TestCase, loaddatadir from mpas_analysis.shared.io import NameList, StreamsFile diff --git a/mpas_analysis/test/test_open_mpas_dataset.py b/mpas_analysis/test/test_open_mpas_dataset.py index 3e6234039..7ebd437c3 100644 --- a/mpas_analysis/test/test_open_mpas_dataset.py +++ b/mpas_analysis/test/test_open_mpas_dataset.py @@ -15,9 +15,6 @@ 02/16/2017 """ -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import pytest from mpas_analysis.test import TestCase, loaddatadir from mpas_analysis.shared.io import open_mpas_dataset diff --git a/mpas_analysis/test/test_remap_obs_clim_subtask.py b/mpas_analysis/test/test_remap_obs_clim_subtask.py index dede3ae77..f0b2a102a 100644 --- a/mpas_analysis/test/test_remap_obs_clim_subtask.py +++ b/mpas_analysis/test/test_remap_obs_clim_subtask.py @@ -14,9 +14,6 @@ Xylar Asay-Davis """ -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import pytest import tempfile import shutil diff --git a/mpas_analysis/test/test_timekeeping.py b/mpas_analysis/test/test_timekeeping.py index 151173fab..941f67dba 100644 --- a/mpas_analysis/test/test_timekeeping.py +++ b/mpas_analysis/test/test_timekeeping.py @@ -15,9 +15,6 @@ # ------- # Xylar Asay-Davis -from __future__ import absolute_import, division, print_function, \ - unicode_literals - import pytest import datetime import six From 2162a5749a3322d04e225654d7b978064dc1c782 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Wed, 20 Apr 2022 21:00:00 +0200 Subject: [PATCH 21/40] Get rid of `six`, no longer needed with python 3 --- ci/recipe/meta.yaml | 1 - dev-spec.txt | 1 - .../climatology/ref_year_mpas_climatology_task.py | 2 +- .../shared/generalized_reader/generalized_reader.py | 5 ++--- mpas_analysis/shared/io/mpas_reader.py | 5 ++--- mpas_analysis/shared/io/namelist_streams_interface.py | 5 ++--- mpas_analysis/shared/io/write_netcdf.py | 4 +--- mpas_analysis/shared/mpas_xarray/mpas_xarray.py | 3 +-- mpas_analysis/shared/plot/colormap.py | 5 ++--- mpas_analysis/shared/time_series/time_series.py | 3 +-- mpas_analysis/shared/timekeeping/utility.py | 3 +-- mpas_analysis/test/test_mpas_xarray.py | 11 +++++------ mpas_analysis/test/test_timekeeping.py | 7 +++---- 13 files changed, 21 insertions(+), 34 deletions(-) diff --git a/ci/recipe/meta.yaml b/ci/recipe/meta.yaml index d0399b258..04daeceaa 100644 --- a/ci/recipe/meta.yaml +++ b/ci/recipe/meta.yaml @@ -47,7 +47,6 @@ requirements: - scipy - setuptools - shapely - - six - xarray >=0.14.1 test: diff --git a/dev-spec.txt b/dev-spec.txt index a6682137b..d731881eb 100644 --- a/dev-spec.txt +++ b/dev-spec.txt @@ -28,7 +28,6 @@ requests scipy setuptools shapely -six xarray>=0.14.1 # Development diff --git a/mpas_analysis/shared/climatology/ref_year_mpas_climatology_task.py b/mpas_analysis/shared/climatology/ref_year_mpas_climatology_task.py index b8b0fb679..ee6cb1bed 100644 --- a/mpas_analysis/shared/climatology/ref_year_mpas_climatology_task.py +++ b/mpas_analysis/shared/climatology/ref_year_mpas_climatology_task.py @@ -9,7 +9,7 @@ # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -from six import StringIO +from io import StringIO from mpas_tools.config import MpasConfigParser diff --git a/mpas_analysis/shared/generalized_reader/generalized_reader.py b/mpas_analysis/shared/generalized_reader/generalized_reader.py index 1cc48dd20..6779cb704 100644 --- a/mpas_analysis/shared/generalized_reader/generalized_reader.py +++ b/mpas_analysis/shared/generalized_reader/generalized_reader.py @@ -22,7 +22,6 @@ # ------- # Xylar Asay-Davis -import six import xarray from functools import partial import resource @@ -148,10 +147,10 @@ def open_multifile_dataset(fileNames, calendar, config, ds = mpas_xarray.remove_repeated_time_index(ds) if startDate is not None and endDate is not None: - if isinstance(startDate, six.string_types): + if isinstance(startDate, str): startDate = string_to_days_since_date(dateString=startDate, calendar=calendar) - if isinstance(endDate, six.string_types): + if isinstance(endDate, str): endDate = string_to_days_since_date(dateString=endDate, calendar=calendar) diff --git a/mpas_analysis/shared/io/mpas_reader.py b/mpas_analysis/shared/io/mpas_reader.py index 42857f5c3..010a81892 100644 --- a/mpas_analysis/shared/io/mpas_reader.py +++ b/mpas_analysis/shared/io/mpas_reader.py @@ -16,7 +16,6 @@ # ------- # Xylar Asay-Davis -import six import xarray from mpas_analysis.shared.timekeeping.utility import \ @@ -75,10 +74,10 @@ def open_mpas_dataset(fileName, calendar, ds = _parse_dataset_time(ds, timeVariableNames, calendar) if startDate is not None and endDate is not None: - if isinstance(startDate, six.string_types): + if isinstance(startDate, str): startDate = string_to_days_since_date(dateString=startDate, calendar=calendar) - if isinstance(endDate, six.string_types): + if isinstance(endDate, str): endDate = string_to_days_since_date(dateString=endDate, calendar=calendar) diff --git a/mpas_analysis/shared/io/namelist_streams_interface.py b/mpas_analysis/shared/io/namelist_streams_interface.py index e38cb01d0..d7a441b91 100644 --- a/mpas_analysis/shared/io/namelist_streams_interface.py +++ b/mpas_analysis/shared/io/namelist_streams_interface.py @@ -17,7 +17,6 @@ # ------- # Phillip Wolfram, Xylar Asay-Davis -import six from lxml import etree import re import os.path @@ -442,12 +441,12 @@ def readpath(self, streamName, startDate=None, endDate=None, if startDate is not None: # read one extra file before the start date to be on the safe side - if isinstance(startDate, six.string_types): + if isinstance(startDate, str): startDate = string_to_datetime(startDate) if endDate is not None: # read one extra file after the end date to be on the safe side - if isinstance(endDate, six.string_types): + if isinstance(endDate, str): endDate = string_to_datetime(endDate) # remove any path that's part of the template diff --git a/mpas_analysis/shared/io/write_netcdf.py b/mpas_analysis/shared/io/write_netcdf.py index a859fbd91..b885c5f00 100644 --- a/mpas_analysis/shared/io/write_netcdf.py +++ b/mpas_analysis/shared/io/write_netcdf.py @@ -11,8 +11,6 @@ import netCDF4 import numpy -import six - def write_netcdf(ds, fileName, fillValues=netCDF4.default_fillvals): # {{{ ''' @@ -50,7 +48,7 @@ def write_netcdf(ds, fileName, fillValues=netCDF4.default_fillvals): # {{{ # make strings write as unicode instead if dtype.type is numpy.string_: - encodingDict[variableName] = {'dtype': six.text_type} + encodingDict[variableName] = {'dtype': str} ds.to_netcdf(fileName, encoding=encodingDict) diff --git a/mpas_analysis/shared/mpas_xarray/mpas_xarray.py b/mpas_analysis/shared/mpas_xarray/mpas_xarray.py index 605936397..d5c936fb3 100644 --- a/mpas_analysis/shared/mpas_xarray/mpas_xarray.py +++ b/mpas_analysis/shared/mpas_xarray/mpas_xarray.py @@ -10,7 +10,6 @@ # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE import numpy as np -import six import xarray from functools import partial @@ -344,7 +343,7 @@ def _ensure_list(alist): # {{{ # ------- # Phillip J. Wolfram, Xylar Asay-Davis - if isinstance(alist, six.string_types): + if isinstance(alist, str): # print 'Warning, converting %s to a list'%(alist) alist = [alist] diff --git a/mpas_analysis/shared/plot/colormap.py b/mpas_analysis/shared/plot/colormap.py index b1673a67d..33b9fc4b2 100644 --- a/mpas_analysis/shared/plot/colormap.py +++ b/mpas_analysis/shared/plot/colormap.py @@ -20,10 +20,9 @@ import numpy as np from matplotlib.colors import LinearSegmentedColormap import xml.etree.ElementTree as ET -from six.moves import configparser +import configparser import cmocean import pkg_resources -from six import string_types def setup_colormap(config, configSectionName, suffix=''): @@ -88,7 +87,7 @@ def setup_colormap(config, configSectionName, suffix=''): contours = config.getexpression(configSectionName, option, use_numpyfunc=True) - if isinstance(contours, string_types) and contours == 'none': + if isinstance(contours, str) and contours == 'none': contours = None else: contours = None diff --git a/mpas_analysis/shared/time_series/time_series.py b/mpas_analysis/shared/time_series/time_series.py index 0e8f70c17..9eb94ac9c 100644 --- a/mpas_analysis/shared/time_series/time_series.py +++ b/mpas_analysis/shared/time_series/time_series.py @@ -21,7 +21,6 @@ from distutils.spawn import find_executable import glob import subprocess -from six import string_types from mpas_analysis.shared.timekeeping.utility import days_to_datetime @@ -65,7 +64,7 @@ def combine_time_series_with_ncrcat(inFileNames, outFileName, if os.path.exists(outFileName): return - if isinstance(inFileNames, string_types): + if isinstance(inFileNames, str): inFileNames = sorted(glob.glob(inFileNames)) args = ['ncrcat', '-4', '--record_append', '--no_tmp_fl'] diff --git a/mpas_analysis/shared/timekeeping/utility.py b/mpas_analysis/shared/timekeeping/utility.py index ca3e38220..227266d82 100644 --- a/mpas_analysis/shared/timekeeping/utility.py +++ b/mpas_analysis/shared/timekeeping/utility.py @@ -19,7 +19,6 @@ import netCDF4 import xarray import numpy -import six from mpas_analysis.shared.timekeeping.MpasRelativeDelta import \ MpasRelativeDelta @@ -215,7 +214,7 @@ def string_to_days_since_date(dateString, calendar='gregorian', # ------- # Xylar Asay-Davis - isSingleString = isinstance(dateString, six.string_types) + isSingleString = isinstance(dateString, str) if isSingleString: dateString = [dateString] diff --git a/mpas_analysis/test/test_mpas_xarray.py b/mpas_analysis/test/test_mpas_xarray.py index 9ecbd941a..908fcb29c 100644 --- a/mpas_analysis/test/test_mpas_xarray.py +++ b/mpas_analysis/test/test_mpas_xarray.py @@ -16,7 +16,6 @@ """ import numpy -import six import pytest from mpas_analysis.test import TestCase, loaddatadir @@ -54,8 +53,8 @@ def test_subset_variables(self): variableList=variableList) self.assertEqual(list(ds.data_vars.keys()), variableList) - with six.assertRaisesRegex(self, ValueError, - 'Empty dataset is returned.'): + with self.assertRaisesRegex(ValueError, + 'Empty dataset is returned.'): missingvars = ['foo', 'bar'] ds = mpas_xarray.open_multifile_dataset(fileNames=fileName, calendar=calendar, @@ -126,9 +125,9 @@ def test_bad_selvals(self): 'refBottomDepth'] selvals = {'refBottomDepth': 8.77999997138977} - with six.assertRaisesRegex(self, AssertionError, - 'not a dimension in the dataset that ' - 'can be used for selection'): + with self.assertRaisesRegex(AssertionError, + 'not a dimension in the dataset that ' + 'can be used for selection'): mpas_xarray.open_multifile_dataset( fileNames=fileName, calendar=calendar, diff --git a/mpas_analysis/test/test_timekeeping.py b/mpas_analysis/test/test_timekeeping.py index 941f67dba..5cb442568 100644 --- a/mpas_analysis/test/test_timekeeping.py +++ b/mpas_analysis/test/test_timekeeping.py @@ -17,7 +17,6 @@ import pytest import datetime -import six from mpas_analysis.shared.timekeeping.MpasRelativeDelta \ import MpasRelativeDelta from mpas_analysis.test import TestCase @@ -202,9 +201,9 @@ def test_MpasRelativeDeltaOps(self): # make sure there's an error when we try to add MpasRelativeDeltas # with different calendars - with six.assertRaisesRegex(self, ValueError, - 'MpasRelativeDelta objects can only be ' - 'added if their calendars match.'): + with self.assertRaisesRegex(ValueError, + 'MpasRelativeDelta objects can only be ' + 'added if their calendars match.'): delta1 = string_to_relative_delta('0000-01-00', calendar='gregorian') delta2 = string_to_relative_delta('0000-00-01', From 5ef3cfbf73a54e945a0e75f408469101aacbbc78 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Wed, 20 Apr 2022 21:35:20 +0200 Subject: [PATCH 22/40] Remove folds --- mpas_analysis/__main__.py | 28 ++-- mpas_analysis/analysis_task_template.py | 26 ++-- mpas_analysis/download_data.py | 2 - .../ocean/climatology_map_antarctic_melt.py | 44 ++----- mpas_analysis/ocean/climatology_map_argo.py | 33 ++--- mpas_analysis/ocean/climatology_map_bgc.py | 35 ++--- mpas_analysis/ocean/climatology_map_eke.py | 28 ++-- mpas_analysis/ocean/climatology_map_mld.py | 25 ++-- .../ocean/climatology_map_mld_min_max.py | 13 +- .../ocean/climatology_map_ohc_anomaly.py | 32 ++--- .../ocean/climatology_map_schmidtko.py | 24 ++-- mpas_analysis/ocean/climatology_map_sose.py | 17 +-- mpas_analysis/ocean/climatology_map_ssh.py | 28 ++-- mpas_analysis/ocean/climatology_map_sss.py | 20 +-- mpas_analysis/ocean/climatology_map_sst.py | 20 +-- mpas_analysis/ocean/climatology_map_woa.py | 24 ++-- .../ocean/compute_anomaly_subtask.py | 16 +-- .../ocean/compute_transects_subtask.py | 59 ++++----- .../ocean/compute_transects_with_vel_mag.py | 11 +- mpas_analysis/ocean/geojson_transects.py | 16 +-- .../ocean/hovmoller_ocean_regions.py | 23 +--- mpas_analysis/ocean/index_nino34.py | 44 +++---- .../ocean/meridional_heat_transport.py | 25 +--- .../ocean/ocean_regional_profiles.py | 51 +++----- ...ot_depth_integrated_time_series_subtask.py | 16 +-- mpas_analysis/ocean/plot_hovmoller_subtask.py | 16 +-- mpas_analysis/ocean/plot_transect_subtask.py | 39 ++---- mpas_analysis/ocean/regional_ts_diagrams.py | 64 ++++----- .../ocean/remap_depth_slices_subtask.py | 15 +-- mpas_analysis/ocean/remap_sose_climatology.py | 17 +-- mpas_analysis/ocean/sose_transects.py | 36 ++--- mpas_analysis/ocean/streamfunction_moc.py | 123 ++++++------------ .../ocean/time_series_antarctic_melt.py | 49 +++---- .../ocean/time_series_ocean_regions.py | 65 +++------ .../ocean/time_series_ohc_anomaly.py | 13 +- .../ocean/time_series_salinity_anomaly.py | 8 +- mpas_analysis/ocean/time_series_sst.py | 13 +- .../ocean/time_series_temperature_anomaly.py | 8 +- mpas_analysis/ocean/time_series_transport.py | 63 ++++----- mpas_analysis/ocean/utility.py | 10 +- mpas_analysis/ocean/woce_transects.py | 10 +- .../sea_ice/climatology_map_berg_conc.py | 22 +--- .../sea_ice/climatology_map_sea_ice_conc.py | 25 ++-- .../sea_ice/climatology_map_sea_ice_thick.py | 21 +-- .../sea_ice/plot_climatology_map_subtask.py | 18 +-- mpas_analysis/sea_ice/time_series.py | 22 ++-- mpas_analysis/shared/analysis_task.py | 52 +++----- .../shared/climatology/climatology.py | 76 +++++------ .../climatology/mpas_climatology_task.py | 84 +++++------- .../ref_year_mpas_climatology_task.py | 11 +- .../remap_mpas_climatology_subtask.py | 55 +++----- .../remap_observed_climatology_subtask.py | 35 ++--- mpas_analysis/shared/constants/constants.py | 2 - mpas_analysis/shared/containers.py | 4 +- .../generalized_reader/generalized_reader.py | 15 +-- mpas_analysis/shared/html/image_xml.py | 6 +- mpas_analysis/shared/html/pages.py | 20 ++- .../shared/interpolation/interp_1d.py | 14 +- mpas_analysis/shared/io/mpas_reader.py | 8 +- .../shared/io/namelist_streams_interface.py | 6 +- mpas_analysis/shared/io/utility.py | 34 +++-- mpas_analysis/shared/io/write_netcdf.py | 3 +- .../shared/mpas_xarray/mpas_xarray.py | 32 ++--- mpas_analysis/shared/plot/climatology_map.py | 2 - mpas_analysis/shared/plot/colormap.py | 2 - mpas_analysis/shared/plot/oned.py | 6 +- mpas_analysis/shared/plot/save.py | 2 - mpas_analysis/shared/plot/ticks.py | 2 - mpas_analysis/shared/plot/time_series.py | 2 - mpas_analysis/shared/plot/vertical_section.py | 26 ++-- .../regions/compute_region_masks_subtask.py | 16 +-- mpas_analysis/shared/time_series/anomaly.py | 5 +- .../shared/time_series/moving_average.py | 5 +- .../time_series/mpas_time_series_task.py | 33 ++--- .../shared/time_series/time_series.py | 9 +- .../shared/timekeeping/MpasRelativeDelta.py | 2 - mpas_analysis/shared/timekeeping/utility.py | 13 +- .../compute_transect_masks_subtask.py | 13 +- mpas_analysis/test/test_analysis_task.py | 2 - mpas_analysis/test/test_climatology.py | 2 - mpas_analysis/test/test_generalized_reader.py | 2 - mpas_analysis/test/test_io_utility.py | 2 - mpas_analysis/test/test_mpas_xarray.py | 2 - .../test/test_namelist_streams_interface.py | 2 - mpas_analysis/test/test_open_mpas_dataset.py | 2 - .../test/test_remap_obs_clim_subtask.py | 29 ++--- mpas_analysis/test/test_timekeeping.py | 2 - 87 files changed, 662 insertions(+), 1295 deletions(-) diff --git a/mpas_analysis/__main__.py b/mpas_analysis/__main__.py index 13e29db0f..9f6606769 100755 --- a/mpas_analysis/__main__.py +++ b/mpas_analysis/__main__.py @@ -58,7 +58,7 @@ from mpas_analysis.shared.regions import ComputeRegionMasks -def update_time_bounds_in_config(config): # {{{ +def update_time_bounds_in_config(config): """ Updates the start and end year (and associated full date) for climatologies, time series and climate indices based on the files that are @@ -75,10 +75,9 @@ def update_time_bounds_in_config(config): # {{{ for componentName in ['ocean', 'seaIce']: for section in ['climatology', 'timeSeries', 'index']: update_time_bounds_from_file_names(config, section, componentName) - # }}} -def build_analysis_list(config, controlConfig): # {{{ +def build_analysis_list(config, controlConfig): """ Build a list of analysis tasks. New tasks should be added here, following the approach used for existing analysis tasks. @@ -247,10 +246,10 @@ def build_analysis_list(config, controlConfig): # {{{ config=config, mpasClimatologyTask=seaIceClimatolgyTask, hemisphere='SH', controlConfig=controlConfig)) - return analyses # }}} + return analyses -def determine_analyses_to_generate(analyses, verbose): # {{{ +def determine_analyses_to_generate(analyses, verbose): """ Build a list of analysis tasks to run based on the 'generate' config option (or command-line flag) and prerequisites and subtasks of each @@ -297,12 +296,12 @@ def determine_analyses_to_generate(analyses, verbose): # {{{ print('') - return analysesToGenerate # }}} + return analysesToGenerate def add_task_and_subtasks(analysisTask, analysesToGenerate, verbose, callCheckGenerate=True): - # {{{ + """ If a task has been requested through the generate config option or if it is a prerequisite of a requested task, add it to the dictionary of @@ -406,10 +405,9 @@ def add_task_and_subtasks(analysisTask, analysesToGenerate, verbose, analysisTask._setupStatus = 'success' assert(totalFailures == 0) return totalFailures - # }}} -def update_generate(config, generate): # {{{ +def update_generate(config, generate): """ Update the 'generate' config option using a string from the command line. @@ -433,10 +431,10 @@ def update_generate(config, generate): # {{{ generateString = ', '.join(["'{}'".format(element) for element in generateList]) generateString = '[{}]'.format(generateString) - config.set('output', 'generate', generateString) # }}} + config.set('output', 'generate', generateString) -def run_analysis(config, analyses): # {{{ +def run_analysis(config, analyses): """ Run all the tasks, either in serial or in parallel @@ -620,10 +618,8 @@ def run_analysis(config, analyses): # {{{ print('Log files for executed tasks can be found in {}'.format( logsDirectory)) - # }}} - -def wait_for_task(runningTasks, timeout=0.1): # {{{ +def wait_for_task(runningTasks, timeout=0.1): """ Build a list of analysis modules based on the 'generate' config option. New tasks should be added here, following the approach used for existing @@ -649,7 +645,7 @@ def wait_for_task(runningTasks, timeout=0.1): # {{{ for analysisTask in runningTasks.values(): analysisTask.join(timeout=timeout) if not analysisTask.is_alive(): - return analysisTask # }}} + return analysisTask def purge_output(config): @@ -930,5 +926,3 @@ def main(): if __name__ == "__main__": main() - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/analysis_task_template.py b/mpas_analysis/analysis_task_template.py index e3915c324..157865de7 100644 --- a/mpas_analysis/analysis_task_template.py +++ b/mpas_analysis/analysis_task_template.py @@ -63,11 +63,12 @@ # parent, "inhereting" several variables and methods (functions) from it that # can be helpful in initializing, checking whether to perform analysis and # performing the analysis. See AnalysisTask in shared/analysis_task.py -class MyTask(AnalysisTask): # {{{ +class MyTask(AnalysisTask): ''' ''' + # Authors # ------- # @@ -95,7 +96,7 @@ class MyTask(AnalysisTask): # {{{ # def __init__(self, config, fieldName):... # and yu would then make a new task something like this: # myTask = MyTask(config, fieldName='seaIceArea') - def __init__(self, config, prerequsiteTask, myArg='myDefaultValue'): # {{{ + def __init__(self, config, prerequsiteTask, myArg='myDefaultValue'): ''' Construct the analysis task. @@ -185,14 +186,12 @@ def __init__(self, config, prerequsiteTask, myArg='myDefaultValue'): # {{{ # MyPlotObservationsSubtask but they would be qualitatively similar # to MySubtask below. - # }}} - # this function will be called to figure out if the analysis task should # run. It should check if the input arguments to the task are supported, # if appropriate analysis member(s) (AMs) were turned on, if the necessary # output files exist, etc. If there is a problem, an exception should be # raised (see the example below) so the task will not be run. - def setup_and_check(self): # {{{ + def setup_and_check(self): ''' Perform steps to set up the analysis and check for errors in the setup. @@ -309,9 +308,7 @@ def setup_and_check(self): # {{{ filePrefix)) self.filePrefixes[plotParameter] = filePrefix - # }}} - - def run_task(self): # {{{ + def run_task(self): ''' The main method of the task that performs the analysis task. ''' @@ -329,7 +326,6 @@ def run_task(self): # {{{ # one for each of our plotParameters (e.g. seasons) for plotParameter in self.plotParameters: self._make_plot(plotParameter) - # }}} # here is where you add helper methods that are meant to be non-public # (they start with an underscore), meaning you don't expect anyone to @@ -339,7 +335,7 @@ def run_task(self): # {{{ # you can either pass arguments (with or without defaults) or you can # 'save' arguments as member variables of `self` and then get them back # (like `self.myArg` here). - def _make_plot(self, plotParameter, optionalArgument=None): # {{{ + def _make_plot(self, plotParameter, optionalArgument=None): ''' Make a simple plot @@ -369,7 +365,7 @@ def _make_plot(self, plotParameter, optionalArgument=None): # {{{ # make the plot x = numpy.linspace(0, 1, 1000) - plt.plot(x, x**2) + plt.plot(x, x ** 2) # save the plot to the output file plt.savefig(outFileName) @@ -396,8 +392,6 @@ def _make_plot(self, plotParameter, optionalArgument=None): # {{{ imageDescription=caption, imageCaption=caption) - # }}} - class MySubtask(AnalysisTask): def __init__(self, parentTask, season): @@ -414,8 +408,8 @@ def setup_and_check(self): # do whatever setup is needed for the subtask. You don't have # to redundantly do setup that happened in parentTask because # you can access its fields if needed - assert(self.parentTask.streamName == - 'timeSeriesStatsMonthlyOutput') + assert (self.parentTask.streamName == + 'timeSeriesStatsMonthlyOutput') def run_analsysis(self): # do the main action of the subplot. Note: you can't access any @@ -426,5 +420,3 @@ def run_analsysis(self): pass # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/download_data.py b/mpas_analysis/download_data.py index 76ed66501..b2a373b13 100755 --- a/mpas_analysis/download_data.py +++ b/mpas_analysis/download_data.py @@ -57,5 +57,3 @@ def download_analysis_data(): analysisFileList = list(filter(None, analysisFileList.split('\n'))) download_files(analysisFileList, urlBase, args.outDir, verify=True) - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/ocean/climatology_map_antarctic_melt.py b/mpas_analysis/ocean/climatology_map_antarctic_melt.py index d60801dbe..0c3268eac 100644 --- a/mpas_analysis/ocean/climatology_map_antarctic_melt.py +++ b/mpas_analysis/ocean/climatology_map_antarctic_melt.py @@ -33,7 +33,7 @@ from mpas_analysis.shared.constants import constants -class ClimatologyMapAntarcticMelt(AnalysisTask): # {{{ +class ClimatologyMapAntarcticMelt(AnalysisTask): """ An analysis task for comparison of Antarctic melt rates against observations @@ -43,7 +43,7 @@ class ClimatologyMapAntarcticMelt(AnalysisTask): # {{{ # Xylar Asay-Davis def __init__(self, config, mpasClimatologyTask, regionMasksTask, - controlConfig): # {{{ + controlConfig): """ Construct the analysis task. @@ -167,9 +167,8 @@ def __init__(self, config, mpasClimatologyTask, regionMasksTask, galleryName=galleryName) self.add_subtask(subtask) - # }}} - def setup_and_check(self): # {{{ + def setup_and_check(self): """ Perform steps to set up the analysis and check for errors in the setup. """ @@ -188,11 +187,9 @@ def setup_and_check(self): # {{{ ' to be standalone or coupled. Otherwise, no ' 'melt rates are available \n' ' for plotting.') - # }}} - # }}} -class RemapMpasAntarcticMeltClimatology(RemapMpasClimatologySubtask): # {{{ +class RemapMpasAntarcticMeltClimatology(RemapMpasClimatologySubtask): """ A subtask for remapping climatologies of Antarctic melt rates and adding @@ -206,7 +203,7 @@ class RemapMpasAntarcticMeltClimatology(RemapMpasClimatologySubtask): # {{{ # ------- # Xylar Asay-Davis - def run_task(self): # {{{ + def run_task(self): """ Compute climatologies of melt rates from E3SM/MPAS output @@ -228,9 +225,7 @@ def run_task(self): # {{{ # which will perform the main function of the task super(RemapMpasAntarcticMeltClimatology, self).run_task() - # }}} - - def customize_masked_climatology(self, climatology, season): # {{{ + def customize_masked_climatology(self, climatology, season): """ Mask the melt rates using ``landIceMask`` and rescale it to m/yr @@ -258,13 +253,11 @@ def customize_masked_climatology(self, climatology, season): # {{{ constants.sec_per_year / constants.rho_fw * \ climatology[fieldName].where(self.landIceMask) - return climatology # }}} - - # }}} + return climatology class RemapObservedAntarcticMeltClimatology(RemapObservedClimatologySubtask): - # {{{ + """ A subtask for reading and remapping Antarctic melt-rate observations """ @@ -272,7 +265,7 @@ class RemapObservedAntarcticMeltClimatology(RemapObservedClimatologySubtask): # ------- # Xylar Asay-Davis - def get_observation_descriptor(self, fileName): # {{{ + def get_observation_descriptor(self, fileName): """ get a MeshDescriptor for the observation grid @@ -295,9 +288,9 @@ def get_observation_descriptor(self, fileName): # {{{ projection = get_pyproj_projection(comparison_grid_name='antarctic') obsDescriptor = ProjectionGridDescriptor.read( projection, fileName=fileName, xVarName='x', yVarName='y') - return obsDescriptor # }}} + return obsDescriptor - def build_observational_dataset(self, fileName): # {{{ + def build_observational_dataset(self, fileName): """ read in the data sets for observations, and possibly rename some variables and dimensions @@ -319,14 +312,12 @@ def build_observational_dataset(self, fileName): # {{{ # Load MLD observational data dsObs = xr.open_dataset(fileName) - return dsObs # }}} - - # }}} + return dsObs class AntarcticMeltTableSubtask(AnalysisTask): def __init__(self, parentTask, mpasClimatologyTask, controlConfig, - regionMasksTask, season, subtaskName=None): # {{{ + regionMasksTask, season, subtaskName=None): """ Construct the analysis task. @@ -378,9 +369,8 @@ def __init__(self, parentTask, mpasClimatologyTask, controlConfig, self.run_after(self.masksSubtask) self.run_after(mpasClimatologyTask) - # }}} - def run_task(self): # {{{ + def run_task(self): """ Computes and plots table of Antarctic sub-ice-shelf melt rates. """ @@ -534,9 +524,3 @@ def run_task(self): # {{{ row[controlRunName] = \ '{}'.format(dsControl.totalMeltFlux[index].values) writer.writerow(row) - - # }}} - # }}} - - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/ocean/climatology_map_argo.py b/mpas_analysis/ocean/climatology_map_argo.py index 80df326c9..ee8f1f61e 100644 --- a/mpas_analysis/ocean/climatology_map_argo.py +++ b/mpas_analysis/ocean/climatology_map_argo.py @@ -33,17 +33,18 @@ from mpas_analysis.shared.climatology import RemapObservedClimatologySubtask -class ClimatologyMapArgoTemperature(AnalysisTask): # {{{ +class ClimatologyMapArgoTemperature(AnalysisTask): """ An analysis task for comparison of potential temperature against Argo observations """ + # Authors # ------- # Luke Van Roekel, Xylar Asay-Davis def __init__(self, config, mpasClimatologyTask, - controlConfig=None): # {{{ + controlConfig=None): """ Construct the analysis task. @@ -170,22 +171,20 @@ def __init__(self, config, mpasClimatologyTask, galleryName=galleryName) self.add_subtask(subtask) - # }}} - - # }}} -class ClimatologyMapArgoSalinity(AnalysisTask): # {{{ +class ClimatologyMapArgoSalinity(AnalysisTask): """ An analysis task for comparison of global salinity against Argo observations """ + # Authors # ------- # Xylar Asay-Davis, Luke Van Roekel def __init__(self, config, mpasClimatologyTask, - controlConfig=None): # {{{ + controlConfig=None): """ Construct the analysis task. @@ -310,16 +309,13 @@ def __init__(self, config, mpasClimatologyTask, galleryName=galleryName) self.add_subtask(subtask) - # }}} - - # }}} class RemapArgoClimatology(RemapObservedClimatologySubtask): - # {{{ """ A subtask for reading and remapping SOSE fields to the comparison grid """ + # Authors # ------- # Xylar Asay-Davis, Luke Van Roekel @@ -328,7 +324,7 @@ def __init__(self, parentTask, seasons, fileName, outFilePrefix, fieldName, depths, comparisonGridNames=['latlon'], subtaskName='remapObservations'): - # {{{ + ''' Construct one analysis subtask for each plot (i.e. each season and comparison grid) and a subtask for computing climatologies. @@ -374,9 +370,8 @@ def __init__(self, parentTask, seasons, fileName, outFilePrefix, super(RemapArgoClimatology, self).__init__( parentTask, seasons, fileName, outFilePrefix, comparisonGridNames, subtaskName) - # }}} - def get_observation_descriptor(self, fileName): # {{{ + def get_observation_descriptor(self, fileName): ''' get a MeshDescriptor for the observation grid @@ -403,9 +398,9 @@ def get_observation_descriptor(self, fileName): # {{{ latVarName='latCoord', lonVarName='lonCoord') dsObs.close() - return obsDescriptor # }}} + return obsDescriptor - def build_observational_dataset(self, fileName): # {{{ + def build_observational_dataset(self, fileName): ''' read in the data sets for observations, and possibly rename some variables and dimensions @@ -455,8 +450,4 @@ def build_observational_dataset(self, fileName): # {{{ dsObs = xr.Dataset(data_vars={self.fieldName: field}, coords={'depthSlice': depthNames}) - return dsObs # }}} - - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python + return dsObs diff --git a/mpas_analysis/ocean/climatology_map_bgc.py b/mpas_analysis/ocean/climatology_map_bgc.py index ce106fc61..597e3e138 100644 --- a/mpas_analysis/ocean/climatology_map_bgc.py +++ b/mpas_analysis/ocean/climatology_map_bgc.py @@ -22,7 +22,7 @@ from mpas_analysis.shared.interpolation.utility import add_periodic_lon -class ClimatologyMapBGC(AnalysisTask): # {{{ +class ClimatologyMapBGC(AnalysisTask): """ An analysis task for plotting of BGC variables @@ -32,7 +32,7 @@ class ClimatologyMapBGC(AnalysisTask): # {{{ """ - def __init__(self, config, mpasClimatologyTask, controlConfig=None): # {{{ + def __init__(self, config, mpasClimatologyTask, controlConfig=None): """ Construct the analysis task. @@ -206,7 +206,7 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): # {{{ self.add_subtask(subtask) - def setup_and_check(self): # {{{ + def setup_and_check(self): ''' Check if preindustrial flag is turned on or off. ''' @@ -231,11 +231,8 @@ def setup_and_check(self): # {{{ 'True' under the ClimatologyMapBGC config section. """) - # }}} - # }}} - -class RemapBGCClimatology(RemapMpasClimatologySubtask): # {{{ +class RemapBGCClimatology(RemapMpasClimatologySubtask): """ Apply unit conversions to native model output to align with observations. """ @@ -243,7 +240,7 @@ class RemapBGCClimatology(RemapMpasClimatologySubtask): # {{{ # ------- # Riley X. Brady - def customize_masked_climatology(self, climatology, season): # {{{ + def customize_masked_climatology(self, climatology, season): """ Sum over all phytoplankton chlorophyll to create total chlorophyll @@ -278,10 +275,10 @@ def customize_masked_climatology(self, climatology, season): # {{{ 'timeMonthly_avg_ecosysTracers_diazChl', 'timeMonthly_avg_ecosysTracers_phaeoChl']) - return climatology # }}} + return climatology def customize_remapped_climatology(self, climatology, comparisonGridName, - season): # {{{ + season): """ Convert CO2 gas flux from native units to mol/m2/yr, Convert dissolved O2 from native units to mL/L @@ -317,12 +314,10 @@ def customize_remapped_climatology(self, climatology, comparisonGridName, elif fieldName == 'timeMonthly_avg_ecosysTracers_O2': conversion = 22.391 / 10**3 climatology[fieldName] = conversion * climatology[fieldName] - return climatology # }}} - - # }}} + return climatology -class RemapObservedBGCClimatology(RemapObservedClimatologySubtask): # {{{ +class RemapObservedBGCClimatology(RemapObservedClimatologySubtask): """ A subtask for reading and remapping BGC observations """ @@ -330,7 +325,7 @@ class RemapObservedBGCClimatology(RemapObservedClimatologySubtask): # {{{ # ------- # Riley X. Brady - def get_observation_descriptor(self, fileName): # {{{ + def get_observation_descriptor(self, fileName): ''' get a MeshDescriptor for the observation grid @@ -354,9 +349,9 @@ def get_observation_descriptor(self, fileName): # {{{ obsDescriptor = LatLonGridDescriptor.read(ds=dsObs, latVarName='lat', lonVarName='lon') - return obsDescriptor # }}} + return obsDescriptor - def build_observational_dataset(self, fileName): # {{{ + def build_observational_dataset(self, fileName): ''' read in the data sets for observations, and possibly rename some variables and dimensions @@ -378,8 +373,4 @@ def build_observational_dataset(self, fileName): # {{{ dsObs = xr.open_dataset(fileName) degrees = 'degree' in dsObs.lon.units dsObs = add_periodic_lon(ds=dsObs, lonDim='lon', degrees=degrees) - return dsObs # }}} - - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python + return dsObs diff --git a/mpas_analysis/ocean/climatology_map_eke.py b/mpas_analysis/ocean/climatology_map_eke.py index 3e355c6f8..6ddd6704c 100644 --- a/mpas_analysis/ocean/climatology_map_eke.py +++ b/mpas_analysis/ocean/climatology_map_eke.py @@ -22,7 +22,7 @@ PlotClimatologyMapSubtask -class ClimatologyMapEKE(AnalysisTask): # {{{ +class ClimatologyMapEKE(AnalysisTask): """ An analysis task for comparison of eddy kinetic energy (eke) against observations @@ -32,7 +32,7 @@ class ClimatologyMapEKE(AnalysisTask): # {{{ # Kevin Rosa def __init__(self, config, mpasClimatologyTask, - controlConfig=None): # {{{ + controlConfig=None): """ Construct the analysis task. @@ -151,12 +151,10 @@ def __init__(self, config, mpasClimatologyTask, galleryName=galleryName) self.add_subtask(subtask) - # }}} - # }}} # adds to the functionality of RemapDepthSlicesSubtask -class RemapMpasEKEClimatology(RemapMpasClimatologySubtask): # {{{ +class RemapMpasEKEClimatology(RemapMpasClimatologySubtask): """ A subtask for computing climatologies of eddy kinetic energy from means of velocity and velocity-squared. @@ -165,7 +163,7 @@ class RemapMpasEKEClimatology(RemapMpasClimatologySubtask): # {{{ # ------- # Kevin Rosa - def customize_masked_climatology(self, climatology, season): # {{{ + def customize_masked_climatology(self, climatology, season): """ Construct velocity magnitude as part of the climatology @@ -211,12 +209,10 @@ def customize_masked_climatology(self, climatology, season): # {{{ climatology.eke.attrs['units'] = 'cm$^[2]$ s$^{-2}$' climatology.eke.attrs['description'] = 'eddy kinetic energy' - return climatology # }}} + return climatology - # }}} - -class RemapObservedEKEClimatology(RemapObservedClimatologySubtask): # {{{ +class RemapObservedEKEClimatology(RemapObservedClimatologySubtask): """ A subtask for reading and remapping EKE observations """ @@ -224,7 +220,7 @@ class RemapObservedEKEClimatology(RemapObservedClimatologySubtask): # {{{ # ------- # Kevin Rosa - def get_observation_descriptor(self, fileName): # {{{ + def get_observation_descriptor(self, fileName): ''' get a MeshDescriptor for the observation grid @@ -248,9 +244,9 @@ def get_observation_descriptor(self, fileName): # {{{ latVarName='Lat', lonVarName='Lon') - return obsDescriptor # }}} + return obsDescriptor - def build_observational_dataset(self, fileName): # {{{ + def build_observational_dataset(self, fileName): ''' read in the data sets for observations, and possibly rename some variables and dimensions @@ -284,8 +280,4 @@ def build_observational_dataset(self, fileName): # {{{ dsObs.eke.attrs['units'] = 'cm$^2$ s$^{-2}$' dsObs.eke.attrs['long_name'] = 'Eddy kinetic energy' - return dsObs # }}} - - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python + return dsObs diff --git a/mpas_analysis/ocean/climatology_map_mld.py b/mpas_analysis/ocean/climatology_map_mld.py index f96c6cf9f..d7ed3c206 100644 --- a/mpas_analysis/ocean/climatology_map_mld.py +++ b/mpas_analysis/ocean/climatology_map_mld.py @@ -23,7 +23,7 @@ PlotClimatologyMapSubtask -class ClimatologyMapMLD(AnalysisTask): # {{{ +class ClimatologyMapMLD(AnalysisTask): """ An analysis task for comparison of mixed layer depth (mld) against observations @@ -33,7 +33,7 @@ class ClimatologyMapMLD(AnalysisTask): # {{{ # Luke Van Roekel, Xylar Asay-Davis, Milena Veneziani def __init__(self, config, mpasClimatologyTask, - controlConfig=None): # {{{ + controlConfig=None): """ Construct the analysis task. @@ -142,9 +142,8 @@ def __init__(self, config, mpasClimatologyTask, galleryName=galleryName) self.add_subtask(subtask) - # }}} - def setup_and_check(self): # {{{ + def setup_and_check(self): ''' Check if MLD capability was turned on in the run. ''' @@ -163,12 +162,8 @@ def setup_and_check(self): # {{{ analysisOptionName='config_am_mixedlayerdepths_enable', raiseException=True) - # }}} - # }}} - - -class RemapObservedMLDClimatology(RemapObservedClimatologySubtask): # {{{ +class RemapObservedMLDClimatology(RemapObservedClimatologySubtask): """ A subtask for reading and remapping MLD observations """ @@ -176,7 +171,7 @@ class RemapObservedMLDClimatology(RemapObservedClimatologySubtask): # {{{ # ------- # Luke Van Roekel, Xylar Asay-Davis, Milena Veneziani - def get_observation_descriptor(self, fileName): # {{{ + def get_observation_descriptor(self, fileName): ''' get a MeshDescriptor for the observation grid @@ -203,9 +198,9 @@ def get_observation_descriptor(self, fileName): # {{{ latVarName='lat', lonVarName='lon') dsObs.close() - return obsDescriptor # }}} + return obsDescriptor - def build_observational_dataset(self, fileName): # {{{ + def build_observational_dataset(self, fileName): ''' read in the data sets for observations, and possibly rename some variables and dimensions @@ -244,8 +239,4 @@ def build_observational_dataset(self, fileName): # {{{ dsObs.coords['year'] = ('Time', np.ones(dsObs.dims['Time'], int)) dsObs = dsObs[['mld', 'month']] - return dsObs # }}} - - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python + return dsObs diff --git a/mpas_analysis/ocean/climatology_map_mld_min_max.py b/mpas_analysis/ocean/climatology_map_mld_min_max.py index d4cc1b481..d2bc21290 100644 --- a/mpas_analysis/ocean/climatology_map_mld_min_max.py +++ b/mpas_analysis/ocean/climatology_map_mld_min_max.py @@ -16,7 +16,7 @@ PlotClimatologyMapSubtask -class ClimatologyMapMLDMinMax(AnalysisTask): # {{{ +class ClimatologyMapMLDMinMax(AnalysisTask): """ An analysis task for comparison of mixed layer depth (mld) against observations @@ -26,7 +26,7 @@ class ClimatologyMapMLDMinMax(AnalysisTask): # {{{ # Luke Van Roekel, Xylar Asay-Davis, Milena Veneziani def __init__(self, config, mpasClimatologyTasks, controlConfig=None): - # {{{ + """ Construct the analysis task. @@ -69,9 +69,8 @@ def __init__(self, config, mpasClimatologyTasks, controlConfig=None): mpasVariableSuffix='boundaryLayerDepth', filePrefix='bld', sectionPrefix='climatologyMapBLD') - # }}} - def setup_and_check(self): # {{{ + def setup_and_check(self): ''' Check if MLD capability was turned on in the run. ''' @@ -97,8 +96,6 @@ def setup_and_check(self): # {{{ analysisOptionName='config_AM_timeSeriesStatsMonthlyMax_enable', raiseException=True) - # }}} - def _add_tasks(self, config, mpasClimatologyTasks, controlConfig, title, mpasVariableSuffix, filePrefix, sectionPrefix): ''' @@ -220,7 +217,3 @@ def _add_tasks(self, config, mpasClimatologyTasks, controlConfig, configSectionName=sectionName) self.add_subtask(subtask) - - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/ocean/climatology_map_ohc_anomaly.py b/mpas_analysis/ocean/climatology_map_ohc_anomaly.py index b0dde5fd7..0e1fe8a35 100644 --- a/mpas_analysis/ocean/climatology_map_ohc_anomaly.py +++ b/mpas_analysis/ocean/climatology_map_ohc_anomaly.py @@ -21,7 +21,7 @@ from mpas_analysis.ocean.utility import compute_zmid -class ClimatologyMapOHCAnomaly(AnalysisTask): # {{{ +class ClimatologyMapOHCAnomaly(AnalysisTask): """ An analysis task for comparison of the anomaly from a reference year (typically the start of the simulation) of ocean heat content (OHC) @@ -40,7 +40,7 @@ class ClimatologyMapOHCAnomaly(AnalysisTask): # {{{ # Xylar Asay-Davis def __init__(self, config, mpasClimatologyTask, refYearClimatolgyTask, - controlConfig=None): # {{{ + controlConfig=None): """ Construct the analysis task. @@ -156,9 +156,8 @@ def __init__(self, config, mpasClimatologyTask, refYearClimatolgyTask, galleryName=None) self.add_subtask(subtask) - # }}} - def setup_and_check(self): # {{{ + def setup_and_check(self): ''' Checks whether analysis is being performed only on the reference year, in which case the analysis will not be meaningful. @@ -186,11 +185,8 @@ def setup_and_check(self): # {{{ raise ValueError('OHC Anomaly is not meaningful and will not work ' 'when climatology and ref year are the same.') - # }}} - # }}} - -class RemapMpasOHCClimatology(RemapMpasClimatologySubtask): # {{{ +class RemapMpasOHCClimatology(RemapMpasClimatologySubtask): """ A subtask for computing climatologies of ocean heat content from climatologies of temperature @@ -207,7 +203,7 @@ class RemapMpasOHCClimatology(RemapMpasClimatologySubtask): # {{{ def __init__(self, mpasClimatologyTask, refYearClimatolgyTask, parentTask, climatologyName, variableList, seasons, comparisonGridNames, minDepth, maxDepth): - # {{{ + ''' Construct the analysis task and adds it as a subtask of the ``parentTask``. @@ -263,9 +259,8 @@ def __init__(self, mpasClimatologyTask, refYearClimatolgyTask, parentTask, self.run_after(refYearClimatolgyTask) self.minDepth = minDepth self.maxDepth = maxDepth - # }}} - def setup_and_check(self): # {{{ + def setup_and_check(self): ''' Perform steps to set up the analysis and check for errors in the setup. @@ -290,9 +285,7 @@ def setup_and_check(self): # {{{ self.refYearClimatolgyTask.add_variables(self.variableList, self.seasons) - # }}} - - def customize_masked_climatology(self, climatology, season): # {{{ + def customize_masked_climatology(self, climatology, season): """ Mask the melt rates using ``landIceMask`` and rescale it to m/yr @@ -328,9 +321,9 @@ def customize_masked_climatology(self, climatology, season): # {{{ climatology = climatology.drop_vars(self.variableList) - return climatology # }}} + return climatology - def _compute_ohc(self, climatology): # {{{ + def _compute_ohc(self, climatology): """ Compute the OHC from the temperature and layer thicknesses in a given climatology data sets. @@ -365,9 +358,4 @@ def _compute_ohc(self, climatology): # {{{ ohc = unitsScalefactor * rho * cp * layerThickness * temperature ohc = ohc.sum(dim='nVertLevels') - return ohc # }}} - - # }}} - - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python + return ohc diff --git a/mpas_analysis/ocean/climatology_map_schmidtko.py b/mpas_analysis/ocean/climatology_map_schmidtko.py index e669130f7..ad7369027 100644 --- a/mpas_analysis/ocean/climatology_map_schmidtko.py +++ b/mpas_analysis/ocean/climatology_map_schmidtko.py @@ -32,7 +32,7 @@ from mpas_analysis.shared.projection import get_pyproj_projection -class ClimatologyMapSchmidtko(AnalysisTask): # {{{ +class ClimatologyMapSchmidtko(AnalysisTask): """ An analysis task for comparison of Antarctic Bottom Water properties against Schmidtko et al. (2014) observations @@ -41,7 +41,7 @@ class ClimatologyMapSchmidtko(AnalysisTask): # {{{ # ------- # Xylar Asay-Davis - def __init__(self, config, mpasClimatologyTask, controlConfig=None): # {{{ + def __init__(self, config, mpasClimatologyTask, controlConfig=None): """ Construct the analysis task. @@ -183,12 +183,9 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): # {{{ upperFieldPrefix)) self.add_subtask(subtask) - # }}} - # }}} - -class RemapSchmidtko(RemapObservedClimatologySubtask): # {{{ +class RemapSchmidtko(RemapObservedClimatologySubtask): """ A subtask for reading and remapping Schmidtko et al. (2014) observations """ @@ -199,7 +196,7 @@ class RemapSchmidtko(RemapObservedClimatologySubtask): # {{{ def __init__(self, parentTask, seasons, fileName, outFilePrefix, fieldName, comparisonGridNames=['latlon'], subtaskName='remapObservations'): - # {{{ + ''' Construct one analysis subtask for each plot (i.e. each season and comparison grid) and a subtask for computing climatologies. @@ -240,9 +237,8 @@ def __init__(self, parentTask, seasons, fileName, outFilePrefix, super(RemapSchmidtko, self).__init__( parentTask, seasons, fileName, outFilePrefix, comparisonGridNames, subtaskName) - # }}} - def get_observation_descriptor(self, fileName): # {{{ + def get_observation_descriptor(self, fileName): ''' get a MeshDescriptor for the observation grid @@ -265,9 +261,9 @@ def get_observation_descriptor(self, fileName): # {{{ projection = get_pyproj_projection(comparison_grid_name='antarctic') obsDescriptor = ProjectionGridDescriptor.read( projection, fileName=fileName, xVarName='x', yVarName='y') - return obsDescriptor # }}} + return obsDescriptor - def build_observational_dataset(self, fileName): # {{{ + def build_observational_dataset(self, fileName): ''' read in the data sets for observations, and possibly rename some variables and dimensions @@ -294,8 +290,4 @@ def build_observational_dataset(self, fileName): # {{{ dsObs = xr.Dataset(data_vars={self.fieldName: field}, coords={'depthSlice': ['bot']}) - return dsObs # }}} - - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python + return dsObs diff --git a/mpas_analysis/ocean/climatology_map_sose.py b/mpas_analysis/ocean/climatology_map_sose.py index 8452dc33c..cb7f22c17 100644 --- a/mpas_analysis/ocean/climatology_map_sose.py +++ b/mpas_analysis/ocean/climatology_map_sose.py @@ -31,7 +31,7 @@ from mpas_analysis.shared.io.utility import build_obs_path -class ClimatologyMapSose(AnalysisTask): # {{{ +class ClimatologyMapSose(AnalysisTask): """ An analysis task for comparison of antarctic field against the Southern Ocean State Estimate @@ -41,7 +41,7 @@ class ClimatologyMapSose(AnalysisTask): # {{{ # Xylar Asay-Davis def __init__(self, config, mpasClimatologyTask, - controlConfig=None): # {{{ + controlConfig=None): """ Construct the analysis task. @@ -298,12 +298,9 @@ def __init__(self, config, mpasClimatologyTask, configSectionName=configSectionName) self.add_subtask(subtask) - # }}} - # }}} - -class RemapMpasVelMagClimatology(RemapDepthSlicesSubtask): # {{{ +class RemapMpasVelMagClimatology(RemapDepthSlicesSubtask): """ A subtask for computing climatologies of velocity magnitude from zonal and meridional components @@ -312,7 +309,7 @@ class RemapMpasVelMagClimatology(RemapDepthSlicesSubtask): # {{{ # ------- # Xylar Asay-Davis - def customize_masked_climatology(self, climatology, season): # {{{ + def customize_masked_climatology(self, climatology, season): """ Construct velocity magnitude as part of the climatology @@ -347,8 +344,4 @@ def customize_masked_climatology(self, climatology, season): # {{{ climatology.velMag.attrs['units'] = 'm s$^{-1}$' climatology.velMag.attrs['description'] = 'velocity magnitude' - return climatology # }}} - - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python + return climatology diff --git a/mpas_analysis/ocean/climatology_map_ssh.py b/mpas_analysis/ocean/climatology_map_ssh.py index 5f09e0f10..4948f40c0 100644 --- a/mpas_analysis/ocean/climatology_map_ssh.py +++ b/mpas_analysis/ocean/climatology_map_ssh.py @@ -24,7 +24,7 @@ from mpas_analysis.shared.constants import constants -class ClimatologyMapSSH(AnalysisTask): # {{{ +class ClimatologyMapSSH(AnalysisTask): """ An analysis task for comparison of sea surface height (ssh) against observations @@ -34,7 +34,7 @@ class ClimatologyMapSSH(AnalysisTask): # {{{ # Xylar Asay-Davis def __init__(self, config, mpasClimatologyTask, - controlConfig=None): # {{{ + controlConfig=None): """ Construct the analysis task. @@ -146,11 +146,9 @@ def __init__(self, config, mpasClimatologyTask, galleryName=galleryName) self.add_subtask(subtask) - # }}} - # }}} -class RemapSSHClimatology(RemapMpasClimatologySubtask): # {{{ +class RemapSSHClimatology(RemapMpasClimatologySubtask): """ Change units from m to cm """ @@ -158,7 +156,7 @@ class RemapSSHClimatology(RemapMpasClimatologySubtask): # {{{ # ------- # Xylar Asay-Davis - def customize_masked_climatology(self, climatology, season): # {{{ + def customize_masked_climatology(self, climatology, season): """ Mask the melt rates using ``landIceMask`` and rescale it to m/yr @@ -185,12 +183,10 @@ def customize_masked_climatology(self, climatology, season): # {{{ # scale the field to cm from m climatology[fieldName] = constants.cm_per_m * climatology[fieldName] - return climatology # }}} + return climatology - # }}} - -class RemapObservedSSHClimatology(RemapObservedClimatologySubtask): # {{{ +class RemapObservedSSHClimatology(RemapObservedClimatologySubtask): """ A subtask for reading and remapping SSH observations """ @@ -198,7 +194,7 @@ class RemapObservedSSHClimatology(RemapObservedClimatologySubtask): # {{{ # ------- # Xylar Asay-Davis - def get_observation_descriptor(self, fileName): # {{{ + def get_observation_descriptor(self, fileName): ''' get a MeshDescriptor for the observation grid @@ -221,9 +217,9 @@ def get_observation_descriptor(self, fileName): # {{{ obsDescriptor = LatLonGridDescriptor.read(fileName=fileName, latVarName='lat', lonVarName='lon') - return obsDescriptor # }}} + return obsDescriptor - def build_observational_dataset(self, fileName): # {{{ + def build_observational_dataset(self, fileName): ''' read in the data sets for observations, and possibly rename some variables and dimensions @@ -251,8 +247,4 @@ def build_observational_dataset(self, fileName): # {{{ # scale the field to cm from m dsObs['zos'] = constants.cm_per_m * dsObs['zos'] - return dsObs # }}} - - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python + return dsObs diff --git a/mpas_analysis/ocean/climatology_map_sss.py b/mpas_analysis/ocean/climatology_map_sss.py index 7e508450d..cec650391 100644 --- a/mpas_analysis/ocean/climatology_map_sss.py +++ b/mpas_analysis/ocean/climatology_map_sss.py @@ -23,7 +23,7 @@ PlotClimatologyMapSubtask -class ClimatologyMapSSS(AnalysisTask): # {{{ +class ClimatologyMapSSS(AnalysisTask): """ An analysis task for comparison of sea surface salinity (sss) against observations @@ -33,7 +33,7 @@ class ClimatologyMapSSS(AnalysisTask): # {{{ # Luke Van Roekel, Xylar Asay-Davis, Milena Veneziani def __init__(self, config, mpasClimatologyTask, - controlConfig=None): # {{{ + controlConfig=None): """ Construct the analysis task. @@ -143,11 +143,9 @@ def __init__(self, config, mpasClimatologyTask, galleryName=galleryName) self.add_subtask(subtask) - # }}} - # }}} -class RemapObservedSSSClimatology(RemapObservedClimatologySubtask): # {{{ +class RemapObservedSSSClimatology(RemapObservedClimatologySubtask): """ A subtask for reading and remapping SSS observations """ @@ -155,7 +153,7 @@ class RemapObservedSSSClimatology(RemapObservedClimatologySubtask): # {{{ # ------- # Luke Van Roekel, Xylar Asay-Davis, Milena Veneziani - def get_observation_descriptor(self, fileName): # {{{ + def get_observation_descriptor(self, fileName): ''' get a MeshDescriptor for the observation grid @@ -178,9 +176,9 @@ def get_observation_descriptor(self, fileName): # {{{ obsDescriptor = LatLonGridDescriptor.read(fileName=fileName, latVarName='lat', lonVarName='lon') - return obsDescriptor # }}} + return obsDescriptor - def build_observational_dataset(self, fileName): # {{{ + def build_observational_dataset(self, fileName): ''' read in the data sets for observations, and possibly rename some variables and dimensions @@ -208,8 +206,4 @@ def build_observational_dataset(self, fileName): # {{{ dsObs.coords['month'] = dsObs['Time.month'] dsObs.coords['year'] = dsObs['Time.year'] - return dsObs # }}} - - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python + return dsObs diff --git a/mpas_analysis/ocean/climatology_map_sst.py b/mpas_analysis/ocean/climatology_map_sst.py index afe20ef75..039f55c8b 100644 --- a/mpas_analysis/ocean/climatology_map_sst.py +++ b/mpas_analysis/ocean/climatology_map_sst.py @@ -24,7 +24,7 @@ PlotClimatologyMapSubtask -class ClimatologyMapSST(AnalysisTask): # {{{ +class ClimatologyMapSST(AnalysisTask): """ An analysis task for comparison of sea surface temperature (sst) against observations @@ -34,7 +34,7 @@ class ClimatologyMapSST(AnalysisTask): # {{{ # Luke Van Roekel, Xylar Asay-Davis, Milena Veneziani def __init__(self, config, mpasClimatologyTask, - controlConfig=None): # {{{ + controlConfig=None): """ Construct the analysis task. @@ -152,11 +152,9 @@ def __init__(self, config, mpasClimatologyTask, galleryName=galleryName) self.add_subtask(subtask) - # }}} - # }}} -class RemapObservedSSTClimatology(RemapObservedClimatologySubtask): # {{{ +class RemapObservedSSTClimatology(RemapObservedClimatologySubtask): """ A subtask for reading and remapping SST observations """ @@ -164,7 +162,7 @@ class RemapObservedSSTClimatology(RemapObservedClimatologySubtask): # {{{ # ------- # Luke Van Roekel, Xylar Asay-Davis, Milena Veneziani - def get_observation_descriptor(self, fileName): # {{{ + def get_observation_descriptor(self, fileName): ''' get a MeshDescriptor for the observation grid @@ -187,9 +185,9 @@ def get_observation_descriptor(self, fileName): # {{{ obsDescriptor = LatLonGridDescriptor.read(fileName=fileName, latVarName='lat', lonVarName='lon') - return obsDescriptor # }}} + return obsDescriptor - def build_observational_dataset(self, fileName): # {{{ + def build_observational_dataset(self, fileName): ''' read in the data sets for observations, and possibly rename some variables and dimensions @@ -220,8 +218,4 @@ def build_observational_dataset(self, fileName): # {{{ dsObs.coords['month'] = dsObs['Time.month'] dsObs.coords['year'] = dsObs['Time.year'] - return dsObs # }}} - - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python + return dsObs diff --git a/mpas_analysis/ocean/climatology_map_woa.py b/mpas_analysis/ocean/climatology_map_woa.py index 37bffd914..ca14c9895 100644 --- a/mpas_analysis/ocean/climatology_map_woa.py +++ b/mpas_analysis/ocean/climatology_map_woa.py @@ -32,7 +32,7 @@ from mpas_analysis.shared.climatology import RemapObservedClimatologySubtask -class ClimatologyMapWoa(AnalysisTask): # {{{ +class ClimatologyMapWoa(AnalysisTask): """ An analysis task for comparison of polar and global temperature and salinity against WOA18 climatology fields @@ -42,7 +42,7 @@ class ClimatologyMapWoa(AnalysisTask): # {{{ # Milena Veneziani def __init__(self, config, mpasClimatologyTask, - controlConfig=None): # {{{ + controlConfig=None): """ Construct the analysis task. @@ -254,13 +254,10 @@ def __init__(self, config, mpasClimatologyTask, configSectionName=configSectionName) self.add_subtask(subtask) - # }}} - - # }}} class RemapWoaClimatology(RemapObservedClimatologySubtask): - # {{{ + """ A subtask for reading and remapping WOA fields to the comparison grid """ @@ -272,7 +269,7 @@ def __init__(self, parentTask, seasons, fileName, outFilePrefix, fieldNames, depths, comparisonGridNames=['latlon'], subtaskName='remapObservations'): - # {{{ + ''' An analysis task for remapping WOA fields (either annual or monthly mean) to the comparison grid(s), depths and seasons provided @@ -319,9 +316,8 @@ def __init__(self, parentTask, seasons, fileName, outFilePrefix, super(RemapWoaClimatology, self).__init__( parentTask, seasons, fileName, outFilePrefix, comparisonGridNames, subtaskName) - # }}} - def get_observation_descriptor(self, fileName): # {{{ + def get_observation_descriptor(self, fileName): ''' get a MeshDescriptor for the observation grid @@ -348,9 +344,9 @@ def get_observation_descriptor(self, fileName): # {{{ latVarName='lat', lonVarName='lon') dsObs.close() - return obsDescriptor # }}} + return obsDescriptor - def build_observational_dataset(self, fileName): # {{{ + def build_observational_dataset(self, fileName): ''' read in the data sets for observations, and possibly rename some variables and dimensions @@ -398,8 +394,4 @@ def build_observational_dataset(self, fileName): # {{{ dsObs = xr.Dataset(data_vars=data_vars, coords={'depthSlice': depthNames}) - return dsObs # }}} - - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python + return dsObs diff --git a/mpas_analysis/ocean/compute_anomaly_subtask.py b/mpas_analysis/ocean/compute_anomaly_subtask.py index 2e6495aee..2f7568721 100644 --- a/mpas_analysis/ocean/compute_anomaly_subtask.py +++ b/mpas_analysis/ocean/compute_anomaly_subtask.py @@ -63,7 +63,7 @@ class ComputeAnomalySubtask(AnalysisTask): def __init__(self, parentTask, mpasTimeSeriesTask, outFileName, variableList, movingAveragePoints, - subtaskName='computeAnomaly', alter_dataset=None): # {{{ + subtaskName='computeAnomaly', alter_dataset=None): """ Construct the analysis task. @@ -118,9 +118,7 @@ def __init__(self, parentTask, mpasTimeSeriesTask, outFileName, self.alter_dataset = alter_dataset - # }}} - - def setup_and_check(self): # {{{ + def setup_and_check(self): """ Perform steps to set up the analysis and check for errors in the setup. """ @@ -152,9 +150,7 @@ def setup_and_check(self): # {{{ self.inputFile = self.mpasTimeSeriesTask.outputFile - # }}} - - def run_task(self): # {{{ + def run_task(self): """ Performs analysis of ocean heat content (OHC) from time-series output. """ @@ -196,8 +192,4 @@ def run_task(self): # {{{ outFileName = '{}/{}'.format(baseDirectory, outFileName) - write_netcdf(ds, outFileName) # }}} - - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python + write_netcdf(ds, outFileName) diff --git a/mpas_analysis/ocean/compute_transects_subtask.py b/mpas_analysis/ocean/compute_transects_subtask.py index b33611f5e..81d6d616c 100644 --- a/mpas_analysis/ocean/compute_transects_subtask.py +++ b/mpas_analysis/ocean/compute_transects_subtask.py @@ -36,7 +36,7 @@ from mpas_analysis.shared.interpolation import interp_1d -class ComputeTransectsSubtask(RemapMpasClimatologySubtask): # {{{ +class ComputeTransectsSubtask(RemapMpasClimatologySubtask): """ A subtask for remapping climatologies to transect points @@ -86,7 +86,6 @@ def __init__(self, mpasClimatologyTask, parentTask, climatologyName, verticalComparisonGridName='obs', verticalComparisonGrid=None, subtaskName='remapTransects'): - # {{{ """ Construct the analysis task and adds it as a subtask of the ``parentTask``. @@ -165,9 +164,7 @@ def __init__(self, mpasClimatologyTask, parentTask, climatologyName, raise ValueError('If the horizontal comparison grid is "mpas", the ' 'vertical grid must also be "mpas".') - # }}} - - def setup_and_check(self): # {{{ + def setup_and_check(self): """ Creates a PointCollectionDescriptor describing all the points in the transects to remap to. Keeps track of which transects index each point @@ -223,7 +220,7 @@ def setup_and_check(self): # {{{ # (RemapMpasClimatologySubtask) super().setup_and_check() - def run_task(self): # {{{ + def run_task(self): """ Compute climatologies of melt rates from E3SM/MPAS output @@ -286,9 +283,7 @@ def run_task(self): # {{{ dsMesh.close() - # }}} - - def customize_masked_climatology(self, climatology, season): # {{{ + def customize_masked_climatology(self, climatology, season): """ Add zMid to the climatologies @@ -324,10 +319,10 @@ def customize_masked_climatology(self, climatology, season): # {{{ climatology = climatology.transpose('nVertLevels', 'nCells') - return climatology # }}} + return climatology def customize_remapped_climatology(self, climatology, comparisonGridNames, - season): # {{{ + season): """ Add the transect index to the data set @@ -364,7 +359,7 @@ def customize_remapped_climatology(self, climatology, comparisonGridNames, dims.append('nv') climatology = climatology.transpose(*dims) - return climatology # }}} + return climatology def _vertical_interp(self, ds, transectIndex, dsObs, outFileName, outObsFileName): @@ -427,9 +422,9 @@ def _vertical_interp(self, ds, transectIndex, dsObs, outFileName, write_netcdf(dsObs, outObsFileName) ds = ds.drop_vars(['validMask', 'transectNumber']) - write_netcdf(ds, outFileName) # }}} + write_netcdf(ds, outFileName) - def get_mpas_transect_file_name(self, transectName): # {{{ + def get_mpas_transect_file_name(self, transectName): """Get the file name for a masked MPAS transect info""" # Authors # ------- @@ -452,9 +447,9 @@ def get_mpas_transect_file_name(self, transectName): # {{{ fileName = '{}/mpas_transect_info.nc'.format(directory) - return fileName # }}} + return fileName - def _compute_mpas_transects(self, dsMesh): # {{{ + def _compute_mpas_transects(self, dsMesh): # see if all transects have already been computed allExist = True @@ -557,9 +552,7 @@ def _compute_mpas_transects(self, dsMesh): # {{{ season, comparisonGridName=transectName) dsOnMpas.to_netcdf(outFileName) - # }}} - - def _interp_obs_to_mpas(self, da, dsMpasTransect, threshold=0.1): # {{{ + def _interp_obs_to_mpas(self, da, dsMpasTransect, threshold=0.1): """ Interpolate observations to the native MPAS transect with masking """ @@ -570,12 +563,10 @@ def _interp_obs_to_mpas(self, da, dsMpasTransect, threshold=0.1): # {{{ daMask = interp_transect_grid_to_transect_triangle_nodes( dsMpasTransect, daMask) da = (da / daMask).where(daMask > threshold) - return da # }}} - - # }}} + return da -class TransectsObservations(object): # {{{ +class TransectsObservations(object): """ A class for loading and manipulating transect observations @@ -606,7 +597,7 @@ class TransectsObservations(object): # {{{ # Xylar Asay-Davis def __init__(self, config, obsFileNames, horizontalResolution, - transectCollectionName): # {{{ + transectCollectionName): """ Construct the object, setting the observations dictionary to None. @@ -641,7 +632,7 @@ def __init__(self, config, obsFileNames, horizontalResolution, self.transectCollectionName = transectCollectionName def get_observations(self): - # {{{ + """ Read in and set up the observations. @@ -678,9 +669,9 @@ def get_observations(self): write_netcdf(dsObs, outFileName) obsDatasets[name] = dsObs - return obsDatasets # }}} + return obsDatasets - def build_observational_dataset(self, fileName, transectName): # {{{ + def build_observational_dataset(self, fileName, transectName): """ read in the data sets for observations, and possibly rename some variables and dimensions @@ -709,10 +700,10 @@ def build_observational_dataset(self, fileName, transectName): # {{{ # and vertical coordinate z. Override this function if these need to # be renamed from the observations file. - return dsObs # }}} + return dsObs def get_out_file_name(self, transectName, - verticalComparisonGridName='obs'): # {{{ + verticalComparisonGridName='obs'): """ Given config options, the name of a field and a string identifying the months in a seasonal climatology, returns the full path for MPAS @@ -758,9 +749,9 @@ def get_out_file_name(self, transectName, fileName = '{}/{}_{}_{}.nc'.format( remappedDirectory, self.transectCollectionName, transectSuffix, verticalComparisonGridName) - return fileName # }}} + return fileName - def _add_distance(self, dsObs): # {{{ + def _add_distance(self, dsObs): """ Add a distance coordinate for the transect. If a horizontal resolution for subdivision is provided, subdivide each segment of the transect so @@ -795,8 +786,4 @@ def _add_distance(self, dsObs): # {{{ dsObs = dsObs.drop_vars(['xIn']) dsObs = dsObs.rename({'nPointsOut': 'nPoints', 'xOut': 'x'}) - return dsObs # }}} - - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python + return dsObs diff --git a/mpas_analysis/ocean/compute_transects_with_vel_mag.py b/mpas_analysis/ocean/compute_transects_with_vel_mag.py index 620e6060f..c94f98685 100644 --- a/mpas_analysis/ocean/compute_transects_with_vel_mag.py +++ b/mpas_analysis/ocean/compute_transects_with_vel_mag.py @@ -14,7 +14,7 @@ ComputeTransectsSubtask -class ComputeTransectsWithVelMag(ComputeTransectsSubtask): # {{{ +class ComputeTransectsWithVelMag(ComputeTransectsSubtask): """ Add velocity magnitude from zonal and meridional components to observations """ @@ -22,7 +22,7 @@ class ComputeTransectsWithVelMag(ComputeTransectsSubtask): # {{{ # ------- # Xylar Asay-Davis - def customize_masked_climatology(self, climatology, season): # {{{ + def customize_masked_climatology(self, climatology, season): """ Construct velocity magnitude as part of the climatology @@ -57,9 +57,4 @@ def customize_masked_climatology(self, climatology, season): # {{{ climatology.velMag.attrs['units'] = 'm s$^{-1}$' climatology.velMag.attrs['description'] = 'velocity magnitude' - return climatology # }}} - - # }}} - - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python + return climatology diff --git a/mpas_analysis/ocean/geojson_transects.py b/mpas_analysis/ocean/geojson_transects.py index 2b4d7d139..c753090ba 100644 --- a/mpas_analysis/ocean/geojson_transects.py +++ b/mpas_analysis/ocean/geojson_transects.py @@ -20,7 +20,7 @@ from mpas_analysis.ocean.plot_transect_subtask import PlotTransectSubtask -class GeojsonTransects(AnalysisTask): # {{{ +class GeojsonTransects(AnalysisTask): """ Plot model output at transects defined by lat/lon points in a geojson file """ @@ -29,8 +29,6 @@ class GeojsonTransects(AnalysisTask): # {{{ # Xylar Asay-Davis def __init__(self, config, mpasClimatologyTask, controlConfig=None): - - # {{{ ''' Construct the analysis task and adds it as a subtask of the ``parentTask``. @@ -166,12 +164,9 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): verticalBounds=verticalBounds) self.add_subtask(subtask) - # }}} - - # }}} -class GeojsonTransectsObservations(TransectsObservations): # {{{ +class GeojsonTransectsObservations(TransectsObservations): """ A class for loading and manipulating geojson transects @@ -185,7 +180,7 @@ class GeojsonTransectsObservations(TransectsObservations): # {{{ # ------- # Xylar Asay-Davis - def build_observational_dataset(self, fileName, transectName): # {{{ + def build_observational_dataset(self, fileName, transectName): ''' read in the data sets for observations, and possibly rename some variables and dimensions @@ -225,7 +220,4 @@ def build_observational_dataset(self, fileName, transectName): # {{{ dsObs['lat'] = (('nPoints',), numpy.array(lat)) dsObs.lat.attrs['units'] = 'degrees' - return dsObs # }}} - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python + return dsObs diff --git a/mpas_analysis/ocean/hovmoller_ocean_regions.py b/mpas_analysis/ocean/hovmoller_ocean_regions.py index 1dfebc3e0..8023674ac 100644 --- a/mpas_analysis/ocean/hovmoller_ocean_regions.py +++ b/mpas_analysis/ocean/hovmoller_ocean_regions.py @@ -31,7 +31,7 @@ compute_moving_avg_anomaly_from_start -class HovmollerOceanRegions(AnalysisTask): # {{{ +class HovmollerOceanRegions(AnalysisTask): """ Compute and plot a Hovmoller diagram (depth vs. time) for regionally analyzed data. The mean of the data are computed over each region at each @@ -42,7 +42,7 @@ class HovmollerOceanRegions(AnalysisTask): # {{{ # Xylar Asay-Davis def __init__(self, config, regionMasksTask, oceanRegionalProfilesTask, - controlConfig=None): # {{{ + controlConfig=None): """ Construct the analysis task. @@ -191,8 +191,6 @@ def __init__(self, config, regionMasksTask, oceanRegionalProfilesTask, self.add_subtask(hovmollerSubtask) self.run_after(oceanRegionalProfilesTask) - # }}} - # }}} class ComputeHovmollerAnomalySubtask(AnalysisTask): @@ -217,7 +215,7 @@ class ComputeHovmollerAnomalySubtask(AnalysisTask): # Xylar Asay-Davis def __init__(self, parentTask, inFileName, outFileName, - movingAveragePoints, subtaskName='computeAnomaly'): # {{{ + movingAveragePoints, subtaskName='computeAnomaly'): """ Construct the analysis task. @@ -255,9 +253,7 @@ def __init__(self, parentTask, inFileName, outFileName, self.outFileName = outFileName self.movingAveragePoints = movingAveragePoints - # }}} - - def setup_and_check(self): # {{{ + def setup_and_check(self): """ Perform steps to set up the analysis and check for errors in the setup. """ @@ -285,9 +281,7 @@ def setup_and_check(self): # {{{ raise ValueError('Cannot meaningfully perform a rolling mean ' 'because the time series is too short.') - # }}} - - def run_task(self): # {{{ + def run_task(self): """ Performs analysis of ocean heat content (OHC) from time-series output. """ @@ -314,9 +308,4 @@ def run_task(self): # {{{ outFileName = '{}/{}'.format(baseDirectory, outFileName) - write_netcdf(ds, outFileName) # }}} - - # }}} - - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python + write_netcdf(ds, outFileName) diff --git a/mpas_analysis/ocean/index_nino34.py b/mpas_analysis/ocean/index_nino34.py index a536869f6..0a823e928 100644 --- a/mpas_analysis/ocean/index_nino34.py +++ b/mpas_analysis/ocean/index_nino34.py @@ -38,7 +38,7 @@ from mpas_analysis.shared.html import write_image_xml -class IndexNino34(AnalysisTask): # {{{ +class IndexNino34(AnalysisTask): ''' A task for computing and plotting time series and spectra of the El Nino 3.4 climate index @@ -57,7 +57,7 @@ class IndexNino34(AnalysisTask): # {{{ # Luke Van Roekel, Xylar Asay-Davis def __init__(self, config, mpasTimeSeriesTask, controlConfig=None): - # {{{ + ''' Construct the analysis task. @@ -88,9 +88,7 @@ def __init__(self, config, mpasTimeSeriesTask, controlConfig=None): self.run_after(mpasTimeSeriesTask) - # }}} - - def setup_and_check(self): # {{{ + def setup_and_check(self): ''' Perform steps to set up the analysis and check for errors in the setup. ''' @@ -141,9 +139,7 @@ def setup_and_check(self): # {{{ self.xmlFileNames.append('{}/{}.xml'.format(self.plotsDirectory, filePrefix)) - # }}} - - def run_task(self): # {{{ + def run_task(self): ''' Computes NINO34 index and plots the time series and power spectrum with 95 and 99% confidence bounds @@ -314,9 +310,7 @@ def run_task(self): # {{{ plotType='Spectra', ninoIndexNumber=ninoIndexNumber) - # }}} - - def _compute_nino34_index(self, regionSST, calendar): # {{{ + def _compute_nino34_index(self, regionSST, calendar): """ Computes nino34 index time series. It follow the standard nino34 algorithm, i.e., @@ -365,9 +359,9 @@ def _compute_nino34_index(self, regionSST, calendar): # {{{ # Compute 5 month running mean wgts = np.ones(5) / 5. - return self._running_mean(anomaly, wgts) # }}} + return self._running_mean(anomaly, wgts) - def _compute_nino34_spectra(self, nino34Index): # {{{ + def _compute_nino34_spectra(self, nino34Index): """ Computes power spectra of Nino34 index. @@ -452,9 +446,8 @@ def _compute_nino34_spectra(self, nino34Index): # {{{ 'conf95': mkov * scale * xLow, 'redNoise': mkov * scale} return spectra - # }}} - def _autocorr(self, x, t=1): # {{{ + def _autocorr(self, x, t=1): """ Computes lag one auto-correlation for the NINO34 spectra calculation @@ -472,9 +465,9 @@ def _autocorr(self, x, t=1): # {{{ # ------- # Luke Van Roekel - return np.corrcoef(np.array([x[0:len(x) - t], x[t:len(x)]])) # }}} + return np.corrcoef(np.array([x[0:len(x) - t], x[t:len(x)]])) - def _running_mean(self, inputData, wgts): # {{{ + def _running_mean(self, inputData, wgts): """ Calculates a generic weighted running mean @@ -499,14 +492,14 @@ def _running_mean(self, inputData, wgts): # {{{ for k in range(sp, nt - (sp + 1)): runningMean[k] = sum(wgts * inputData[k - sp:k + sp + 1].values) - return runningMean # }}} + return runningMean def _nino34_spectra_plot(self, spectra, title, panelTitles, outFileName, lineWidth=2, xlabel='Period (years)', ylabel=r'Power ($^o$C / cycles mo$^{-1}$)', titleFontSize=None, figsize=(9, 21), dpi=None, periodMin=1., periodMax=10.): - # {{{ + """ Plots the nino34 time series and power spectra in an image file Parameters @@ -607,13 +600,12 @@ def _nino34_spectra_plot(self, spectra, title, panelTitles, savefig(outFileName, config) plt.close() - # }}} def _nino34_timeseries_plot(self, nino34s, title, panelTitles, outFileName, xlabel='Time (years)', ylabel=r'($\degree$C)', titleFontSize=None, figsize=(9, 21), dpi=None, maxXTicks=20, lineWidth=2): - # {{{ + """ Plots the nino34 time series and power spectra in an image file @@ -687,11 +679,10 @@ def _nino34_timeseries_plot(self, nino34s, title, panelTitles, outFileName, savefig(outFileName, config) plt.close() - # }}} def _plot_nino_timeseries(self, ninoIndex, time, xlabel, ylabel, panelTitle, title_font, axis_font, - lineWidth): # {{{ + lineWidth): ''' Plot the nino time series on a subplot @@ -738,9 +729,8 @@ def _plot_nino_timeseries(self, ninoIndex, time, xlabel, ylabel, plt.xlabel(xlabel, **axis_font) if ylabel is not None: plt.ylabel(ylabel, **axis_font) - # }}} - def _write_xml(self, filePrefix, plotType, ninoIndexNumber): # {{{ + def _write_xml(self, filePrefix, plotType, ninoIndexNumber): caption = u'{} of El Niño {} Climate Index'.format(plotType, ninoIndexNumber) write_image_xml( @@ -752,7 +742,7 @@ def _write_xml(self, filePrefix, plotType, ninoIndexNumber): # {{{ groupLink='nino', thumbnailDescription=plotType, imageDescription=caption, - imageCaption=caption) # }}} + imageCaption=caption) def _plot_size_y_axis(self, x, ys, xmin, xmax): ''' @@ -790,5 +780,3 @@ def _plot_size_y_axis(self, x, ys, xmin, xmax): return maxY # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/ocean/meridional_heat_transport.py b/mpas_analysis/ocean/meridional_heat_transport.py index a0c04c5cd..0db4d9b52 100644 --- a/mpas_analysis/ocean/meridional_heat_transport.py +++ b/mpas_analysis/ocean/meridional_heat_transport.py @@ -15,7 +15,6 @@ from mpas_analysis.shared.plot import plot_vertical_section, plot_1D, savefig - from mpas_analysis.shared.io.utility import make_directories, build_obs_path from mpas_analysis.shared.io import write_netcdf @@ -25,7 +24,7 @@ get_climatology_op_directory -class MeridionalHeatTransport(AnalysisTask): # {{{ +class MeridionalHeatTransport(AnalysisTask): ''' Plot meridional heat transport from the analysis member output. @@ -38,11 +37,12 @@ class MeridionalHeatTransport(AnalysisTask): # {{{ controlconfig : mpas_tools.config.MpasConfigParser Configuration options for a control run (if any) ''' + # Authors # ------- # Mark Petersen, Milena Veneziani, Xylar Asay-Davis - def __init__(self, config, mpasClimatologyTask, controlConfig=None): # {{{ + def __init__(self, config, mpasClimatologyTask, controlConfig=None): ''' Construct the analysis task. @@ -73,9 +73,7 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): # {{{ self.controlConfig = controlConfig - # }}} - - def setup_and_check(self): # {{{ + def setup_and_check(self): ''' Perform steps to set up the analysis and check for errors in the setup. ''' @@ -142,9 +140,7 @@ def setup_and_check(self): # {{{ filePrefix)) self.filePrefixes[prefix] = filePrefix - # }}} - - def run_task(self): # {{{ + def run_task(self): """ Process MHT analysis member data if available. Plots MHT as: @@ -307,7 +303,6 @@ def run_task(self): # {{{ errArrays.extend([ncepErrGlobal, ecmwfErrGlobal]) if self.controlConfig is not None: - controlStartYear = self.controlConfig.getint('climatology', 'startYear') controlEndYear = self.controlConfig.getint('climatology', @@ -366,9 +361,7 @@ def run_task(self): # {{{ self._write_xml(filePrefix) - # }}} - - def _write_xml(self, filePrefix): # {{{ + def _write_xml(self, filePrefix): caption = 'Meridional Heat Transport' write_image_xml( config=self.config, @@ -378,8 +371,4 @@ def _write_xml(self, filePrefix): # {{{ galleryGroup='Meridional Heat Transport', groupLink='mht', imageDescription=caption, - imageCaption=caption) # }}} - - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python + imageCaption=caption) diff --git a/mpas_analysis/ocean/ocean_regional_profiles.py b/mpas_analysis/ocean/ocean_regional_profiles.py index 2cb9e16b9..ef1599208 100644 --- a/mpas_analysis/ocean/ocean_regional_profiles.py +++ b/mpas_analysis/ocean/ocean_regional_profiles.py @@ -29,7 +29,7 @@ from mpas_analysis.shared.plot import savefig, add_inset -class OceanRegionalProfiles(AnalysisTask): # {{{ +class OceanRegionalProfiles(AnalysisTask): """ Compute and plot vertical profiles of regionally analyzed data. The mean and standard deviation of the data are computed over each region. @@ -41,7 +41,7 @@ class OceanRegionalProfiles(AnalysisTask): # {{{ # ------- # Xylar Asay-Davis - def __init__(self, config, regionMasksTask, controlConfig=None): # {{{ + def __init__(self, config, regionMasksTask, controlConfig=None): """ Construct the analysis task. @@ -109,8 +109,6 @@ def __init__(self, config, regionMasksTask, controlConfig=None): # {{{ plotSubtask.run_after(combineSubtask) self.add_subtask(plotSubtask) - # }}} - def add_region_group(self, regionMasksTask, regionGroup, regionNames, fields, startYear, endYear, seasons=None): """ @@ -169,10 +167,8 @@ def add_region_group(self, regionMasksTask, regionGroup, regionNames, combineSubtask.run_after(computeSubtask) self.computeSubtasks[regionGroup][key] = computeSubtask - # }}} - -class ComputeRegionalProfileTimeSeriesSubtask(AnalysisTask): # {{{ +class ComputeRegionalProfileTimeSeriesSubtask(AnalysisTask): """ Compute regional statistics on each layer and time point of a set of MPAS fields @@ -190,7 +186,7 @@ class ComputeRegionalProfileTimeSeriesSubtask(AnalysisTask): # {{{ # Xylar Asay-Davis def __init__(self, parentTask, masksSubtask, regionGroup, regionNames, - fields, startYear, endYear): # {{{ + fields, startYear, endYear): """ Construct the analysis task. @@ -235,9 +231,8 @@ def __init__(self, parentTask, masksSubtask, regionGroup, regionNames, self.fields = fields self.startYear = startYear self.endYear = endYear - # }}} - def setup_and_check(self): # {{{ + def setup_and_check(self): """ Perform steps to set up the analysis and check for errors in the setup. @@ -261,9 +256,7 @@ def setup_and_check(self): # {{{ analysisOptionName='config_am_timeseriesstatsmonthly_enable', raiseException=True) - # }}} - - def run_task(self): # {{{ + def run_task(self): """ Compute time series of regional profiles """ @@ -427,7 +420,6 @@ def run_task(self): # {{{ dsOut['z'].attrs['units'] = 'meters' write_netcdf(dsOut, outputFileName) - # }}} @staticmethod def _masked_area_sum(cellMasks, areaCell, var): @@ -441,10 +433,8 @@ def _masked_area_sum(cellMasks, areaCell, var): total = xr.concat(totals, 'nRegions') return total - # }}} - -class CombineRegionalProfileTimeSeriesSubtask(AnalysisTask): # {{{ +class CombineRegionalProfileTimeSeriesSubtask(AnalysisTask): """ Combine individual time series into a single data set """ @@ -453,7 +443,7 @@ class CombineRegionalProfileTimeSeriesSubtask(AnalysisTask): # {{{ # Xylar Asay-Davis def __init__(self, parentTask, regionGroup, timeSeriesName, seasons, fields, - startYears, endYears): # {{{ + startYears, endYears): """ Construct the analysis task. @@ -495,9 +485,8 @@ def __init__(self, parentTask, regionGroup, timeSeriesName, seasons, fields, self.timeSeriesName = timeSeriesName self.seasons = seasons self.fields = fields - # }}} - def run_task(self): # {{{ + def run_task(self): """ Combine the time series """ @@ -580,11 +569,8 @@ def run_task(self): # {{{ dsSeason.coords['regionNames'] = regionNames write_netcdf(dsSeason, outputFileName) - # }}} - # }}} - -class PlotRegionalProfileTimeSeriesSubtask(AnalysisTask): # {{{ +class PlotRegionalProfileTimeSeriesSubtask(AnalysisTask): """ Plot a profile averaged over an ocean region and in time, along with variability in both space and time. @@ -612,7 +598,7 @@ class PlotRegionalProfileTimeSeriesSubtask(AnalysisTask): # {{{ def __init__(self, parentTask, masksSubtask, season, regionName, field, timeSeriesName, startYear, endYear, controlConfig): - # {{{ + """ Construct the analysis task. @@ -669,9 +655,8 @@ def __init__(self, parentTask, masksSubtask, season, regionName, field, self.field = field self.filePrefix = None self.xmlFileNames = [] - # }}} - def setup_and_check(self): # {{{ + def setup_and_check(self): """ Perform steps to set up the analysis and check for errors in the setup. """ @@ -692,9 +677,8 @@ def setup_and_check(self): # {{{ self.endYear) self.xmlFileNames = ['{}/{}.xml'.format(self.plotsDirectory, self.filePrefix)] - # }}} - def run_task(self): # {{{ + def run_task(self): """ Plot a depth profile with variability """ @@ -828,11 +812,10 @@ def run_task(self): # {{{ imageCaption=caption, gallery=titleFieldName, thumbnailDescription='{} {}'.format(regionName, self.season)) - # }}} def plot(self, zArrays, fieldArrays, errArrays, lineColors, lineWidths, legendText, title, xLabel, yLabel, xLim=None, yLim=None, - figureSize=(10, 4), dpi=None): # {{{ + figureSize=(10, 4), dpi=None): """ Plots a 1D line plot with error bars if available. @@ -931,9 +914,7 @@ def plot(self, zArrays, fieldArrays, errArrays, lineColors, lineWidths, plt.xlim(xLim) if yLim: plt.ylim(yLim) - return fig # }}} - - # }}} + return fig def _update_fields(fields, newFields): @@ -951,5 +932,3 @@ def _update_fields(fields, newFields): break if not found: fields.append(newFields[outer]) - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/ocean/plot_depth_integrated_time_series_subtask.py b/mpas_analysis/ocean/plot_depth_integrated_time_series_subtask.py index 7d3f3a84d..aed21f3b0 100644 --- a/mpas_analysis/ocean/plot_depth_integrated_time_series_subtask.py +++ b/mpas_analysis/ocean/plot_depth_integrated_time_series_subtask.py @@ -93,7 +93,7 @@ def __init__(self, parentTask, regionName, inFileName, outFileLabel, fieldNameInTitle, mpasFieldName, yAxisLabel, sectionName, thumbnailSuffix, imageCaption, galleryGroup, groupSubtitle, groupLink, galleryName, subtaskName=None, controlConfig=None): - # {{{ + """ Construct the analysis task. @@ -185,9 +185,7 @@ def __init__(self, parentTask, regionName, inFileName, outFileLabel, self.groupLink = groupLink self.galleryName = galleryName - # }}} - - def setup_and_check(self): # {{{ + def setup_and_check(self): """ Perform steps to set up the analysis and check for errors in the setup. """ @@ -247,9 +245,9 @@ def setup_and_check(self): # {{{ self.xmlFileNames = ['{}/{}.xml'.format( self.plotsDirectory, self.filePrefix)] - return # }}} + return - def run_task(self): # {{{ + def run_task(self): """ Compute vertical aggregates of the data and plot the time series """ @@ -492,8 +490,6 @@ def run_task(self): # {{{ imageDescription=self.imageCaption, imageCaption=self.imageCaption) - # }}} - def customize_fig(self, fig): """ A function to override to customize the figure. @@ -502,7 +498,3 @@ def customize_fig(self, fig): The figure """ pass - - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/ocean/plot_hovmoller_subtask.py b/mpas_analysis/ocean/plot_hovmoller_subtask.py index 47cacadcc..90858d854 100644 --- a/mpas_analysis/ocean/plot_hovmoller_subtask.py +++ b/mpas_analysis/ocean/plot_hovmoller_subtask.py @@ -93,7 +93,7 @@ def __init__(self, parentTask, regionName, inFileName, outFileLabel, fieldNameInTitle, mpasFieldName, unitsLabel, sectionName, thumbnailSuffix, imageCaption, galleryGroup, groupSubtitle, groupLink, galleryName, subtaskName=None, - controlConfig=None, regionMaskFile=None): # {{{ + controlConfig=None, regionMaskFile=None): """ Construct the analysis task. @@ -190,9 +190,7 @@ def __init__(self, parentTask, regionName, inFileName, outFileLabel, self.groupLink = groupLink self.galleryName = galleryName - # }}} - - def setup_and_check(self): # {{{ + def setup_and_check(self): """ Perform steps to set up the analysis and check for errors in the setup. """ @@ -234,9 +232,9 @@ def setup_and_check(self): # {{{ self.xmlFileNames = ['{}/{}.xml'.format( self.plotsDirectory, self.filePrefix)] - return # }}} + return - def run_task(self): # {{{ + def run_task(self): """ Make the Hovmoller plot from the time series. """ @@ -416,9 +414,3 @@ def run_task(self): # {{{ regionNameInTitle, self.thumbnailSuffix), imageDescription=self.imageCaption, imageCaption=self.imageCaption) - - # }}} - - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/ocean/plot_transect_subtask.py b/mpas_analysis/ocean/plot_transect_subtask.py index aaf2518f3..a83950f20 100644 --- a/mpas_analysis/ocean/plot_transect_subtask.py +++ b/mpas_analysis/ocean/plot_transect_subtask.py @@ -36,7 +36,7 @@ from mpas_analysis.shared.constants import constants -class PlotTransectSubtask(AnalysisTask): # {{{ +class PlotTransectSubtask(AnalysisTask): """ An analysis task for plotting 2D model fields against observations. @@ -106,7 +106,7 @@ class PlotTransectSubtask(AnalysisTask): # {{{ def __init__(self, parentTask, season, transectName, fieldName, computeTransectsSubtask, plotObs=True, controlConfig=None, horizontalBounds=None): - # {{{ + ''' Construct one analysis subtask for each plot (i.e. each season and comparison grid) and a subtask for computing climatologies. @@ -170,14 +170,13 @@ def __init__(self, parentTask, season, transectName, fieldName, # this task should not run until the remapping subtasks are done, since # it relies on data from those subtasks self.run_after(computeTransectsSubtask) - # }}} def set_plot_info(self, outFileLabel, fieldNameInTitle, mpasFieldName, refFieldName, refTitleLabel, unitsLabel, imageCaption, galleryGroup, groupSubtitle, groupLink, galleryName, configSectionName, verticalBounds, diffTitleLabel='Model - Observations'): - # {{{ + ''' Store attributes related to plots, plot file names and HTML output. @@ -257,9 +256,8 @@ def set_plot_info(self, outFileLabel, fieldNameInTitle, mpasFieldName, self.verticalBounds = None else: self.verticalBounds = verticalBounds - # }}} - def setup_and_check(self): # {{{ + def setup_and_check(self): """ Perform steps to set up the analysis and check for errors in the setup. """ @@ -296,9 +294,8 @@ def setup_and_check(self): # {{{ self.xmlFileNames.append('{}/{}.xml'.format(self.plotsDirectory, self.filePrefix)) - # }}} - def run_task(self): # {{{ + def run_task(self): """ Plots a comparison of ACME/MPAS output to SST, MLD or SSS observations or a control run @@ -365,10 +362,8 @@ def run_task(self): # {{{ if remappedRefClimatology is not None: remappedRefClimatology.close() - # }}} - def _plot_transect(self, remappedModelClimatology, remappedRefClimatology): - # {{{ + """ plotting the transect """ season = self.season @@ -639,10 +634,8 @@ def _plot_transect(self, remappedModelClimatology, remappedRefClimatology): imageDescription=caption, imageCaption=caption) - # }}} - def _lat_greater_extent(self, lat, lon): - # {{{ + """ Returns True if lat has a greater extent (in degrees) than lon (or the same extent as lon), and False otherwise. @@ -717,10 +710,9 @@ def _lat_greater_extent(self, lat, lon): return True else: return False - # }}} def _strictly_monotonic(self, coord): - # {{{ + """Whether the coordinate is strictly monotonic""" # Authors # ------- @@ -731,10 +723,9 @@ def _strictly_monotonic(self, coord): coord_diff = numpy.where(coord_diff < -180, coord_diff + 360, coord_diff) return numpy.all(coord_diff > 0) or numpy.all(coord_diff < 0) - # }}} def _lat_most_monotonic(self, lat, lon): - # {{{ + """ Returns True if lat is "more monotonic" than lon in terms of the difference between the total number of degrees traversed and the net @@ -756,10 +747,9 @@ def _lat_most_monotonic(self, lat, lon): return True else: return False - # }}} def _lat_most_steps_in_same_direction(self, lat, lon): - # {{{ + """ Returns True if lat is has more steps in the same direction (either steps that increase the latitude or steps that decrease the latitude) @@ -791,10 +781,9 @@ def _lat_most_steps_in_same_direction(self, lat, lon): return True else: return False - # }}} def _lat_fewest_direction_changes(self, lat, lon): - # {{{ + """ Returns True if lat is has fewer changes in direction (from increasing in value to decreasing in value, or vice versa) than lon (or if both @@ -826,7 +815,6 @@ def _lat_fewest_direction_changes(self, lat, lon): return True else: return False - # }}} def _get_ds_triangulation(self, dsTransectTriangles): """get matplotlib Triangulation from triangulation dataset""" @@ -845,8 +833,3 @@ def _get_ds_triangulation(self, dsTransectTriangles): triangulation_args = dict(x=x, y=y, triangles=tris) return triangulation_args - - # }}} - - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/ocean/regional_ts_diagrams.py b/mpas_analysis/ocean/regional_ts_diagrams.py index 168e0d06f..4d4c65cfa 100644 --- a/mpas_analysis/ocean/regional_ts_diagrams.py +++ b/mpas_analysis/ocean/regional_ts_diagrams.py @@ -47,7 +47,7 @@ from mpas_analysis.shared.plot.title import limit_title -class RegionalTSDiagrams(AnalysisTask): # {{{ +class RegionalTSDiagrams(AnalysisTask): """ Create T-S Diagrams of the climatology within a given ocean region @@ -62,7 +62,7 @@ class RegionalTSDiagrams(AnalysisTask): # {{{ def __init__(self, config, mpasClimatologyTask, regionMasksTask, controlConfig=None): - # {{{ + """ Construct the analysis task. @@ -219,9 +219,7 @@ def __init__(self, config, mpasClimatologyTask, regionMasksTask, plotRegionSubtask.run_after(computeRegionSubtask) self.add_subtask(plotRegionSubtask) - # }}} - - def setup_and_check(self): # {{{ + def setup_and_check(self): """ Perform steps to set up the analysis and check for errors in the setup. """ @@ -243,7 +241,6 @@ def setup_and_check(self): # {{{ 'timeMonthly_avg_layerThickness'] self.mpasClimatologyTask.add_variables(variableList=variableList, seasons=self.seasons) - # }}} class ComputeObsTSClimatology(AnalysisTask): @@ -262,7 +259,7 @@ class ComputeObsTSClimatology(AnalysisTask): # ------- # Xylar Asay-Davis - def __init__(self, parentTask, obsName, obsDict, season): # {{{ + def __init__(self, parentTask, obsName, obsDict, season): """ Construct the analysis task. @@ -303,9 +300,7 @@ def __init__(self, parentTask, obsName, obsDict, season): # {{{ multiprocessing.cpu_count(), self.config.getint(self.taskName, 'daskThreads')) - # }}} - - def run_task(self): # {{{ + def run_task(self): """ Plots time-series output of properties in an ocean region. """ @@ -439,7 +434,6 @@ def run_task(self): # {{{ self.logger.info(' Deleting temp file {}'.format(file_name)) os.remove(file_name) self.logger.info(' Done!') - # }}} def _get_file_name(self, obsDict, suffix=''): obsSection = '{}Observations'.format(self.componentName) @@ -455,8 +449,6 @@ def _get_file_name(self, obsDict, suffix=''): obsDict['gridName'], self.season, suffix) return fileName - # }}} - class ComputeRegionTSSubtask(AnalysisTask): """ @@ -496,7 +488,7 @@ class ComputeRegionTSSubtask(AnalysisTask): def __init__(self, parentTask, regionGroup, regionName, controlConfig, sectionName, fullSuffix, mpasClimatologyTask, mpasMasksSubtask, obsDicts, season): - # {{{ + """ Construct the analysis task. @@ -565,9 +557,8 @@ def __init__(self, parentTask, regionGroup, regionName, controlConfig, self.daskThreads = min( multiprocessing.cpu_count(), self.config.getint(self.taskName, 'daskThreads')) - # }}} - def run_task(self): # {{{ + def run_task(self): """ Plots time-series output of properties in an ocean region. """ @@ -582,7 +573,7 @@ def run_task(self): # {{{ for obsName in self.obsDicts: self._write_obs_t_s(self.obsDicts[obsName], zmin, zmax) - def _write_mpas_t_s(self, config): # {{{ + def _write_mpas_t_s(self, config): climatologyName = 'TS_{}_{}'.format(self.prefix, self.season) outFileName = get_masked_mpas_climatology_file_name( @@ -697,9 +688,9 @@ def _write_mpas_t_s(self, config): # {{{ dsOut['zbounds'] = ('nBounds', [zmin, zmax]) write_netcdf(dsOut, outFileName) - return zmin, zmax # }}} + return zmin, zmax - def _write_obs_t_s(self, obsDict, zmin, zmax): # {{{ + def _write_obs_t_s(self, obsDict, zmin, zmax): obsSection = '{}Observations'.format(self.componentName) climatologyDirectory = build_config_full_path( config=self.config, section='output', @@ -785,10 +776,6 @@ def _write_obs_t_s(self, obsDict, zmin, zmax): # {{{ dsOut['zbounds'] = ('nBounds', [zmin, zmax]) write_netcdf(dsOut, outFileName) - # }}} - - # }}} - class PlotRegionTSDiagramSubtask(AnalysisTask): """ @@ -828,7 +815,7 @@ class PlotRegionTSDiagramSubtask(AnalysisTask): def __init__(self, parentTask, regionGroup, regionName, controlConfig, sectionName, fullSuffix, mpasClimatologyTask, mpasMasksSubtask, obsDicts, season): - # {{{ + """ Construct the analysis task. @@ -897,9 +884,8 @@ def __init__(self, parentTask, regionGroup, regionName, controlConfig, self.daskThreads = min( multiprocessing.cpu_count(), self.config.getint(self.taskName, 'daskThreads')) - # }}} - def setup_and_check(self): # {{{ + def setup_and_check(self): """ Perform steps to set up the analysis and check for errors in the setup. @@ -920,9 +906,9 @@ def setup_and_check(self): # {{{ self.xmlFileNames = ['{}/TS_diagram_{}_{}.xml'.format( self.plotsDirectory, self.prefix, self.season)] - return # }}} + return - def run_task(self): # {{{ + def run_task(self): """ Plots time-series output of properties in an ocean region. """ @@ -1179,9 +1165,7 @@ def run_task(self): # {{{ imageDescription=caption, imageCaption=caption) - # }}} - - def _get_mpas_t_s(self, config): # {{{ + def _get_mpas_t_s(self, config): climatologyName = 'TS_{}_{}'.format(self.prefix, self.season) inFileName = get_masked_mpas_climatology_file_name( config, self.season, self.componentName, climatologyName, op='avg') @@ -1193,9 +1177,9 @@ def _get_mpas_t_s(self, config): # {{{ volume = ds.volume.values zmin, zmax = ds.zbounds.values - return T, S, z, volume, zmin, zmax # }}} + return T, S, z, volume, zmin, zmax - def _get_obs_t_s(self, obsDict): # {{{ + def _get_obs_t_s(self, obsDict): obsSection = '{}Observations'.format(self.componentName) climatologyDirectory = build_config_full_path( @@ -1212,9 +1196,9 @@ def _get_obs_t_s(self, obsDict): # {{{ z = ds.z.values volume = ds.volume.values - return T, S, z, volume # }}} + return T, S, z, volume - def _plot_volumetric_panel(self, T, S, volume): # {{{ + def _plot_volumetric_panel(self, T, S, volume): config = self.config sectionName = self.sectionName @@ -1235,9 +1219,9 @@ def _plot_volumetric_panel(self, T, S, volume): # {{{ else: volMin = None volMax = None - return panel, volMin, volMax # }}} + return panel, volMin, volMax - def _plot_scatter_panel(self, T, S, z, zmin, zmax): # {{{ + def _plot_scatter_panel(self, T, S, z, zmin, zmax): config = self.config sectionName = self.sectionName @@ -1248,8 +1232,4 @@ def _plot_scatter_panel(self, T, S, z, zmin, zmax): # {{{ panel = plt.scatter(S[indices], T[indices], c=z[indices], s=5, vmin=zmin, vmax=zmax, cmap=cmap, zorder=1) - return panel # }}} - - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python + return panel diff --git a/mpas_analysis/ocean/remap_depth_slices_subtask.py b/mpas_analysis/ocean/remap_depth_slices_subtask.py index 66963c4da..93b63d2a6 100644 --- a/mpas_analysis/ocean/remap_depth_slices_subtask.py +++ b/mpas_analysis/ocean/remap_depth_slices_subtask.py @@ -16,7 +16,7 @@ from mpas_analysis.ocean.utility import compute_zmid -class RemapDepthSlicesSubtask(RemapMpasClimatologySubtask): # {{{ +class RemapDepthSlicesSubtask(RemapMpasClimatologySubtask): """ A task for creating and remapping climatologies of MPAS fields sliced at a given set of depths @@ -40,7 +40,7 @@ class RemapDepthSlicesSubtask(RemapMpasClimatologySubtask): # {{{ def __init__(self, mpasClimatologyTask, parentTask, climatologyName, variableList, seasons, depths, comparisonGridNames=['latlon'], iselValues=None): - # {{{ + ''' Construct the analysis task and adds it as a subtask of the ``parentTask``. @@ -91,7 +91,7 @@ def __init__(self, mpasClimatologyTask, parentTask, climatologyName, mpasClimatologyTask, parentTask, climatologyName, variableList, seasons, comparisonGridNames, iselValues) - def run_task(self): # {{{ + def run_task(self): """ Compute climatologies of T or S from ACME/MPAS output @@ -168,7 +168,7 @@ def run_task(self): # {{{ # which will perform the main function of the task super(RemapDepthSlicesSubtask, self).run_task() - def customize_masked_climatology(self, climatology, season): # {{{ + def customize_masked_climatology(self, climatology, season): """ Uses ``verticalIndex`` to slice the 3D climatology field at each requested depth. The resulting field has the depth appended to @@ -220,9 +220,4 @@ def customize_masked_climatology(self, climatology, season): # {{{ climatology = climatology.transpose('depthSlice', 'nCells') - return climatology # }}} - - # }}} - - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python + return climatology diff --git a/mpas_analysis/ocean/remap_sose_climatology.py b/mpas_analysis/ocean/remap_sose_climatology.py index 97974192b..6bdbf6b7b 100644 --- a/mpas_analysis/ocean/remap_sose_climatology.py +++ b/mpas_analysis/ocean/remap_sose_climatology.py @@ -25,7 +25,7 @@ class RemapSoseClimatology(RemapObservedClimatologySubtask): - # {{{ + """ A subtask for reading and remapping SOSE fields to the comparison grid """ @@ -37,7 +37,7 @@ def __init__(self, parentTask, seasons, fileName, outFilePrefix, fieldName, botFieldName=None, depths=None, comparisonGridNames=['latlon'], subtaskName='remapObservations'): - # {{{ + ''' Construct one analysis subtask for each plot (i.e. each season and comparison grid) and a subtask for computing climatologies. @@ -91,9 +91,8 @@ def __init__(self, parentTask, seasons, fileName, outFilePrefix, super(RemapSoseClimatology, self).__init__( parentTask, seasons, fileName, outFilePrefix, comparisonGridNames, subtaskName) - # }}} - def get_observation_descriptor(self, fileName): # {{{ + def get_observation_descriptor(self, fileName): ''' get a MeshDescriptor for the observation grid @@ -116,9 +115,9 @@ def get_observation_descriptor(self, fileName): # {{{ projection = get_pyproj_projection(comparison_grid_name='antarctic') obsDescriptor = ProjectionGridDescriptor.read( projection, fileName=fileName, xVarName='x', yVarName='y') - return obsDescriptor # }}} + return obsDescriptor - def build_observational_dataset(self, fileName): # {{{ + def build_observational_dataset(self, fileName): ''' read in the data sets for observations, and possibly rename some variables and dimensions @@ -166,8 +165,4 @@ def build_observational_dataset(self, fileName): # {{{ dsObs = xr.Dataset(data_vars={self.fieldName: field}, coords={'depthSlice': depthNames}) - return dsObs # }}} - - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python + return dsObs diff --git a/mpas_analysis/ocean/sose_transects.py b/mpas_analysis/ocean/sose_transects.py index cef2efc4a..31cc89365 100644 --- a/mpas_analysis/ocean/sose_transects.py +++ b/mpas_analysis/ocean/sose_transects.py @@ -28,18 +28,17 @@ from mpas_analysis.shared.io import write_netcdf -class SoseTransects(AnalysisTask): # {{{ +class SoseTransects(AnalysisTask): """ Plot model output at WOCE transects and compare it against WOCE observations """ + # Authors # ------- # Xylar Asay-Davis def __init__(self, config, mpasClimatologyTask, controlConfig=None): - - # {{{ ''' Construct the analysis task and adds it as a subtask of the ``parentTask``. @@ -206,12 +205,9 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): verticalBounds=verticalBounds) self.add_subtask(subtask) - # }}} - - # }}} -class SoseTransectsObservations(TransectsObservations): # {{{ +class SoseTransectsObservations(TransectsObservations): """ A class for loading and manipulating SOSE transect data @@ -221,13 +217,14 @@ class SoseTransectsObservations(TransectsObservations): # {{{ fields : list of dict dictionaries defining the fields with associated SOSE data """ + # Authors # ------- # Xylar Asay-Davis def __init__(self, config, horizontalResolution, transectCollectionName, fields): - # {{{ + ''' Construct the object, setting the observations dictionary to None. @@ -262,9 +259,7 @@ def __init__(self, config, horizontalResolution, self.fields = fields - # }}} - - def get_observations(self): # {{{ + def get_observations(self): ''' Read in and set up the observations. @@ -282,9 +277,9 @@ def get_observations(self): # {{{ self.combine_observations() # then, call the method from the parent class - return super(SoseTransectsObservations, self).get_observations() # }}} + return super(SoseTransectsObservations, self).get_observations() - def combine_observations(self): # {{{ + def combine_observations(self): ''' Combine SOSE oservations into a single file ''' @@ -334,7 +329,7 @@ def combine_observations(self): # {{{ fileName = '{}/SOSE_2005-2010_monthly_{}_SouthernOcean' \ '_0.167x0.167degree_20180710.nc'.format( - observationsDirectory, prefix) + observationsDirectory, prefix) dsLocal = xr.open_dataset(fileName) @@ -374,7 +369,7 @@ def combine_observations(self): # {{{ 'from 2005-2010 average of the Southern Ocean ' \ 'State Estimate (SOSE)' dsObs['velMag'] = numpy.sqrt( - dsObs.zonalVel**2 + dsObs.meridVel**2) + dsObs.zonalVel ** 2 + dsObs.meridVel ** 2) dsObs.velMag.attrs['units'] = 'm s$^{-1}$' dsObs.velMag.attrs['description'] = description @@ -387,9 +382,7 @@ def combine_observations(self): # {{{ print(' Done.') - # }}} - - def build_observational_dataset(self, fileName, transectName): # {{{ + def build_observational_dataset(self, fileName, transectName): ''' read in the data sets for observations, and possibly rename some variables and dimensions @@ -426,9 +419,4 @@ def build_observational_dataset(self, fileName, transectName): # {{{ dsObs['lon'] = ('nPoints', lon * numpy.ones(dsObs.sizes['nPoints'])) dsObs = dsObs.drop_vars(['nPoints', 'nz']) - return dsObs # }}} - - # }}} - - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python + return dsObs diff --git a/mpas_analysis/ocean/streamfunction_moc.py b/mpas_analysis/ocean/streamfunction_moc.py index 3106e2139..afebab6a3 100644 --- a/mpas_analysis/ocean/streamfunction_moc.py +++ b/mpas_analysis/ocean/streamfunction_moc.py @@ -38,7 +38,7 @@ from mpas_analysis.shared.regions import ComputeRegionMasksSubtask -class StreamfunctionMOC(AnalysisTask): # {{{ +class StreamfunctionMOC(AnalysisTask): """ Computation and plotting of model meridional overturning circulation. Will eventually support: @@ -52,7 +52,7 @@ class StreamfunctionMOC(AnalysisTask): # {{{ # ------- # Milena Veneziani, Mark Petersen, Phillip Wolfram, Xylar Asay-Davis - def __init__(self, config, mpasClimatologyTask, controlConfig=None): # {{{ + def __init__(self, config, mpasClimatologyTask, controlConfig=None): """ Construct the analysis task. @@ -113,11 +113,8 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): # {{{ plotTimeSeriesSubtask = PlotMOCTimeSeriesSubtask(self, controlConfig) plotTimeSeriesSubtask.run_after(combineTimeSeriesSubtask) - # }}} - # }}} - -class ComputeMOCMasksSubtask(ComputeRegionMasksSubtask): # {{{ +class ComputeMOCMasksSubtask(ComputeRegionMasksSubtask): """ An analysis subtasks for computing cell masks and southern transects for MOC regions @@ -127,7 +124,7 @@ class ComputeMOCMasksSubtask(ComputeRegionMasksSubtask): # {{{ # Xylar Asay-Davis def __init__(self, parentTask): - # {{{ + """ Construct the analysis task and adds it as a subtask of the ``parentTask``. @@ -156,9 +153,7 @@ def __init__(self, parentTask): self.maskAndTransectFileName = None - # }}} - - def setup_and_check(self): # {{{ + def setup_and_check(self): """ Perform steps to set up the analysis and check for errors in the setup. @@ -179,9 +174,8 @@ def setup_and_check(self): # {{{ self.maskAndTransectFileName = get_region_mask( self.config, '{}_mocBasinsAndTransects{}.nc'.format( self.meshName, self.date)) - # }}} - def run_task(self): # {{{ + def run_task(self): """ Compute the requested climatologies """ @@ -205,11 +199,10 @@ def run_task(self): # {{{ write_netcdf(dsMasksAndTransects, self.maskAndTransectFileName, char_dim_name='StrLen') - # }}} # }}} -class ComputeMOCClimatologySubtask(AnalysisTask): # {{{ +class ComputeMOCClimatologySubtask(AnalysisTask): """ Computation of a climatology of the model meridional overturning circulation. @@ -225,7 +218,7 @@ class ComputeMOCClimatologySubtask(AnalysisTask): # {{{ # ------- # Milena Veneziani, Mark Petersen, Phillip Wolfram, Xylar Asay-Davis - def __init__(self, parentTask, mpasClimatologyTask, maskSubtask): # {{{ + def __init__(self, parentTask, mpasClimatologyTask, maskSubtask): """ Construct the analysis task. @@ -259,9 +252,8 @@ def __init__(self, parentTask, mpasClimatologyTask, maskSubtask): # {{{ self.run_after(maskSubtask) parentTask.add_subtask(self) - # }}} - def setup_and_check(self): # {{{ + def setup_and_check(self): """ Perform steps to set up the analysis and check for errors in the setup. @@ -321,9 +313,7 @@ def setup_and_check(self): # {{{ self.mpasClimatologyTask.add_variables(variableList=variableList, seasons=['ANN']) - # }}} - - def run_task(self): # {{{ + def run_task(self): """ Process MOC analysis member data if available, or compute MOC at post-processing if not. @@ -341,9 +331,7 @@ def run_task(self): # {{{ else: self._compute_moc_climo_postprocess() - # }}} - - def _compute_moc_climo_analysismember(self): # {{{ + def _compute_moc_climo_analysismember(self): """compute mean MOC streamfunction from analysis member""" config = self.config @@ -473,9 +461,8 @@ def _compute_moc_climo_analysismember(self): # {{{ depthVar.units = 'meters' depthVar[:] = depth ncFile.close() - # }}} - def _compute_moc_climo_postprocess(self): # {{{ + def _compute_moc_climo_postprocess(self): """compute mean MOC streamfunction as a post-process""" config = self.config @@ -612,12 +599,9 @@ def _compute_moc_climo_postprocess(self): # {{{ depthVar.units = 'meters' depthVar[:] = depth ncFile.close() - # }}} - - # }}} -class PlotMOCClimatologySubtask(AnalysisTask): # {{{ +class PlotMOCClimatologySubtask(AnalysisTask): """ Computation of a climatology of the model meridional overturning circulation. @@ -626,7 +610,7 @@ class PlotMOCClimatologySubtask(AnalysisTask): # {{{ # ------- # Milena Veneziani, Mark Petersen, Phillip Wolfram, Xylar Asay-Davis - def __init__(self, parentTask, controlConfig): # {{{ + def __init__(self, parentTask, controlConfig): """ Construct the analysis task. @@ -653,9 +637,8 @@ def __init__(self, parentTask, controlConfig): # {{{ parentTask.add_subtask(self) self.controlConfig = controlConfig - # }}} - def setup_and_check(self): # {{{ + def setup_and_check(self): """ Perform steps to set up the analysis and check for errors in the setup. @@ -699,9 +682,7 @@ def setup_and_check(self): # {{{ filePrefix)) self.filePrefixes[region] = filePrefix - # }}} - - def run_task(self): # {{{ + def run_task(self): """ Plot the MOC climatology """ @@ -788,9 +769,9 @@ def run_task(self): # {{{ groupLink='moc', thumbnailDescription=region, imageDescription=caption, - imageCaption=caption) # }}} + imageCaption=caption) - def _load_moc(self, config): # {{{ + def _load_moc(self, config): """compute mean MOC streamfunction from analysis member""" startYear = config.getint('climatology', 'startYear') @@ -812,12 +793,10 @@ def _load_moc(self, config): # {{{ for region in self.regionNames: lat[region] = ds['lat{}'.format(region)] moc[region] = ds['moc{}'.format(region)] - return depth, lat, moc # }}} + return depth, lat, moc - # }}} - -class ComputeMOCTimeSeriesSubtask(AnalysisTask): # {{{ +class ComputeMOCTimeSeriesSubtask(AnalysisTask): """ Computation of a time series of max Atlantic MOC at 26.5N. """ @@ -825,7 +804,7 @@ class ComputeMOCTimeSeriesSubtask(AnalysisTask): # {{{ # ------- # Milena Veneziani, Mark Petersen, Phillip Wolfram, Xylar Asay-Davis - def __init__(self, parentTask, startYear, endYear, maskSubtask): # {{{ + def __init__(self, parentTask, startYear, endYear, maskSubtask): """ Construct the analysis task. @@ -863,9 +842,8 @@ def __init__(self, parentTask, startYear, endYear, maskSubtask): # {{{ parentTask.add_subtask(self) self.startYear = startYear self.endYear = endYear - # }}} - def setup_and_check(self): # {{{ + def setup_and_check(self): """ Perform steps to set up the analysis and check for errors in the setup. @@ -916,9 +894,8 @@ def setup_and_check(self): # {{{ self.variableList.extend( ['timeMonthly_avg_normalGMBolusVelocity', 'timeMonthly_avg_vertGMBolusVelocityTop']) - # }}} - def run_task(self): # {{{ + def run_task(self): """ Process MOC analysis member data if available, or compute MOC at post-processing if not. @@ -938,9 +915,8 @@ def run_task(self): # {{{ self._compute_moc_time_series_analysismember() else: self._compute_moc_time_series_postprocess() - # }}} - def _compute_moc_time_series_analysismember(self): # {{{ + def _compute_moc_time_series_analysismember(self): """compute MOC time series from analysis member""" # Compute and plot time series of Atlantic MOC at 26.5N (RAPID array) @@ -1076,9 +1052,8 @@ def _compute_moc_time_series_analysismember(self): # {{{ 'description': description}}}} dsMOCTimeSeries = xr.Dataset.from_dict(dictonary) write_netcdf(dsMOCTimeSeries, outputFileName) - # }}} - def _compute_moc_time_series_postprocess(self): # {{{ + def _compute_moc_time_series_postprocess(self): """compute MOC time series as a post-process""" config = self.config @@ -1235,11 +1210,9 @@ def _compute_moc_time_series_postprocess(self): # {{{ 'description': description}}}} dsMOCTimeSeries = xr.Dataset.from_dict(dictonary) write_netcdf(dsMOCTimeSeries, outputFileName) - # }}} - # }}} -class CombineMOCTimeSeriesSubtask(AnalysisTask): # {{{ +class CombineMOCTimeSeriesSubtask(AnalysisTask): """ Combine individual time series of max Atlantic MOC at 26.5N into a single data set @@ -1248,7 +1221,7 @@ class CombineMOCTimeSeriesSubtask(AnalysisTask): # {{{ # ------- # Xylar Asay-Davis - def __init__(self, parentTask, startYears, endYears): # {{{ + def __init__(self, parentTask, startYears, endYears): """ Construct the analysis task. @@ -1275,9 +1248,8 @@ def __init__(self, parentTask, startYears, endYears): # {{{ parentTask.add_subtask(self) self.startYears = startYears self.endYears = endYears - # }}} - def run_task(self): # {{{ + def run_task(self): """ Plot the MOC time series """ @@ -1310,11 +1282,10 @@ def run_task(self): # {{{ ds.load() - write_netcdf(ds, outputFileName) # }}} - # }}} + write_netcdf(ds, outputFileName) -class PlotMOCTimeSeriesSubtask(AnalysisTask): # {{{ +class PlotMOCTimeSeriesSubtask(AnalysisTask): """ Plots a time series of max Atlantic MOC at 26.5N. """ @@ -1322,7 +1293,7 @@ class PlotMOCTimeSeriesSubtask(AnalysisTask): # {{{ # ------- # Milena Veneziani, Mark Petersen, Phillip Wolfram, Xylar Asay-Davis - def __init__(self, parentTask, controlConfig): # {{{ + def __init__(self, parentTask, controlConfig): """ Construct the analysis task. @@ -1349,9 +1320,8 @@ def __init__(self, parentTask, controlConfig): # {{{ parentTask.add_subtask(self) self.controlConfig = controlConfig - # }}} - def setup_and_check(self): # {{{ + def setup_and_check(self): """ Perform steps to set up the analysis and check for errors in the setup. @@ -1382,9 +1352,7 @@ def setup_and_check(self): # {{{ filePrefix)] self.filePrefix = filePrefix - # }}} - - def run_task(self): # {{{ + def run_task(self): """ Plot the MOC time series """ @@ -1466,9 +1434,7 @@ def run_task(self): # {{{ imageDescription=caption, imageCaption=caption) - # }}} - - def _load_moc(self, config): # {{{ + def _load_moc(self, config): """compute mean MOC streamfunction from analysis member""" outputDirectory = build_config_full_path(config, 'output', @@ -1481,12 +1447,10 @@ def _load_moc(self, config): # {{{ outputDirectory, startYear, endYear) dsMOCTimeSeries = xr.open_dataset(inputFileName, decode_times=False) - return dsMOCTimeSeries # }}} + return dsMOCTimeSeries - # }}} - -def _load_mesh(runStreams): # {{{ +def _load_mesh(runStreams): # Load mesh related variables try: restartFile = runStreams.readpath('restart')[0] @@ -1510,12 +1474,9 @@ def _load_mesh(runStreams): # {{{ return dvEdge, areaCell, refBottomDepth, latCell, nVertLevels, \ refTopDepth, refLayerThickness - # }}} def _build_region_mask_dict(regionMaskFile, regionNames, mpasMeshName, logger): - # {{{ - if not os.path.exists(regionMaskFile): raise IOError('Regional masking file {} for MOC calculation ' 'does not exist'.format(regionMaskFile)) @@ -1550,12 +1511,12 @@ def _build_region_mask_dict(regionMaskFile, regionNames, mpasMeshName, logger): 'transectEdgeMaskSigns': transectEdgeMaskSigns, 'transectEdgeGlobalIDs': transectEdgeGlobalIDs} - return dictRegion # }}} + return dictRegion def _compute_transport(maxEdgesInTransect, transectEdgeGlobalIDs, transectEdgeMaskSigns, nz, dvEdge, - refLayerThickness, horizontalVel): # {{{ + refLayerThickness, horizontalVel): """compute mass transport across southern transect of ocean basin""" transportZEdge = np.zeros([nz, maxEdgesInTransect]) @@ -1569,11 +1530,11 @@ def _compute_transport(maxEdgesInTransect, transectEdgeGlobalIDs, dvEdge[iEdge, np.newaxis] * \ refLayerThickness[np.newaxis, :] transportZ = transportZEdge.sum(axis=1) - return transportZ # }}} + return transportZ def _compute_moc(latBins, nz, latCell, regionCellMask, transportZ, - velArea): # {{{ + velArea): """compute meridionally integrated MOC streamfunction""" mocTop = np.zeros([np.size(latBins), nz + 1]) @@ -1587,7 +1548,7 @@ def _compute_moc(latBins, nz, latCell, regionCellMask, transportZ, # convert m^3/s to Sverdrup mocTop = mocTop * m3ps_to_Sv mocTop = mocTop.T - return mocTop # }}} + return mocTop def _interp_moc(x, z, regionMOC, refX, refZ, refMOC): @@ -1613,5 +1574,3 @@ def _interp_moc(x, z, regionMOC, refX, refZ, refMOC): left=np.nan, right=np.nan) return xr.DataArray(dims=dims, data=refRegionMOC) - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/ocean/time_series_antarctic_melt.py b/mpas_analysis/ocean/time_series_antarctic_melt.py index 52437a075..60b87d1c6 100644 --- a/mpas_analysis/ocean/time_series_antarctic_melt.py +++ b/mpas_analysis/ocean/time_series_antarctic_melt.py @@ -31,7 +31,7 @@ from mpas_analysis.shared.html import write_image_xml -class TimeSeriesAntarcticMelt(AnalysisTask): # {{{ +class TimeSeriesAntarcticMelt(AnalysisTask): """ Performs analysis of the time-series output of Antarctic sub-ice-shelf melt rates. @@ -42,7 +42,7 @@ class TimeSeriesAntarcticMelt(AnalysisTask): # {{{ def __init__(self, config, mpasTimeSeriesTask, regionMasksTask, controlConfig=None): - # {{{ + """ Construct the analysis task. @@ -119,12 +119,8 @@ def __init__(self, config, mpasTimeSeriesTask, regionMasksTask, plotMeltSubtask.run_after(combineSubtask) self.add_subtask(plotMeltSubtask) - # }}} - - # }}} - -class ComputeMeltSubtask(AnalysisTask): # {{{ +class ComputeMeltSubtask(AnalysisTask): """ Computes time-series of Antarctic sub-ice-shelf melt rates. @@ -144,7 +140,7 @@ class ComputeMeltSubtask(AnalysisTask): # {{{ # Xylar Asay-Davis, Stephen Price def __init__(self, parentTask, startYear, endYear, mpasTimeSeriesTask, - masksSubtask, iceShelvesToPlot): # {{{ + masksSubtask, iceShelvesToPlot): """ Construct the analysis task. @@ -190,9 +186,8 @@ def __init__(self, parentTask, startYear, endYear, mpasTimeSeriesTask, self.endDate = '{:04d}-12-31_23:59:59'.format(self.endYear) self.variableList = \ ['timeMonthly_avg_landIceFreshwaterFlux'] - # }}} - def setup_and_check(self): # {{{ + def setup_and_check(self): """ Perform steps to set up the analysis and check for errors in the setup. @@ -236,9 +231,9 @@ def setup_and_check(self): # {{{ self.mpasTimeSeriesTask.add_variables(variableList=self.variableList) - return # }}} + return - def run_task(self): # {{{ + def run_task(self): """ Computes time-series of Antarctic sub-ice-shelf melt rates. """ @@ -361,11 +356,8 @@ def run_task(self): # {{{ write_netcdf(dsOut, outFileName) - # }}} - # }}} - -class CombineMeltSubtask(AnalysisTask): # {{{ +class CombineMeltSubtask(AnalysisTask): """ Combine individual time series into a single data set """ @@ -373,7 +365,7 @@ class CombineMeltSubtask(AnalysisTask): # {{{ # ------- # Xylar Asay-Davis - def __init__(self, parentTask, startYears, endYears): # {{{ + def __init__(self, parentTask, startYears, endYears): """ Construct the analysis task. @@ -401,9 +393,8 @@ def __init__(self, parentTask, startYears, endYears): # {{{ self.startYears = startYears self.endYears = endYears - # }}} - def run_task(self): # {{{ + def run_task(self): """ Combine the time series """ @@ -431,8 +422,6 @@ def run_task(self): # {{{ ds.load() write_netcdf(ds, outFileName) - # }}} - # }}} class PlotMeltSubtask(AnalysisTask): @@ -456,7 +445,7 @@ class PlotMeltSubtask(AnalysisTask): # Xylar Asay-Davis, Stephen Price def __init__(self, parentTask, iceShelf, regionIndex, controlConfig): - # {{{ + """ Construct the analysis task. @@ -492,9 +481,7 @@ def __init__(self, parentTask, iceShelf, regionIndex, controlConfig): self.regionIndex = regionIndex self.controlConfig = controlConfig - # }}} - - def setup_and_check(self): # {{{ + def setup_and_check(self): """ Perform steps to set up the analysis and check for errors in the setup. @@ -519,9 +506,9 @@ def setup_and_check(self): # {{{ self.xmlFileNames.append( '{}/{}_{}.xml'.format(self.plotsDirectory, prefix, self.iceShelf.replace(' ', '_'))) - return # }}} + return - def run_task(self): # {{{ + def run_task(self): """ Plots time-series output of Antarctic sub-ice-shelf melt rates. """ @@ -780,9 +767,8 @@ def run_task(self): # {{{ thumbnailDescription=title, imageDescription=caption, imageCaption=caption) - # }}} - def _load_ice_shelf_fluxes(self, config): # {{{ + def _load_ice_shelf_fluxes(self, config): """ Reads melt flux time series and computes regional total melt flux and mean melt rate. @@ -802,8 +788,3 @@ def _load_ice_shelf_fluxes(self, config): # {{{ dsOut = xarray.open_dataset(outFileName) return dsOut.totalMeltFlux, dsOut.meltRates - # }}} - - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/ocean/time_series_ocean_regions.py b/mpas_analysis/ocean/time_series_ocean_regions.py index 1fe8ec4f0..89a475bdb 100644 --- a/mpas_analysis/ocean/time_series_ocean_regions.py +++ b/mpas_analysis/ocean/time_series_ocean_regions.py @@ -33,7 +33,7 @@ from mpas_analysis.shared.constants import constants -class TimeSeriesOceanRegions(AnalysisTask): # {{{ +class TimeSeriesOceanRegions(AnalysisTask): """ Performs analysis of the time-series output of regionoal mean temperature, salinity, etc. @@ -43,7 +43,7 @@ class TimeSeriesOceanRegions(AnalysisTask): # {{{ # Xylar Asay-Davis def __init__(self, config, regionMasksTask, controlConfig=None): - # {{{ + """ Construct the analysis task. @@ -196,12 +196,8 @@ def __init__(self, config, regionMasksTask, controlConfig=None): plotRegionSubtask.run_after(combineSubtask) self.add_subtask(plotRegionSubtask) - # }}} - - # }}} - -class ComputeRegionDepthMasksSubtask(AnalysisTask): # {{{ +class ComputeRegionDepthMasksSubtask(AnalysisTask): """ Compute masks for regional and depth mean @@ -221,7 +217,7 @@ class ComputeRegionDepthMasksSubtask(AnalysisTask): # {{{ # Xylar Asay-Davis def __init__(self, parentTask, masksSubtask, regionGroup, regionNames): - # {{{ + """ Construct the analysis task. @@ -258,9 +254,8 @@ def __init__(self, parentTask, masksSubtask, regionGroup, regionNames): self.masksSubtask = masksSubtask self.regionGroup = regionGroup self.regionNames = regionNames - # }}} - def run_task(self): # {{{ + def run_task(self): """ Compute the regional-mean time series """ @@ -386,11 +381,9 @@ def run_task(self): # {{{ dsOut['areaCell'] = areaCell dsOut['regionNames'] = dsRegionMask.regionNames write_netcdf(dsOut, outFileName) - # }}} - # }}} -class ComputeRegionTimeSeriesSubtask(AnalysisTask): # {{{ +class ComputeRegionTimeSeriesSubtask(AnalysisTask): """ Compute regional and depth mean at a function of time for a set of MPAS fields @@ -414,7 +407,7 @@ class ComputeRegionTimeSeriesSubtask(AnalysisTask): # {{{ # Xylar Asay-Davis def __init__(self, parentTask, startYear, endYear, masksSubtask, - regionGroup, regionNames): # {{{ + regionGroup, regionNames): """ Construct the analysis task. @@ -457,9 +450,8 @@ def __init__(self, parentTask, startYear, endYear, masksSubtask, self.masksSubtask = masksSubtask self.regionGroup = regionGroup self.regionNames = regionNames - # }}} - def setup_and_check(self): # {{{ + def setup_and_check(self): """ Perform steps to set up the analysis and check for errors in the setup. @@ -483,9 +475,7 @@ def setup_and_check(self): # {{{ analysisOptionName='config_am_timeseriesstatsmonthly_enable', raiseException=True) - # }}} - - def run_task(self): # {{{ + def run_task(self): """ Compute the regional-mean time series """ @@ -653,7 +643,7 @@ def run_task(self): # {{{ dsOut.coords['month'] = (('Time',), months) dsOut['month'].attrs['units'] = 'months' - write_netcdf(dsOut, outFileName) # }}} + write_netcdf(dsOut, outFileName) def _add_thermal_forcing(self, dsIn, cellMask): """ compute the thermal forcing """ @@ -686,10 +676,9 @@ def _add_thermal_forcing(self, dsIn, cellMask): timeSeries = temp - tempFreeze return timeSeries - # }}} -class CombineRegionalProfileTimeSeriesSubtask(AnalysisTask): # {{{ +class CombineRegionalProfileTimeSeriesSubtask(AnalysisTask): """ Combine individual time series into a single data set """ @@ -697,7 +686,7 @@ class CombineRegionalProfileTimeSeriesSubtask(AnalysisTask): # {{{ # ------- # Xylar Asay-Davis - def __init__(self, parentTask, startYears, endYears, regionGroup): # {{{ + def __init__(self, parentTask, startYears, endYears, regionGroup): """ Construct the analysis task. @@ -732,9 +721,8 @@ def __init__(self, parentTask, startYears, endYears, regionGroup): # {{{ self.startYears = startYears self.endYears = endYears self.regionGroup = regionGroup - # }}} - def run_task(self): # {{{ + def run_task(self): """ Combine the time series """ @@ -771,8 +759,6 @@ def run_task(self): # {{{ ds[var] = ds[var].isel(Time=0, drop=True) write_netcdf(ds, outFileName) - # }}} - # }}} class ComputeObsRegionalTimeSeriesSubtask(AnalysisTask): @@ -788,7 +774,7 @@ class ComputeObsRegionalTimeSeriesSubtask(AnalysisTask): def __init__(self, parentTask, regionGroup, regionName, fullSuffix, obsDict): - # {{{ + """ Construct the analysis task. @@ -838,9 +824,8 @@ def __init__(self, parentTask, regionGroup, regionName, fullSuffix, outputDirectory, obsDict['suffix'], self.prefix) self.run_after(obsDict['maskTask']) - # }}} - def run_task(self): # {{{ + def run_task(self): """ Compute time-series output of properties in an ocean region. """ @@ -997,10 +982,6 @@ def run_task(self): # {{{ dsOut['year'] = ('Time', numpy.ones(ds.sizes[tDim])) write_netcdf(dsOut, outFileName) - # }}} - - # }}} - class PlotRegionTimeSeriesSubtask(AnalysisTask): """ @@ -1031,7 +1012,7 @@ class PlotRegionTimeSeriesSubtask(AnalysisTask): def __init__(self, parentTask, regionGroup, regionName, regionIndex, controlConfig, sectionName, fullSuffix, obsSubtasks, geojsonFileName): - # {{{ + """ Construct the analysis task. @@ -1090,9 +1071,7 @@ def __init__(self, parentTask, regionGroup, regionName, regionIndex, for obsName in obsSubtasks: self.run_after(obsSubtasks[obsName]) - # }}} - - def setup_and_check(self): # {{{ + def setup_and_check(self): """ Perform steps to set up the analysis and check for errors in the setup. @@ -1118,9 +1097,9 @@ def setup_and_check(self): # {{{ for var in self.variables: self.xmlFileNames.append('{}/{}_{}.xml'.format( self.plotsDirectory, self.prefix, var['name'])) - return # }}} + return - def run_task(self): # {{{ + def run_task(self): """ Plots time-series output of properties in an ocean region. """ @@ -1287,9 +1266,3 @@ def run_task(self): # {{{ thumbnailDescription=self.regionName, imageDescription=caption, imageCaption=caption) - - # }}} - - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/ocean/time_series_ohc_anomaly.py b/mpas_analysis/ocean/time_series_ohc_anomaly.py index f19b164b9..db606d2aa 100644 --- a/mpas_analysis/ocean/time_series_ohc_anomaly.py +++ b/mpas_analysis/ocean/time_series_ohc_anomaly.py @@ -36,7 +36,7 @@ class TimeSeriesOHCAnomaly(AnalysisTask): # Xylar Asay-Davis, Milena Veneziani, Greg Streletz def __init__(self, config, mpasTimeSeriesTask, controlConfig=None): - # {{{ + """ Construct the analysis task. @@ -129,9 +129,7 @@ def __init__(self, config, mpasTimeSeriesTask, controlConfig=None): plotTask.run_after(anomalyTask) self.add_subtask(plotTask) - # }}} - - def _compute_ohc(self, ds): # {{{ + def _compute_ohc(self, ds): ''' Compute the OHC time series. ''' @@ -170,9 +168,7 @@ def _compute_ohc(self, ds): # {{{ ds.coords['depth'] = (('nVertLevels',), dsRestart.refBottomDepth.values) - return ds # }}} - - # }}} + return ds class PlotOHCAnomaly(PlotDepthIntegratedTimeSeriesSubtask): @@ -213,6 +209,3 @@ def watts_m2_to_joules(watts_m2): for ytick in yticks: plt.plot(xlim, [0, watts_m2_to_joules(ytick)], color=color, linewidth=0.5) - - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/ocean/time_series_salinity_anomaly.py b/mpas_analysis/ocean/time_series_salinity_anomaly.py index 0f5d85f75..4ea472c60 100644 --- a/mpas_analysis/ocean/time_series_salinity_anomaly.py +++ b/mpas_analysis/ocean/time_series_salinity_anomaly.py @@ -26,7 +26,7 @@ class TimeSeriesSalinityAnomaly(AnalysisTask): # ------- # Xylar Asay-Davis - def __init__(self, config, mpasTimeSeriesTask): # {{{ + def __init__(self, config, mpasTimeSeriesTask): """ Construct the analysis task. @@ -87,9 +87,3 @@ def __init__(self, config, mpasTimeSeriesTask): # {{{ plotTask.run_after(anomalyTask) self.add_subtask(plotTask) - - # }}} - - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/ocean/time_series_sst.py b/mpas_analysis/ocean/time_series_sst.py index 15d94edbc..9a85f1fdb 100644 --- a/mpas_analysis/ocean/time_series_sst.py +++ b/mpas_analysis/ocean/time_series_sst.py @@ -43,7 +43,7 @@ class TimeSeriesSST(AnalysisTask): # Xylar Asay-Davis, Milena Veneziani def __init__(self, config, mpasTimeSeriesTask, controlConfig=None): - # {{{ + """ Construct the analysis task. @@ -74,9 +74,7 @@ def __init__(self, config, mpasTimeSeriesTask, controlConfig=None): self.run_after(mpasTimeSeriesTask) - # }}} - - def setup_and_check(self): # {{{ + def setup_and_check(self): """ Perform steps to set up the analysis and check for errors in the setup. @@ -122,9 +120,9 @@ def setup_and_check(self): # {{{ filePrefix)) self.filePrefixes[region] = filePrefix - return # }}} + return - def run_task(self): # {{{ + def run_task(self): """ Performs analysis of the time-series output of sea-surface temperature (SST). @@ -294,8 +292,5 @@ def run_task(self): # {{{ imageDescription=caption, imageCaption=caption) - # }}} # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/ocean/time_series_temperature_anomaly.py b/mpas_analysis/ocean/time_series_temperature_anomaly.py index fd583c20b..86a70d968 100644 --- a/mpas_analysis/ocean/time_series_temperature_anomaly.py +++ b/mpas_analysis/ocean/time_series_temperature_anomaly.py @@ -26,7 +26,7 @@ class TimeSeriesTemperatureAnomaly(AnalysisTask): # ------- # Xylar Asay-Davis - def __init__(self, config, mpasTimeSeriesTask): # {{{ + def __init__(self, config, mpasTimeSeriesTask): """ Construct the analysis task. @@ -87,9 +87,3 @@ def __init__(self, config, mpasTimeSeriesTask): # {{{ plotTask.run_after(anomalyTask) self.add_subtask(plotTask) - - # }}} - - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/ocean/time_series_transport.py b/mpas_analysis/ocean/time_series_transport.py index 235f104b5..7c4b7be15 100644 --- a/mpas_analysis/ocean/time_series_transport.py +++ b/mpas_analysis/ocean/time_series_transport.py @@ -32,17 +32,18 @@ from mpas_analysis.shared.transects import ComputeTransectMasksSubtask -class TimeSeriesTransport(AnalysisTask): # {{{ +class TimeSeriesTransport(AnalysisTask): """ Extract and plot time series of transport through transects on the MPAS mesh. """ + # Authors # ------- # Xylar Asay-Davis, Stephen Price def __init__(self, config, controlConfig=None): - # {{{ + """ Construct the analysis task. @@ -110,12 +111,8 @@ def __init__(self, config, controlConfig=None): plotTransportSubtask.run_after(combineSubtask) self.add_subtask(plotTransportSubtask) - # }}} - - # }}} - -class ComputeTransportSubtask(AnalysisTask): # {{{ +class ComputeTransportSubtask(AnalysisTask): """ Computes time-series of transport through transects. @@ -130,12 +127,13 @@ class ComputeTransportSubtask(AnalysisTask): # {{{ transectsToPlot : list of str A list of transects to plot """ + # Authors # ------- # Xylar Asay-Davis, Stephen Price def __init__(self, parentTask, startYear, endYear, - masksSubtask, transectsToPlot): # {{{ + masksSubtask, transectsToPlot): """ Construct the analysis task. @@ -177,9 +175,8 @@ def __init__(self, parentTask, startYear, endYear, self.transectsToPlot = transectsToPlot self.restartFileName = None - # }}} - def setup_and_check(self): # {{{ + def setup_and_check(self): """ Perform steps to set up the analysis and check for errors in the setup. @@ -213,9 +210,7 @@ def setup_and_check(self): # {{{ raise IOError('No MPAS-O restart file found: need at least one ' 'restart file for transport calculations') - # }}} - - def run_task(self): # {{{ + def run_task(self): """ Computes time-series of transport through transects. """ @@ -258,8 +253,8 @@ def run_task(self): # {{{ variableList.append('timeMonthly_avg_normalTransportVelocity') elif 'timeMonthly_avg_normalGMBolusVelocity' in dsIn: variableList = variableList + \ - ['timeMonthly_avg_normalVelocity', - 'timeMonthly_avg_normalGMBolusVelocity'] + ['timeMonthly_avg_normalVelocity', + 'timeMonthly_avg_normalGMBolusVelocity'] else: self.logger.warning('Cannot compute transport velocity. ' 'Using advection velocity.') @@ -390,20 +385,17 @@ def run_task(self): # {{{ dsOut['month'].attrs['units'] = 'months' write_netcdf(dsOut, outFileName) - # }}} - - # }}} - -class CombineTransportSubtask(AnalysisTask): # {{{ +class CombineTransportSubtask(AnalysisTask): """ Combine individual time series into a single data set """ + # Authors # ------- # Xylar Asay-Davis - def __init__(self, parentTask, startYears, endYears): # {{{ + def __init__(self, parentTask, startYears, endYears): """ Construct the analysis task. @@ -430,9 +422,8 @@ def __init__(self, parentTask, startYears, endYears): # {{{ self.startYears = startYears self.endYears = endYears - # }}} - def run_task(self): # {{{ + def run_task(self): """ Combine the time series """ @@ -458,8 +449,6 @@ def run_task(self): # {{{ concat_dim='Time', decode_times=False) ds.load() write_netcdf(ds, outFileName) - # }}} - # }}} class PlotTransportSubtask(AnalysisTask): @@ -478,13 +467,14 @@ class PlotTransportSubtask(AnalysisTask): The configuration options for the control run (if any) """ + # Authors # ------- # Xylar Asay-Davis, Stephen Price def __init__(self, parentTask, transect, transectIndex, controlConfig, transportTransectFileName): - # {{{ + """ Construct the analysis task. @@ -520,9 +510,7 @@ def __init__(self, parentTask, transect, transectIndex, controlConfig, self.transectIndex = transectIndex self.controlConfig = controlConfig - # }}} - - def setup_and_check(self): # {{{ + def setup_and_check(self): """ Perform steps to set up the analysis and check for errors in the setup. @@ -543,9 +531,8 @@ def setup_and_check(self): # {{{ self.xmlFileNames = ['{}/transport_{}.xml'.format( self.plotsDirectory, self.transect.replace(' ', '_'))] - # }}} - def run_task(self): # {{{ + def run_task(self): """ Plots time-series output of transport through transects. """ @@ -657,12 +644,11 @@ def run_task(self): # {{{ if bounds is not None: t = transport.Time.values - plt.gca().fill_between(t, bounds[0]*numpy.ones_like(t), - bounds[1]*numpy.ones_like(t), alpha=0.3, + plt.gca().fill_between(t, bounds[0] * numpy.ones_like(t), + bounds[1] * numpy.ones_like(t), alpha=0.3, label='observations') plt.legend(loc='lower left') - # do this before the inset because otherwise it moves the inset # and cartopy doesn't play too well with tight_layout anyway plt.tight_layout() @@ -682,9 +668,8 @@ def run_task(self): # {{{ thumbnailDescription=thumbnailDescription, imageDescription=caption, imageCaption=caption) - # }}} - def _load_transport(self, config): # {{{ + def _load_transport(self, config): """ Reads transport time series for this transect """ @@ -705,8 +690,4 @@ def _load_transport(self, config): # {{{ transport = dsIn.transport.isel(nTransects=self.transectIndex) mean = transport.mean().values std = transport.std().values - return transport, mean, std # }}} - - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python + return transport, mean, std diff --git a/mpas_analysis/ocean/utility.py b/mpas_analysis/ocean/utility.py index 890d27e2c..dfc39a615 100644 --- a/mpas_analysis/ocean/utility.py +++ b/mpas_analysis/ocean/utility.py @@ -19,7 +19,7 @@ import xarray -def compute_zmid(bottomDepth, maxLevelCell, layerThickness): # {{{ +def compute_zmid(bottomDepth, maxLevelCell, layerThickness): """ Computes zMid given data arrays for bottomDepth, maxLevelCell and layerThickness @@ -61,15 +61,13 @@ def compute_zmid(bottomDepth, maxLevelCell, layerThickness): # {{{ zMid = zLayerBot + 0.5 * layerThickness - return zMid # }}} + return zMid -def nans_to_numpy_mask(field): # {{{ +def nans_to_numpy_mask(field): """ Convert a numpy array with NaNs to a masked numpy array """ field = numpy.ma.masked_array( field, numpy.isnan(field)) - return field # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python + return field diff --git a/mpas_analysis/ocean/woce_transects.py b/mpas_analysis/ocean/woce_transects.py index dc9671128..55d60f8eb 100644 --- a/mpas_analysis/ocean/woce_transects.py +++ b/mpas_analysis/ocean/woce_transects.py @@ -19,7 +19,7 @@ from collections import OrderedDict -class WoceTransects(AnalysisTask): # {{{ +class WoceTransects(AnalysisTask): """ Plot model output at WOCE transects and compare it against WOCE observations @@ -29,8 +29,6 @@ class WoceTransects(AnalysisTask): # {{{ # Xylar Asay-Davis def __init__(self, config, mpasClimatologyTask, controlConfig=None): - - # {{{ ''' Construct the analysis task and adds it as a subtask of the ``parentTask``. @@ -190,9 +188,3 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): verticalBounds=verticalBounds) self.add_subtask(subtask) - # }}} - - # }}} - - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/sea_ice/climatology_map_berg_conc.py b/mpas_analysis/sea_ice/climatology_map_berg_conc.py index 5d17d2548..4987de19f 100644 --- a/mpas_analysis/sea_ice/climatology_map_berg_conc.py +++ b/mpas_analysis/sea_ice/climatology_map_berg_conc.py @@ -20,7 +20,7 @@ from mpas_analysis.shared.io.utility import build_obs_path -class ClimatologyMapIcebergConc(AnalysisTask): # {{{ +class ClimatologyMapIcebergConc(AnalysisTask): """ An analysis task for comparison of iceberg concentration against observations @@ -30,7 +30,7 @@ class ClimatologyMapIcebergConc(AnalysisTask): # {{{ # Darin Comeau, Xylar Asay-Davis def __init__(self, config, mpasClimatologyTask, hemisphere, - controlConfig=None): # {{{ + controlConfig=None): """ Construct the analysis task. @@ -163,12 +163,8 @@ def __init__(self, config, mpasClimatologyTask, hemisphere, self.add_subtask(subtask) - # }}} - # }}} - - -class RemapAltibergConcClimatology(RemapObservedClimatologySubtask): # {{{ +class RemapAltibergConcClimatology(RemapObservedClimatologySubtask): """ A subtask for reading and remapping iceberg concentration from Altiberg observations @@ -177,7 +173,7 @@ class RemapAltibergConcClimatology(RemapObservedClimatologySubtask): # {{{ # ------- # Darin Comeau, Xylar Asay-Davis - def get_observation_descriptor(self, fileName): # {{{ + def get_observation_descriptor(self, fileName): """ get a MeshDescriptor for the observation grid @@ -200,9 +196,9 @@ def get_observation_descriptor(self, fileName): # {{{ obsDescriptor = LatLonGridDescriptor.read(fileName=fileName, latVarName='latitude', lonVarName='longitude') - return obsDescriptor # }}} + return obsDescriptor - def build_observational_dataset(self, fileName): # {{{ + def build_observational_dataset(self, fileName): """ read in the data sets for observations, and possibly rename some variables and dimensions @@ -227,8 +223,4 @@ def build_observational_dataset(self, fileName): # {{{ dsObs.coords['year'] = dsObs['Time.year'] dsObs = dsObs.transpose('Time', 'latitude', 'longitude') - return dsObs # }}} - # }}} - - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python + return dsObs diff --git a/mpas_analysis/sea_ice/climatology_map_sea_ice_conc.py b/mpas_analysis/sea_ice/climatology_map_sea_ice_conc.py index 081dfd11e..0bc5db793 100644 --- a/mpas_analysis/sea_ice/climatology_map_sea_ice_conc.py +++ b/mpas_analysis/sea_ice/climatology_map_sea_ice_conc.py @@ -23,7 +23,7 @@ from mpas_analysis.shared.io.utility import build_obs_path -class ClimatologyMapSeaIceConc(AnalysisTask): # {{{ +class ClimatologyMapSeaIceConc(AnalysisTask): """ An analysis task for comparison of sea ice concentration against observations @@ -33,7 +33,7 @@ class ClimatologyMapSeaIceConc(AnalysisTask): # {{{ # Luke Van Roekel, Xylar Asay-Davis, Milena Veneziani def __init__(self, config, mpasClimatologyTask, hemisphere, - controlConfig=None): # {{{ + controlConfig=None): """ Construct the analysis task. @@ -115,11 +115,10 @@ def __init__(self, config, mpasClimatologyTask, hemisphere, hemisphereLong, remapClimatologySubtask, controlConfig, mpasFieldName, fieldName, iselValues) - # }}} def _add_obs_tasks(self, seasons, comparisonGridNames, hemisphere, hemisphereLong, remapClimatologySubtask, - mpasFieldName): # {{{ + mpasFieldName): config = self.config obsFieldName = 'seaIceConc' sectionName = self.taskName @@ -183,12 +182,11 @@ def _add_obs_tasks(self, seasons, comparisonGridNames, hemisphere, prefix)) self.add_subtask(subtask) - # }}} def _add_ref_tasks(self, seasons, comparisonGridNames, hemisphere, hemisphereLong, remapClimatologySubtask, controlConfig, mpasFieldName, fieldName, - iselValues): # {{{ + iselValues): controlRunName = controlConfig.get('runs', 'mainRunName') galleryName = None @@ -226,11 +224,9 @@ def _add_ref_tasks(self, seasons, comparisonGridNames, hemisphere, galleryName=galleryName) self.add_subtask(subtask) - # }}} - # }}} -class RemapObservedConcClimatology(RemapObservedClimatologySubtask): # {{{ +class RemapObservedConcClimatology(RemapObservedClimatologySubtask): """ A subtask for reading and remapping sea ice concentration observations """ @@ -238,7 +234,7 @@ class RemapObservedConcClimatology(RemapObservedClimatologySubtask): # {{{ # ------- # Xylar Asay-Davis - def get_observation_descriptor(self, fileName): # {{{ + def get_observation_descriptor(self, fileName): ''' get a MeshDescriptor for the observation grid @@ -261,9 +257,9 @@ def get_observation_descriptor(self, fileName): # {{{ obsDescriptor = LatLonGridDescriptor.read(fileName=fileName, latVarName='t_lat', lonVarName='t_lon') - return obsDescriptor # }}} + return obsDescriptor - def build_observational_dataset(self, fileName): # {{{ + def build_observational_dataset(self, fileName): ''' read in the data sets for observations, and possibly rename some variables and dimensions @@ -285,8 +281,3 @@ def build_observational_dataset(self, fileName): # {{{ dsObs = xr.open_dataset(fileName) dsObs = dsObs.rename({'AICE': 'seaIceConc'}) return dsObs - # }}} - # }}} - - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/sea_ice/climatology_map_sea_ice_thick.py b/mpas_analysis/sea_ice/climatology_map_sea_ice_thick.py index 67c3fbec3..03c6bb2f5 100644 --- a/mpas_analysis/sea_ice/climatology_map_sea_ice_thick.py +++ b/mpas_analysis/sea_ice/climatology_map_sea_ice_thick.py @@ -23,7 +23,7 @@ from mpas_analysis.shared.io.utility import build_obs_path -class ClimatologyMapSeaIceThick(AnalysisTask): # {{{ +class ClimatologyMapSeaIceThick(AnalysisTask): """ An analysis task for comparison of sea ice thickness against observations @@ -33,7 +33,7 @@ class ClimatologyMapSeaIceThick(AnalysisTask): # {{{ # Luke Van Roekel, Xylar Asay-Davis, Milena Veneziani def __init__(self, config, mpasClimatologyTask, hemisphere, - controlConfig=None): # {{{ + controlConfig=None): """ Construct the analysis task. @@ -171,12 +171,8 @@ def __init__(self, config, mpasClimatologyTask, hemisphere, self.add_subtask(subtask) - # }}} - # }}} - - -class RemapObservedThickClimatology(RemapObservedClimatologySubtask): # {{{ +class RemapObservedThickClimatology(RemapObservedClimatologySubtask): """ A subtask for reading and remapping sea ice thickness observations """ @@ -184,7 +180,7 @@ class RemapObservedThickClimatology(RemapObservedClimatologySubtask): # {{{ # ------- # Xylar Asay-Davis - def get_observation_descriptor(self, fileName): # {{{ + def get_observation_descriptor(self, fileName): ''' get a MeshDescriptor for the observation grid @@ -207,9 +203,9 @@ def get_observation_descriptor(self, fileName): # {{{ obsDescriptor = LatLonGridDescriptor.read(fileName=fileName, latVarName='t_lat', lonVarName='t_lon') - return obsDescriptor # }}} + return obsDescriptor - def build_observational_dataset(self, fileName): # {{{ + def build_observational_dataset(self, fileName): ''' read in the data sets for observations, and possibly rename some variables and dimensions @@ -231,8 +227,3 @@ def build_observational_dataset(self, fileName): # {{{ dsObs = xr.open_dataset(fileName) dsObs = dsObs.rename({'HI': 'seaIceThick'}) return dsObs - # }}} - # }}} - - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/sea_ice/plot_climatology_map_subtask.py b/mpas_analysis/sea_ice/plot_climatology_map_subtask.py index 468a5c124..2c987b8ee 100644 --- a/mpas_analysis/sea_ice/plot_climatology_map_subtask.py +++ b/mpas_analysis/sea_ice/plot_climatology_map_subtask.py @@ -24,7 +24,7 @@ get_remapped_mpas_climatology_file_name -class PlotClimatologyMapSubtask(AnalysisTask): # {{{ +class PlotClimatologyMapSubtask(AnalysisTask): """ An analysis task for plotting 2D model fields against observations or a control run. @@ -97,7 +97,7 @@ class PlotClimatologyMapSubtask(AnalysisTask): # {{{ def __init__(self, parentTask, hemisphere, season, comparisonGridName, remapMpasClimatologySubtask, remapObsClimatologySubtask=None, controlConfig=None, subtaskSuffix=None): - # {{{ + ''' Construct one analysis subtask for each plot (i.e. each season and comparison grid) and a subtask for computing climatologies. @@ -161,13 +161,12 @@ def __init__(self, parentTask, hemisphere, season, comparisonGridName, self.run_after(remapMpasClimatologySubtask) if remapObsClimatologySubtask is not None: self.run_after(remapObsClimatologySubtask) - # }}} def set_plot_info(self, outFileLabel, fieldNameInTitle, mpasFieldName, refFieldName, refTitleLabel, diffTitleLabel, unitsLabel, imageDescription, imageCaption, galleryGroup, groupSubtitle, groupLink, galleryName, maskValue=None): - # {{{ + """ Store attributes related to plots, plot file names and HTML output. @@ -238,9 +237,8 @@ def set_plot_info(self, outFileLabel, fieldNameInTitle, mpasFieldName, self.galleryName = galleryName self.maskValue = maskValue - # }}} - def setup_and_check(self): # {{{ + def setup_and_check(self): """ Perform steps to set up the analysis and check for errors in the setup. """ @@ -268,9 +266,7 @@ def setup_and_check(self): # {{{ self.xmlFileNames.append('{}/{}.xml'.format(self.plotsDirectory, self.filePrefix)) - # }}} - - def run_task(self): # {{{ + def run_task(self): """ Performs analysis of sea-ice properties by comparing with previous model results and/or observations. @@ -415,7 +411,3 @@ def run_task(self): # {{{ thumbnailDescription=season, imageDescription=self.imageDescription, imageCaption=self.imageCaption) - # }}} - - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/sea_ice/time_series.py b/mpas_analysis/sea_ice/time_series.py index 90fd79745..0f7070ba1 100644 --- a/mpas_analysis/sea_ice/time_series.py +++ b/mpas_analysis/sea_ice/time_series.py @@ -49,7 +49,7 @@ class TimeSeriesSeaIce(AnalysisTask): # Xylar Asay-Davis, Milena Veneziani def __init__(self, config, mpasTimeSeriesTask, - controlConfig=None): # {{{ + controlConfig=None): """ Construct the analysis task. @@ -80,9 +80,7 @@ def __init__(self, config, mpasTimeSeriesTask, self.run_after(mpasTimeSeriesTask) - # }}} - - def setup_and_check(self): # {{{ + def setup_and_check(self): """ Perform steps to set up the analysis and check for errors in the setup. @@ -180,9 +178,9 @@ def setup_and_check(self): # {{{ if polarPlot: self.xmlFileNames.extend(polarXMLFileNames) - return # }}} + return - def run_task(self): # {{{ + def run_task(self): """ Performs analysis of time series of sea-ice properties. """ @@ -512,9 +510,8 @@ def run_task(self): # {{{ thumbnailDescription=thumbnailDescription, imageDescription=caption, imageCaption=caption) - # }}} - def _replicate_cycle(self, ds, dsToReplicate, calendar): # {{{ + def _replicate_cycle(self, ds, dsToReplicate, calendar): """ Replicates a periodic time series `dsToReplicate` to cover the timeframe of the dataset `ds`. @@ -582,9 +579,9 @@ def _replicate_cycle(self, ds, dsToReplicate, calendar): # {{{ method=str('nearest')).values dsShift = dsShift.sel(Time=slice(dsStartTime, dsEndTime)) - return dsShift # }}} + return dsShift - def _compute_area_vol(self): # {{{ + def _compute_area_vol(self): ''' Compute part of the time series of sea ice volume and area, given time indices to process. @@ -640,7 +637,4 @@ def _compute_area_vol(self): # {{{ write_netcdf(dsAreaSum, outFileNames[hemisphere]) - return dsTimeSeries # }}} - - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python + return dsTimeSeries diff --git a/mpas_analysis/shared/analysis_task.py b/mpas_analysis/shared/analysis_task.py index b9815bc61..61e760a2d 100644 --- a/mpas_analysis/shared/analysis_task.py +++ b/mpas_analysis/shared/analysis_task.py @@ -26,7 +26,7 @@ make_directories, get_files_year_month -class AnalysisTask(Process): # {{{ +class AnalysisTask(Process): ''' The base class for analysis tasks. @@ -99,7 +99,7 @@ class AnalysisTask(Process): # {{{ FAIL = 5 def __init__(self, config, taskName, componentName, tags=[], - subtaskName=None): # {{{ + subtaskName=None): ''' Construct the analysis task. @@ -167,9 +167,8 @@ def __init__(self, config, taskName, componentName, tags=[], # run the task directly as opposed to launching it as a new process # even in parallel because it has subprocesses such as Pools self.runDirectly = False - # }}} - def setup_and_check(self): # {{{ + def setup_and_check(self): ''' Perform steps to set up the analysis (e.g. reading namelists and streams files). @@ -232,9 +231,7 @@ def setup_and_check(self): # {{{ self._logFileName = '{}/{}.log'.format(logsDirectory, self.fullTaskName) - # }}} - - def run_task(self): # {{{ + def run_task(self): ''' Run the analysis. Each task should override this function to do the work of computing and/or plotting analysis @@ -243,9 +240,9 @@ def run_task(self): # {{{ # ------- # Xylar Asay-Davis - return # }}} + return - def run_after(self, task): # {{{ + def run_after(self, task): ''' Only run this task after the given task has completed. This allows a task to be constructed of multiple subtasks, some of which may block @@ -264,9 +261,8 @@ def run_after(self, task): # {{{ if task not in self.runAfterTasks: self.runAfterTasks.append(task) - # }}} - def add_subtask(self, subtask): # {{{ + def add_subtask(self, subtask): ''' Add a subtask to this tasks. This task always runs after the subtask has finished. However, this task gets set up *before* the subtask, @@ -284,9 +280,8 @@ def add_subtask(self, subtask): # {{{ if subtask not in self.subtasks: self.subtasks.append(subtask) - # }}} - def run(self, writeLogFile=True): # {{{ + def run(self, writeLogFile=True): ''' Sets up logging and then runs the analysis task. @@ -349,10 +344,8 @@ def run(self, writeLogFile=True): # {{{ # writeLogFile==False) self.logger.handlers = [] - # }}} - def check_generate(self): - # {{{ + ''' Determines if this analysis should be generated, based on the ``generate`` config option and ``taskName``, ``componentName`` and @@ -415,7 +408,7 @@ def check_generate(self): elif element == self.taskName: generate = True - return generate # }}} + return generate def check_analysis_enabled(self, analysisOptionName, default=False, raiseException=True): @@ -463,7 +456,7 @@ def check_analysis_enabled(self, analysisOptionName, default=False, 'are analyzing was run with an\n' 'older version of MPAS-O that did not support ' 'this flag. Assuming enabled.'.format( - analysisOptionName)) + analysisOptionName)) if not enabled and raiseException: raise RuntimeError('*** MPAS-Analysis relies on {} = .true.\n' @@ -472,7 +465,7 @@ def check_analysis_enabled(self, analysisOptionName, default=False, return enabled - def set_start_end_date(self, section): # {{{ + def set_start_end_date(self, section): ''' Set the start and end dates in the ``config`` correspond to the start and end years in a given category of analysis @@ -495,12 +488,13 @@ def set_start_end_date(self, section): # {{{ if not self.config.has_option(section, 'endDate'): endDate = '{:04d}-12-31_23:59:59'.format( self.config.getint(section, 'endYear')) - self.config.set(section, 'endDate', endDate) # }}} + self.config.set(section, 'endDate', endDate) + # }}} -class AnalysisFormatter(logging.Formatter): # {{{ +class AnalysisFormatter(logging.Formatter): """ A custom formatter for logging @@ -543,10 +537,12 @@ def format(self, record): self._fmt = format_orig return result + + # }}} -class StreamToLogger(object): # {{{ +class StreamToLogger(object): """ Modified based on code by: https://www.electricmonk.nl/log/2011/08/14/redirect-stdout-and-stderr-to-a-logger-in-python/ @@ -571,10 +567,8 @@ def write(self, buf): def flush(self): pass - # }}} - -def update_time_bounds_from_file_names(config, section, componentName): # {{{ +def update_time_bounds_from_file_names(config, section, componentName): """ Update the start and end years and dates for time series, climatologies or climate indices based on the years actually available in the list of files. @@ -651,13 +645,13 @@ def update_time_bounds_from_file_names(config, section, componentName): # {{{ # search for the start of the first full year firstIndex = 0 - while(firstIndex < len(years) and months[firstIndex] != 1): + while (firstIndex < len(years) and months[firstIndex] != 1): firstIndex += 1 startYear = years[firstIndex] # search for the end of the last full year lastIndex = len(years) - 1 - while(lastIndex >= 0 and months[lastIndex] != 12): + while (lastIndex >= 0 and months[lastIndex] != 12): lastIndex -= 1 endYear = years[lastIndex] @@ -689,7 +683,3 @@ def update_time_bounds_from_file_names(config, section, componentName): # {{{ config.set(section, 'startDate', startDate) endDate = '{:04d}-12-31_23:59:59'.format(endYear) config.set(section, 'endDate', endDate) - - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/shared/climatology/climatology.py b/mpas_analysis/shared/climatology/climatology.py index 9fcd50ddd..27997587f 100644 --- a/mpas_analysis/shared/climatology/climatology.py +++ b/mpas_analysis/shared/climatology/climatology.py @@ -35,7 +35,7 @@ def get_remapper(config, sourceDescriptor, comparisonDescriptor, - mappingFilePrefix, method, logger=None): # {{{ + mappingFilePrefix, method, logger=None): """ Given config options and descriptions of the source and comparison grids, returns a ``pyremap.Remapper`` object that can be used to remap from source @@ -93,7 +93,7 @@ def get_remapper(config, sourceDescriptor, comparisonDescriptor, baseDirectoryOption='customDirectory') mappingFileName = '{}/{}'.format(mappingSubdirectory, - mappingBaseName) + mappingBaseName) if not tryCustom or not os.path.exists(mappingFileName): # second see if mapping files are in the base directory @@ -131,10 +131,10 @@ def get_remapper(config, sourceDescriptor, comparisonDescriptor, mpiTasks=mpiTasks, tempdir=tempdir, esmf_parallel_exec=esmf_parallel_exec) - return remapper # }}} + return remapper -def compute_monthly_climatology(ds, calendar=None, maskVaries=True): # {{{ +def compute_monthly_climatology(ds, calendar=None, maskVaries=True): """ Compute monthly climatologies from a data set. The mean is weighted but the number of days in each month of the data set, ignoring values masked @@ -166,6 +166,7 @@ def compute_monthly_climatology(ds, calendar=None, maskVaries=True): # {{{ of ds over all months in monthValues, weighted by the number of days in each month. """ + # Authors # ------- # Xylar Asay-Davis @@ -179,11 +180,11 @@ def compute_one_month_climatology(ds): monthlyClimatology = \ ds.groupby('month').map(compute_one_month_climatology) - return monthlyClimatology # }}} + return monthlyClimatology def compute_climatology(ds, monthValues, calendar=None, - maskVaries=True): # {{{ + maskVaries=True): """ Compute a monthly, seasonal or annual climatology data set from a data set. The mean is weighted but the number of days in each month of @@ -234,10 +235,10 @@ def compute_climatology(ds, monthValues, calendar=None, climatology = _compute_masked_mean(climatologyMonths, maskVaries) - return climatology # }}} + return climatology -def add_years_months_days_in_month(ds, calendar=None): # {{{ +def add_years_months_days_in_month(ds, calendar=None): ''' Add ``year``, ``month`` and ``daysInMonth`` as data arrays in ``ds``. The number of days in each month of ``ds`` is computed either using the @@ -299,12 +300,12 @@ def add_years_months_days_in_month(ds, calendar=None): # {{{ month in ds.month.values], float) ds.coords['daysInMonth'] = ('Time', daysInMonth) - return ds # }}} + return ds def remap_and_write_climatology(config, climatologyDataSet, climatologyFileName, remappedFileName, - remapper, logger=None): # {{{ + remapper, logger=None): """ Given a field in a climatology data set, use the ``remapper`` to remap horizontal dimensions of all fields, write the results to an output file, @@ -378,10 +379,10 @@ def remap_and_write_climatology(config, climatologyDataSet, remappedClimatology = remapper.remap(climatologyDataSet, renormalizationThreshold) write_netcdf(remappedClimatology, remappedFileName) - return remappedClimatology # }}} + return remappedClimatology -def get_unmasked_mpas_climatology_directory(config, op='avg'): # {{{ +def get_unmasked_mpas_climatology_directory(config, op='avg'): """ Get the directory for an unmasked MPAS climatology produced by ncclimo, making the directory if it doesn't already exist @@ -406,12 +407,11 @@ def get_unmasked_mpas_climatology_directory(config, op='avg'): # {{{ mpasMeshName) make_directories(directory) - return directory # }}} + return directory def get_unmasked_mpas_climatology_file_name(config, season, componentName, op='avg'): - # {{{ """ Get the file name for an unmasked MPAS climatology produced by ncclimo @@ -459,11 +459,11 @@ def get_unmasked_mpas_climatology_file_name(config, season, componentName, season = '{:02d}'.format(monthValues[0]) fileName = '{}/{}_{}_{}.nc'.format(directory, ncclimoModel, season, suffix) - return fileName # }}} + return fileName def get_masked_mpas_climatology_file_name(config, season, componentName, - climatologyName, op='avg'): # {{{ + climatologyName, op='avg'): """ Get the file name for a masked MPAS climatology @@ -524,13 +524,13 @@ def get_masked_mpas_climatology_file_name(config, season, componentName, fileName = '{}/{}_{}_{}.nc'.format( directory, ncclimoModel, season, suffix) - return fileName # }}} + return fileName def get_remapped_mpas_climatology_file_name(config, season, componentName, climatologyName, comparisonGridName, - op='avg'): # {{{ + op='avg'): """ Get the file name for a masked MPAS climatology @@ -602,7 +602,7 @@ def get_remapped_mpas_climatology_file_name(config, season, componentName, fileName = '{}/{}_{}_{}.nc'.format( directory, ncclimoModel, season, suffix) - return fileName # }}} + return fileName def get_climatology_op_directory(config, op='avg'): @@ -616,12 +616,13 @@ def get_climatology_op_directory(config, op='avg'): return '{}/{}'.format(climatologyBaseDirectory, op) -def _compute_masked_mean(ds, maskVaries): # {{{ +def _compute_masked_mean(ds, maskVaries): ''' Compute the time average of data set, masked out where the variables in ds are NaN and, if ``maskVaries == True``, weighting by the number of days used to compute each monthly mean time in ds. ''' + # Authors # ------- # Xylar Asay-Davis @@ -656,10 +657,10 @@ def ds_to_weights(ds): timeMean = dsWeightedSum / days.where(days > 0.) - return timeMean # }}} + return timeMean -def _matches_comparison(obsDescriptor, comparisonDescriptor): # {{{ +def _matches_comparison(obsDescriptor, comparisonDescriptor): ''' Determine if the two meshes are the same ''' @@ -672,12 +673,12 @@ def _matches_comparison(obsDescriptor, comparisonDescriptor): # {{{ # pretty hard to determine if projections are the same, so we'll rely # on the grid names match = obsDescriptor.meshName == comparisonDescriptor.meshName and \ - len(obsDescriptor.x) == len(comparisonDescriptor.x) and \ - len(obsDescriptor.y) == len(comparisonDescriptor.y) and \ - numpy.all(numpy.isclose(obsDescriptor.x, - comparisonDescriptor.x)) and \ - numpy.all(numpy.isclose(obsDescriptor.y, - comparisonDescriptor.y)) + len(obsDescriptor.x) == len(comparisonDescriptor.x) and \ + len(obsDescriptor.y) == len(comparisonDescriptor.y) and \ + numpy.all(numpy.isclose(obsDescriptor.x, + comparisonDescriptor.x)) and \ + numpy.all(numpy.isclose(obsDescriptor.y, + comparisonDescriptor.y)) elif isinstance(obsDescriptor, LatLonGridDescriptor) and \ isinstance(comparisonDescriptor, LatLonGridDescriptor): match = ((('degree' in obsDescriptor.units and @@ -693,12 +694,12 @@ def _matches_comparison(obsDescriptor, comparisonDescriptor): # {{{ else: match = False - return match # }}} + return match def _setup_climatology_caching(ds, startYearClimo, endYearClimo, yearsPerCacheFile, cachePrefix, - monthValues): # {{{ + monthValues): ''' Determine which cache files already exist, which are incomplete and which years are present in each cache file (whether existing or to be created). @@ -757,12 +758,12 @@ def _setup_climatology_caching(ds, startYearClimo, endYearClimo, ds = ds.copy() ds.coords['cacheIndices'] = ('Time', cacheIndices) - return cacheInfo, cacheIndices # }}} + return cacheInfo, cacheIndices def _cache_individual_climatologies(ds, cacheInfo, printProgress, yearsPerCacheFile, monthValues, - calendar): # {{{ + calendar): ''' Cache individual climatologies for later aggregation. ''' @@ -793,12 +794,10 @@ def _cache_individual_climatologies(ds, cacheInfo, printProgress, write_netcdf(climatology, outputFileClimo) climatology.close() - # }}} - def _cache_aggregated_climatology(startYearClimo, endYearClimo, cachePrefix, printProgress, monthValues, - cacheInfo): # {{{ + cacheInfo): ''' Cache aggregated climatology from individual climatologies. ''' @@ -833,7 +832,7 @@ def _cache_aggregated_climatology(startYearClimo, endYearClimo, cachePrefix, elif climatology is not None: monthsIfDone = ( - endYearClimo - startYearClimo + 1) * len(monthValues) + endYearClimo - startYearClimo + 1) * len(monthValues) if climatology.attrs['totalMonths'] == monthsIfDone: # also complete, so we can move on done = True @@ -870,7 +869,7 @@ def _cache_aggregated_climatology(startYearClimo, endYearClimo, cachePrefix, write_netcdf(climatology, outputFileClimo) - return climatology # }}} + return climatology def _get_year_string(startYear, endYear): @@ -882,6 +881,3 @@ def _get_year_string(startYear, endYear): fileSuffix = 'years{}'.format(yearString) return yearString, fileSuffix - - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/shared/climatology/mpas_climatology_task.py b/mpas_analysis/shared/climatology/mpas_climatology_task.py index b17db90ee..b5b71987d 100644 --- a/mpas_analysis/shared/climatology/mpas_climatology_task.py +++ b/mpas_analysis/shared/climatology/mpas_climatology_task.py @@ -18,7 +18,6 @@ from multiprocessing.pool import ThreadPool import glob - from mpas_analysis.shared.analysis_task import AnalysisTask from mpas_analysis.shared.climatology.climatology import \ @@ -34,7 +33,7 @@ from mpas_analysis.shared.constants import constants -class MpasClimatologyTask(AnalysisTask): # {{{ +class MpasClimatologyTask(AnalysisTask): ''' An analysis tasks for computing climatologies from output from the ``timeSeriesStatsMonthly*`` analysis members. @@ -76,11 +75,12 @@ class MpasClimatologyTask(AnalysisTask): # {{{ ``timeSeriesStatsMonthlyMinOutput``, ``timeSeriesStatsMonthlyMaxOutput`` ''' + # Authors # ------- # Xylar Asay-Davis - def __init__(self, config, componentName, taskName=None, op='avg'): # {{{ + def __init__(self, config, componentName, taskName=None, op='avg'): ''' Construct the analysis task. @@ -129,7 +129,7 @@ def __init__(self, config, componentName, taskName=None, op='avg'): # {{{ if taskName is None: suffix = componentName[0].upper() + componentName[1:] + \ - op[0].upper() + op[1:] + op[0].upper() + op[1:] taskName = 'mpasClimatology{}'.format(suffix) self.allVariables = None @@ -151,7 +151,6 @@ def __init__(self, config, componentName, taskName=None, op='avg'): # {{{ # running in serial self.subprocessCount = 1 - self.seasonSubtasks = {} if not self.useNcclimo: @@ -171,14 +170,13 @@ def __init__(self, config, componentName, taskName=None, op='avg'): # {{{ if season in constants.abrevMonthNames: continue monthValues = constants.monthDictionary[season] - monthNames = [constants.abrevMonthNames[month-1] for month in + monthNames = [constants.abrevMonthNames[month - 1] for month in monthValues] for monthName in monthNames: self.seasonSubtasks[season].run_after( - self.seasonSubtasks[monthName]) - # }}} + self.seasonSubtasks[monthName]) - def add_variables(self, variableList, seasons=None): # {{{ + def add_variables(self, variableList, seasons=None): ''' Add one or more variables and optionally one or more seasons for which to compute climatologies. @@ -232,13 +230,11 @@ def add_variables(self, variableList, seasons=None): # {{{ for season in seasons: if season not in constants.abrevMonthNames: monthValues = constants.monthDictionary[season] - monthNames = [constants.abrevMonthNames[month-1] for month in + monthNames = [constants.abrevMonthNames[month - 1] for month in monthValues] self.add_variables(variableList, seasons=monthNames) - # }}} - - def setup_and_check(self): # {{{ + def setup_and_check(self): ''' Perform steps to set up the analysis and check for errors in the setup. @@ -294,9 +290,7 @@ def setup_and_check(self): # {{{ with xarray.open_dataset(self.inputFiles[0]) as ds: self.allVariables = list(ds.data_vars.keys()) - # }}} - - def run_task(self): # {{{ + def run_task(self): ''' Compute the requested climatologies ''' @@ -314,8 +308,8 @@ def run_task(self): # {{{ self.logger.info('\nComputing MPAS climatologies from files:\n' ' {} through\n {}'.format( - os.path.basename(self.inputFiles[0]), - os.path.basename(self.inputFiles[-1]))) + os.path.basename(self.inputFiles[0]), + os.path.basename(self.inputFiles[-1]))) seasonsToCheck = list(constants.abrevMonthNames) @@ -350,9 +344,7 @@ def run_task(self): # {{{ inDirectory=self.symlinkDirectory, outDirectory=climatologyDirectory) - # }}} - - def get_start_and_end(self): # {{{ + def get_start_and_end(self): """ Get the start and end years and dates for the climatology. This function is provided to allow a custom method for setting the start @@ -374,9 +366,7 @@ def get_start_and_end(self): # {{{ return startYear, endYear - # }}} - - def get_file_name(self, season): # {{{ + def get_file_name(self, season): """ Returns the full path for MPAS climatology file produced by ncclimo. @@ -399,9 +389,7 @@ def get_file_name(self, season): # {{{ self.componentName, self.op) - # }}} - - def _create_symlinks(self): # {{{ + def _create_symlinks(self): """ Create symlinks to monthly mean files so they have the expected file naming convention for ncclimo. @@ -432,8 +420,8 @@ def _create_symlinks(self): # {{{ for inFileName, year, month in zip(fileNames, years, months): outFileName = '{}/{}.hist.am.timeSeriesStatsMonthly.{:04d}-' \ - '{:02d}-01.nc'.format(symlinkDirectory, self.ncclimoModel, - year, month) + '{:02d}-01.nc'.format(symlinkDirectory, self.ncclimoModel, + year, month) try: os.symlink(inFileName, outFileName) @@ -442,11 +430,9 @@ def _create_symlinks(self): # {{{ return symlinkDirectory - # }}} - def _compute_climatologies_with_ncclimo(self, inDirectory, outDirectory, remapper=None, - remappedDirectory=None): # {{{ + remappedDirectory=None): ''' Uses ncclimo to compute monthly, seasonal and/or annual climatologies. @@ -551,11 +537,8 @@ def _compute_climatologies_with_ncclimo(self, inDirectory, outDirectory, os.chdir(workDir) - # }}} - # }}} - -class MpasClimatologySeasonSubtask(AnalysisTask): # {{{ +class MpasClimatologySeasonSubtask(AnalysisTask): ''' An analysis subtasks for computing climatologies from output from the ``timeSeriesStatsMonthly`` analysis member for a single month or season. @@ -569,11 +552,12 @@ class MpasClimatologySeasonSubtask(AnalysisTask): # {{{ parentTask : ``MpasClimatologyTask`` The task that this subtask belongs to. ''' + # Authors # ------- # Xylar Asay-Davis - def __init__(self, parentTask, season, subtaskName=None): # {{{ + def __init__(self, parentTask, season, subtaskName=None): ''' Construct the analysis task and adds it as a subtask of the ``parentTask``. @@ -617,9 +601,7 @@ def __init__(self, parentTask, season, subtaskName=None): # {{{ multiprocessing.cpu_count(), self.config.getint('climatology', 'daskThreads')) - # }}} - - def run_task(self): # {{{ + def run_task(self): ''' Compute the requested climatologies ''' @@ -641,8 +623,8 @@ def run_task(self): # {{{ self.logger.info('\nComputing MPAS climatology from files:\n' ' {} through\n {}'.format( - os.path.basename(parentTask.inputFiles[0]), - os.path.basename(parentTask.inputFiles[-1]))) + os.path.basename(parentTask.inputFiles[0]), + os.path.basename(parentTask.inputFiles[-1]))) climatologyFileName = parentTask.get_file_name(season) climatologyDirectory = get_unmasked_mpas_climatology_directory( @@ -665,10 +647,8 @@ def run_task(self): # {{{ inDirectory=parentTask.symlinkDirectory, outDirectory=climatologyDirectory) - # }}} - def _compute_climatologies_with_xarray(self, inDirectory, outDirectory): - # {{{ + ''' Uses xarray to compute seasonal and/or annual climatologies. @@ -680,6 +660,7 @@ def _compute_climatologies_with_xarray(self, inDirectory, outDirectory): outDirectory : str The output directory where climatologies will be written ''' + # Authors # ------- # Xylar Asay-Davis @@ -701,7 +682,7 @@ def _preprocess(ds): fileNames = sorted(parentTask.inputFiles) years, months = get_files_year_month( - fileNames, self.historyStreams, + fileNames, self.historyStreams, parentTask.streamName) with xarray.open_mfdataset(parentTask.inputFiles, @@ -729,9 +710,9 @@ def _preprocess(ds): fileNames = [] weights = [] for month in constants.monthDictionary[season]: - monthName = constants.abrevMonthNames[month-1] + monthName = constants.abrevMonthNames[month - 1] fileNames.append(parentTask.get_file_name(season=monthName)) - weights.append(constants.daysInMonth[month-1]) + weights.append(constants.daysInMonth[month - 1]) with xarray.open_mfdataset(fileNames, concat_dim='weight', combine='nested', @@ -739,12 +720,7 @@ def _preprocess(ds): decode_cf=False, decode_times=False, preprocess=_preprocess) as ds: ds.coords['weight'] = ('weight', weights) - ds = ((ds.weight*ds).sum(dim='weight') / + ds = ((ds.weight * ds).sum(dim='weight') / ds.weight.sum(dim='weight')) ds.compute(num_workers=self.subprocessCount) write_netcdf(ds, outFileName) - - # }}} - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/shared/climatology/ref_year_mpas_climatology_task.py b/mpas_analysis/shared/climatology/ref_year_mpas_climatology_task.py index ee6cb1bed..1beb9dc57 100644 --- a/mpas_analysis/shared/climatology/ref_year_mpas_climatology_task.py +++ b/mpas_analysis/shared/climatology/ref_year_mpas_climatology_task.py @@ -17,7 +17,7 @@ from mpas_analysis.shared.timekeeping.utility import get_simulation_start_time -class RefYearMpasClimatologyTask(MpasClimatologyTask): # {{{ +class RefYearMpasClimatologyTask(MpasClimatologyTask): ''' An analysis tasks for computing a reference-year climatology for computing climatology anomalies from the``timeSeriesStatsMonthly`` analysis member. @@ -32,7 +32,7 @@ class RefYearMpasClimatologyTask(MpasClimatologyTask): # {{{ # ------- # Xylar Asay-Davis - def __init__(self, config, componentName, taskName=None): # {{{ + def __init__(self, config, componentName, taskName=None): ''' Construct the analysis task and adds it as a subtask of the ``parentTask``. @@ -69,9 +69,8 @@ def __init__(self, config, componentName, taskName=None): # {{{ taskName=taskName) self.tags.append('anomaly') - # }}} - def get_start_and_end(self): # {{{ + def get_start_and_end(self): """ Get the start and end years and dates for the climatology. This function is provided to allow a custom method for setting the start @@ -108,8 +107,4 @@ def get_start_and_end(self): # {{{ return startYear, endYear - # }}} - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/shared/climatology/remap_mpas_climatology_subtask.py b/mpas_analysis/shared/climatology/remap_mpas_climatology_subtask.py index 5a01a8d60..8571db6d3 100644 --- a/mpas_analysis/shared/climatology/remap_mpas_climatology_subtask.py +++ b/mpas_analysis/shared/climatology/remap_mpas_climatology_subtask.py @@ -14,7 +14,6 @@ import os from pyremap import MpasMeshDescriptor - from mpas_analysis.shared.analysis_task import AnalysisTask from mpas_analysis.shared.constants import constants @@ -31,7 +30,7 @@ get_comparison_descriptor -class RemapMpasClimatologySubtask(AnalysisTask): # {{{ +class RemapMpasClimatologySubtask(AnalysisTask): ''' An analysis tasks for computing climatologies from output from the ``timeSeriesStatsMonthly`` analysis member. @@ -74,6 +73,7 @@ class RemapMpasClimatologySubtask(AnalysisTask): # {{{ operator for monthly stats ''' + # Authors # ------- # Xylar Asay-Davis @@ -82,7 +82,7 @@ def __init__(self, mpasClimatologyTask, parentTask, climatologyName, variableList, seasons, comparisonGridNames=None, iselValues=None, subtaskName='remapMpasClimatology', useNcremap=None): - # {{{ + ''' Construct the analysis task and adds it as a subtask of the ``parentTask``. @@ -174,9 +174,7 @@ def __init__(self, mpasClimatologyTask, parentTask, climatologyName, else: self.useNcremap = useNcremap - # }}} - - def setup_and_check(self): # {{{ + def setup_and_check(self): ''' Perform steps to set up the analysis and check for errors in the setup. @@ -219,9 +217,7 @@ def setup_and_check(self): # {{{ 'mappingSubdirectory') make_directories(mappingSubdirectory) - # }}} - - def run_task(self): # {{{ + def run_task(self): ''' Compute the requested climatologies ''' @@ -260,10 +256,9 @@ def run_task(self): # {{{ remapper=self.remappers[comparisonGridName], comparisonGridName=comparisonGridName, season=season) - # }}} def add_comparison_grid_descriptor(self, comparisonGridName, - comparisonDescriptor): # {{{ + comparisonDescriptor): ''' Add a custom grid descriptor (something other than 'latlon', 'antarctic', 'arctic', 'north_atlantic', or 'north_pacific'). @@ -279,9 +274,9 @@ def add_comparison_grid_descriptor(self, comparisonGridName, ''' self.comparisonDescriptors[comparisonGridName] = \ - comparisonDescriptor # }}} + comparisonDescriptor - def get_masked_file_name(self, season): # {{{ + def get_masked_file_name(self, season): """ Given config options, the name of a field and a string identifying the months in a seasonal climatology, returns the full path for MPAS @@ -307,9 +302,9 @@ def get_masked_file_name(self, season): # {{{ self.climatologyName, self.op) - return fileName # }}} + return fileName - def get_remapped_file_name(self, season, comparisonGridName): # {{{ + def get_remapped_file_name(self, season, comparisonGridName): """ Given config options, the name of a field and a string identifying the months in a seasonal climatology, returns the full path for MPAS @@ -336,9 +331,9 @@ def get_remapped_file_name(self, season, comparisonGridName): # {{{ self.config, season, self.componentName, self.climatologyName, comparisonGridName, self.op) - return fileName # }}} + return fileName - def customize_masked_climatology(self, climatology, season): # {{{ + def customize_masked_climatology(self, climatology, season): """ Override this function to customize the climatology during the masking phase (before remapping) @@ -362,10 +357,10 @@ def customize_masked_climatology(self, climatology, season): # {{{ # ------- # Xylar Asay-Davis - return climatology # }}} + return climatology def customize_remapped_climatology(self, climatology, comparisonGridNames, - season): # {{{ + season): """ Override this function to customize the climatology after remapping @@ -390,9 +385,9 @@ def customize_remapped_climatology(self, climatology, comparisonGridNames, # ------- # Xylar Asay-Davis - return climatology # }}} + return climatology - def _setup_remappers(self): # {{{ + def _setup_remappers(self): """ Set up the remappers for remapping from the MPAS to the comparison grids. @@ -407,7 +402,6 @@ def _setup_remappers(self): # {{{ mappingFilePrefix = 'map' self.remappers = {} for comparisonGridName in self.comparisonDescriptors: - comparisonDescriptor = \ self.comparisonDescriptors[comparisonGridName] self.comparisonGridName = comparisonDescriptor.meshName @@ -423,9 +417,7 @@ def _setup_remappers(self): # {{{ method=config.get('climatology', 'mpasInterpolationMethod'), logger=self.logger) - # }}} - - def _setup_file_names(self): # {{{ + def _setup_file_names(self): """ Create a dictionary of file names and directories for this climatology """ @@ -494,9 +486,8 @@ def _setup_file_names(self): # {{{ self._outputDirs[key] = directory self._outputFiles[key] = fileName - # }}} - def _mask_climatologies(self, season, dsMask): # {{{ + def _mask_climatologies(self, season, dsMask): ''' For each season, creates a masked version of the climatology @@ -547,10 +538,9 @@ def _mask_climatologies(self, season, dsMask): # {{{ season) write_netcdf(climatology, maskedClimatologyFileName) - # }}} def _remap(self, inFileName, outFileName, remapper, comparisonGridName, - season): # {{{ + season): """ Performs remapping either using ``ncremap`` or the native python code, depending on the requested setting and the comparison grid @@ -612,9 +602,4 @@ def _remap(self, inFileName, outFileName, remapper, comparisonGridName, remappedClimatology = self.customize_remapped_climatology( remappedClimatology, comparisonGridName, season) - write_netcdf(remappedClimatology, outFileName) # }}} - - # }}} - - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python + write_netcdf(remappedClimatology, outFileName) diff --git a/mpas_analysis/shared/climatology/remap_observed_climatology_subtask.py b/mpas_analysis/shared/climatology/remap_observed_climatology_subtask.py index 470eff12c..34cbe4d4a 100644 --- a/mpas_analysis/shared/climatology/remap_observed_climatology_subtask.py +++ b/mpas_analysis/shared/climatology/remap_observed_climatology_subtask.py @@ -27,7 +27,7 @@ get_comparison_descriptor -class RemapObservedClimatologySubtask(AnalysisTask): # {{{ +class RemapObservedClimatologySubtask(AnalysisTask): """ An analysis task for comparison of 2D model fields against observations. @@ -47,6 +47,7 @@ class RemapObservedClimatologySubtask(AnalysisTask): # {{{ comparisonGridNames : list of str The name(s) of the comparison grid to use for remapping. """ + # Authors # ------- # Xylar Asay-Davis @@ -54,7 +55,7 @@ class RemapObservedClimatologySubtask(AnalysisTask): # {{{ def __init__(self, parentTask, seasons, fileName, outFilePrefix, comparisonGridNames=['latlon'], subtaskName='remapObservations'): - # {{{ + ''' Construct one analysis subtask for each plot (i.e. each season and comparison grid) and a subtask for computing climatologies. @@ -100,9 +101,8 @@ def __init__(self, parentTask, seasons, fileName, outFilePrefix, super(RemapObservedClimatologySubtask, self).__init__( config=config, taskName=taskName, subtaskName=subtaskName, componentName=componentName, tags=tags) - # }}} - def setup_and_check(self): # {{{ + def setup_and_check(self): """ Perform steps to set up the analysis and check for errors in the setup. """ @@ -128,9 +128,7 @@ def setup_and_check(self): # {{{ ds = self.build_observational_dataset(self.fileName) write_netcdf(ds, obsFileName) - # }}} - - def run_task(self): # {{{ + def run_task(self): """ Performs remapping of obsrevations to the comparsion grid """ @@ -188,9 +186,7 @@ def run_task(self): # {{{ remappedFileName, remapper, logger=self.logger) - # }}} - - def get_observation_descriptor(self, fileName): # {{{ + def get_observation_descriptor(self, fileName): ''' get a MeshDescriptor for the observation grid. A subclass derived from this class must override this method to create the appropriate @@ -210,9 +206,9 @@ def get_observation_descriptor(self, fileName): # {{{ # ------- # Xylar Asay-Davis - return None # }}} + return None - def build_observational_dataset(self, fileName): # {{{ + def build_observational_dataset(self, fileName): ''' read in the data sets for observations, and possibly rename some variables and dimensions. A subclass derived from this class must @@ -232,12 +228,10 @@ def build_observational_dataset(self, fileName): # {{{ # ------- # Xylar Asay-Davis - return None # }}} - - # }}} + return None def get_file_name(self, stage, season=None, comparisonGridName=None): - # {{{ + """ Given config options, the name of a field and a string identifying the months in a seasonal climatology, returns the full path for MPAS @@ -307,9 +301,9 @@ def get_file_name(self, stage, season=None, comparisonGridName=None): else: raise ValueError('Unknown stage {}'.format(stage)) - return fileName # }}} + return fileName - def _setup_remappers(self, fileName): # {{{ + def _setup_remappers(self, fileName): """ Set up the remappers for remapping from observations to the comparison grids. @@ -332,7 +326,6 @@ def _setup_remappers(self, fileName): # {{{ outFilePrefix = self.outFilePrefix self.remappers = {} for comparisonGridName in self.comparisonGridNames: - comparisonDescriptor = get_comparison_descriptor( config, comparison_grid_name=comparisonGridName) @@ -344,7 +337,3 @@ def _setup_remappers(self, fileName): # {{{ method=config.get(sectionName, 'interpolationMethod'), logger=self.logger) - # }}} - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/shared/constants/constants.py b/mpas_analysis/shared/constants/constants.py index 6626d3df0..14634ab1d 100644 --- a/mpas_analysis/shared/constants/constants.py +++ b/mpas_analysis/shared/constants/constants.py @@ -69,5 +69,3 @@ # cm per m cm_per_m = 100. - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/shared/containers.py b/mpas_analysis/shared/containers.py index 6ba6ece8d..4302734b4 100644 --- a/mpas_analysis/shared/containers.py +++ b/mpas_analysis/shared/containers.py @@ -19,7 +19,7 @@ from collections.abc import Mapping -class ReadOnlyDict(Mapping): # {{{ +class ReadOnlyDict(Mapping): """ Read only-dictionary http://stackoverflow.com/questions/19022868/how-to-make-dictionary-read-only-in-python 310/22/2016 @@ -38,5 +38,3 @@ def __len__(self): def __iter__(self): return iter(self._data) # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/shared/generalized_reader/generalized_reader.py b/mpas_analysis/shared/generalized_reader/generalized_reader.py index 6779cb704..ad980846c 100644 --- a/mpas_analysis/shared/generalized_reader/generalized_reader.py +++ b/mpas_analysis/shared/generalized_reader/generalized_reader.py @@ -37,7 +37,7 @@ def open_multifile_dataset(fileNames, calendar, config, variableList=None, selValues=None, iselValues=None, variableMap=None, startDate=None, endDate=None, - chunking=None): # {{{ + chunking=None): """ Opens and returns an xarray data set given file name(s) and the MPAS calendar name. @@ -169,12 +169,12 @@ def open_multifile_dataset(fileNames, calendar, config, ds = mpas_xarray.process_chunking(ds, chunking) - return ds # }}} + return ds def _preprocess(ds, calendar, simulationStartTime, timeVariableName, variableList, selValues, iselValues, variableMap, - startDate, endDate): # {{{ + startDate, endDate): """ Performs variable remapping, then calls mpas_xarray.preprocess, to perform the remainder of preprocessing. @@ -277,10 +277,10 @@ def _preprocess(ds, calendar, simulationStartTime, timeVariableName, selValues=selValues, iselValues=iselValues) - return ds # }}} + return ds -def _map_variable_name(variableName, ds, variableMap): # {{{ +def _map_variable_name(variableName, ds, variableMap): """ Given a `variableName` in a `variableMap` and an xarray `ds`, return the name of the the first variable in `variableMap[variableName]` @@ -339,10 +339,9 @@ def _map_variable_name(variableName, ds, variableMap): # {{{ 'variables in {}.'.format( variableName, possibleVariables, ds.data_vars.keys())) - # }}} -def _rename_variables(ds, variableMap): # {{{ +def _rename_variables(ds, variableMap): """ Given an `xarray.DataSet` object `ds` and a dictionary mapping variable names `variableMap`, returns a new data set in which variables @@ -376,7 +375,7 @@ def _rename_variables(ds, variableMap): # {{{ renameDict[datasetVariable] = mapVariable break - return ds.rename(renameDict) # }}} + return ds.rename(renameDict) # vim: ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/shared/html/image_xml.py b/mpas_analysis/shared/html/image_xml.py index ffb5b3392..64435b7bd 100644 --- a/mpas_analysis/shared/html/image_xml.py +++ b/mpas_analysis/shared/html/image_xml.py @@ -148,7 +148,7 @@ def write_image_xml(config, filePrefix, componentName, componentSubdirectory, tree.write(xmlFileName, xml_declaration=True, pretty_print=True) -def _provenance_command(root, history): # {{{ +def _provenance_command(root, history): """ Utility funciton for provenance of xml file associated with a plot. """ @@ -183,7 +183,7 @@ def _provenance_command(root, history): # {{{ except (IOError, OSError): githash = 'git hash unavailable' - etree.SubElement(root, 'githash').text = githash # }}} + etree.SubElement(root, 'githash').text = githash def _generate_thumbnails(imageFileName, directory): @@ -237,5 +237,3 @@ def _generate_thumbnails(imageFileName, directory): return imageSize, thumbnailSize, orientation - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/shared/html/pages.py b/mpas_analysis/shared/html/pages.py index 87784b492..279000cff 100644 --- a/mpas_analysis/shared/html/pages.py +++ b/mpas_analysis/shared/html/pages.py @@ -22,7 +22,6 @@ def generate_html(config, analyses, controlConfig, customConfigFiles): - # {{{ """ Generates webpages for diplaying the plots from each analysis task @@ -96,8 +95,6 @@ def generate_html(config, analyses, controlConfig, customConfigFiles): if url is None: print("Done.") - # }}} - class MainPage(object): """ @@ -122,6 +119,7 @@ class MainPage(object): Each component has a name, subdirectory and image name used to find the appropriate thumbnail. """ + # Authors # ------- # Xylar Asay-Davis @@ -228,7 +226,7 @@ def generate(self): # substitute entries in the template and add the component to # the text describing all components componentsText = componentsText + \ - _replace_tempate_text(self.componentTemplate, replacements) + _replace_tempate_text(self.componentTemplate, replacements) githash = _get_git_hash() if githash is None: @@ -248,13 +246,13 @@ def generate(self): '@configDesc': shortName} configsText = configsText + \ - _replace_tempate_text(self.configTemplate, replacements) + _replace_tempate_text(self.configTemplate, replacements) replacements = {'@configName': 'complete.{}.cfg'.format(runName), '@configDesc': 'Complete Configuration File'} configsText = configsText + \ - _replace_tempate_text(self.configTemplate, replacements) + _replace_tempate_text(self.configTemplate, replacements) replacements = {'@runName': runName, '@controlRunText': controlRunText, @@ -336,6 +334,7 @@ class ComponentPage(object): A tree of information describing the the gallery groups in the page, the galleries in each group and the images in each gallery. """ + # Authors # ------- # Xylar Asay-Davis @@ -377,7 +376,6 @@ def __init__(self, config, name, subdirectory, controlConfig=None): for templateName in ['page', 'quicklink', 'group', 'gallery', 'image', 'subtitle']: - # get template text fileName = pkg_resources.resource_filename( __name__, @@ -497,10 +495,10 @@ def generate(self): galleriesText = '' for groupName, groupDict in self.groups.items(): quickLinkText = quickLinkText + \ - self._generate_quick_link_text(groupName, groupDict) + self._generate_quick_link_text(groupName, groupDict) galleriesText = galleriesText + \ - self._generate_group_text(groupName, groupDict) + self._generate_group_text(groupName, groupDict) replacements = {'@runName': runName, '@controlRunText': controlRunText, @@ -563,7 +561,7 @@ def _generate_gallery_text(self, galleryName, images): imagesText = '' for imageFileName, imageDict in images.items(): imagesText = imagesText + \ - self._generate_image_text(imageFileName, imageDict) + self._generate_image_text(imageFileName, imageDict) if galleryName == 'None': galleryTitle = '' @@ -595,7 +593,7 @@ def _generate_group_text(self, groupName, groupDict): galleriesText = '' for galleryName, galleryDict in groupDict['galleries'].items(): galleriesText = galleriesText + \ - self._generate_gallery_text(galleryName, galleryDict['images']) + self._generate_gallery_text(galleryName, galleryDict['images']) replacements = {'@analysisGroupName': groupName, '@analysisGroupLink': groupDict['link'], diff --git a/mpas_analysis/shared/interpolation/interp_1d.py b/mpas_analysis/shared/interpolation/interp_1d.py index 2b37d8098..c19cd718d 100644 --- a/mpas_analysis/shared/interpolation/interp_1d.py +++ b/mpas_analysis/shared/interpolation/interp_1d.py @@ -13,7 +13,7 @@ def interp_1d(ds, inInterpDim, inInterpCoord, outInterpDim, - outInterpCoord): # {{{ + outInterpCoord): """ Interpolate 1D or 2D fields in 1D @@ -46,11 +46,11 @@ def interp_1d(ds, inInterpDim, inInterpCoord, outInterpDim, # conert back to coords ds = ds.set_coords(coords) - return ds # }}} + return ds def _compute_weights_and_indices(ds, inInterpDim, inInterpCoord, outInterpDim, - outInterpCoord): # {{{ + outInterpCoord): """ add interpolation weights and indices to the data set """ @@ -158,10 +158,10 @@ def _compute_weights_and_indices(ds, inInterpDim, inInterpCoord, outInterpDim, indices[dim] = xarray.DataArray(indices[dim], dims=allOutDims) weight0 = xarray.DataArray(weight0, dims=allOutDims) - return indices, weight0 # }}} + return indices, weight0 -def _interp_1d_array(da, indices, weight0, inInterpDim): # {{{ +def _interp_1d_array(da, indices, weight0, inInterpDim): """ iterpolate a data array in 1D with the given indices and weights """ @@ -181,6 +181,4 @@ def _interp_1d_array(da, indices, weight0, inInterpDim): # {{{ da0 = da.isel(**indices0) da1 = da.isel(**indices1) da = weight0 * da0 + (1. - weight0) * da1 - return da # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python + return da diff --git a/mpas_analysis/shared/io/mpas_reader.py b/mpas_analysis/shared/io/mpas_reader.py index 010a81892..90784501f 100644 --- a/mpas_analysis/shared/io/mpas_reader.py +++ b/mpas_analysis/shared/io/mpas_reader.py @@ -25,7 +25,7 @@ def open_mpas_dataset(fileName, calendar, timeVariableNames=['xtime_startMonthly', 'xtime_endMonthly'], - variableList=None, startDate=None, endDate=None): # {{{ + variableList=None, startDate=None, endDate=None): """ Opens and returns an xarray data set given file name(s) and the MPAS calendar name. @@ -92,12 +92,12 @@ def open_mpas_dataset(fileName, calendar, if variableList is not None: ds = ds[variableList] - return ds # }}} + return ds def _parse_dataset_time(ds, inTimeVariableName, calendar, outTimeVariableName='Time', - referenceDate='0001-01-01'): # {{{ + referenceDate='0001-01-01'): """ A helper function for computing a time coordinate from an MPAS time variable. Given a data set and a time variable name (or list of 2 @@ -201,7 +201,7 @@ def _parse_dataset_time(ds, inTimeVariableName, calendar, dsOut = ds.copy() dsOut.coords[outTimeVariableName] = (outTimeVariableName, days) - return dsOut # }}} + return dsOut # vim: ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/shared/io/namelist_streams_interface.py b/mpas_analysis/shared/io/namelist_streams_interface.py index d7a441b91..4528826db 100644 --- a/mpas_analysis/shared/io/namelist_streams_interface.py +++ b/mpas_analysis/shared/io/namelist_streams_interface.py @@ -69,6 +69,7 @@ class NameList: Class for fortran manipulation of namelist files, provides read and write functionality """ + # Authors # ------- # Phillip Wolfram, Xylar Asay-Davis @@ -260,14 +261,13 @@ def find_option(self, possibleOptions): raise ValueError('None of the possible options {} found in namelist ' 'file {}.'.format(possibleOptions, self.fname)) - # }}} - class StreamsFile: """ Class to read in streams configuration file, provdies read and write functionality """ + # Authors # ------- # Phillip Wolfram, Xylar Asay-Davis @@ -534,5 +534,3 @@ def find_stream(self, possibleStreams): raise ValueError('None of the possible streams {} found in streams ' 'file {}.'.format(possibleStreams, self.fname)) - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/shared/io/utility.py b/mpas_analysis/shared/io/utility.py index 6c5a3d0d2..9a1b70d53 100644 --- a/mpas_analysis/shared/io/utility.py +++ b/mpas_analysis/shared/io/utility.py @@ -24,7 +24,7 @@ import warnings -def paths(*args): # {{{ +def paths(*args): """ Returns glob'd paths in list for arbitrary number of function arguments. Note, each expanded set of paths is sorted. @@ -46,11 +46,11 @@ def paths(*args): # {{{ paths = [] for aargs in args: paths += sorted(glob.glob(aargs)) - return paths # }}} + return paths def fingerprint_generator(size=12, - chars=string.ascii_uppercase + string.digits): # {{{ + chars=string.ascii_uppercase + string.digits): """ Returns a random string that can be used as a unique fingerprint @@ -75,10 +75,10 @@ def fingerprint_generator(size=12, # ------- # Phillip J. Wolfram - return ''.join(random.choice(chars) for _ in range(size)) # }}} + return ''.join(random.choice(chars) for _ in range(size)) -def make_directories(path): # {{{ +def make_directories(path): """ Make the given path if it does not already exist. @@ -100,13 +100,13 @@ def make_directories(path): # {{{ os.makedirs(path) except OSError: pass - return path # }}} + return path def build_config_full_path(config, section, relativePathOption, relativePathSection=None, defaultPath=None, - baseDirectoryOption='baseDirectory'): # {{{ + baseDirectoryOption='baseDirectory'): """ Get a full path from a base directory and a relative path @@ -154,10 +154,10 @@ def build_config_full_path(config, section, relativePathOption, if defaultPath is not None and not os.path.exists(fullPath): fullPath = defaultPath - return fullPath # }}} + return fullPath -def get_region_mask(config, regionMaskFile): # {{{ +def get_region_mask(config, regionMaskFile): """ Get the full path for a region mask with a given file name @@ -214,11 +214,11 @@ def get_region_mask(config, regionMaskFile): # {{{ fullFileName = '{}/{}'.format(maskSubdirectory, regionMaskFile) - return fullFileName # }}} + return fullFileName def build_obs_path(config, component, relativePathOption=None, - relativePathSection=None, relativePath=None): # {{{ + relativePathSection=None, relativePath=None): """ Parameters @@ -274,10 +274,10 @@ def build_obs_path(config, component, relativePathOption=None, fullPath = '{}/{}/{}'.format(basePath, obsSubdirectory, relativePath) - return fullPath # }}} + return fullPath -def check_path_exists(path): # {{{ +def check_path_exists(path): """ Raise an exception if the given path does not exist. @@ -296,10 +296,10 @@ def check_path_exists(path): # {{{ # Xylar Asay-Davis if not (os.path.isdir(path) or os.path.isfile(path)): - raise OSError('Path {} not found'.format(path)) # }}} + raise OSError('Path {} not found'.format(path)) -def get_files_year_month(fileNames, streamsFile, streamName): # {{{ +def get_files_year_month(fileNames, streamsFile, streamName): """ Extract the year and month from file names associated with a stream @@ -331,7 +331,7 @@ def get_files_year_month(fileNames, streamsFile, streamName): # {{{ years = [dt.year for dt in dts] months = [dt.month for dt in dts] - return years, months # }}} + return years, months def decode_strings(da): @@ -371,5 +371,3 @@ def copyfile(src, dst): warnings.warn('Making a slow copy from {} to {}'.format(src, dst)) with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst: shutil.copyfileobj(fsrc, fdst) - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/shared/io/write_netcdf.py b/mpas_analysis/shared/io/write_netcdf.py index b885c5f00..136826d7e 100644 --- a/mpas_analysis/shared/io/write_netcdf.py +++ b/mpas_analysis/shared/io/write_netcdf.py @@ -12,7 +12,7 @@ import numpy -def write_netcdf(ds, fileName, fillValues=netCDF4.default_fillvals): # {{{ +def write_netcdf(ds, fileName, fillValues=netCDF4.default_fillvals): ''' Write an xarray data set to a NetCDF file using finite fill values and unicode strings @@ -52,6 +52,5 @@ def write_netcdf(ds, fileName, fillValues=netCDF4.default_fillvals): # {{{ ds.to_netcdf(fileName, encoding=encodingDict) - # }}} # vim: ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/shared/mpas_xarray/mpas_xarray.py b/mpas_analysis/shared/mpas_xarray/mpas_xarray.py index d5c936fb3..d9cbbede3 100644 --- a/mpas_analysis/shared/mpas_xarray/mpas_xarray.py +++ b/mpas_analysis/shared/mpas_xarray/mpas_xarray.py @@ -34,7 +34,7 @@ def open_multifile_dataset(fileNames, calendar, simulationStartTime=None, timeVariableName='xtime', variableList=None, selValues=None, - iselValues=None): # {{{ + iselValues=None): """ Opens and returns an xarray data set given file name(s) and the MPAS calendar name. @@ -117,10 +117,10 @@ def open_multifile_dataset(fileNames, calendar, ds = remove_repeated_time_index(ds) - return ds # }}} + return ds -def subset_variables(ds, variableList): # {{{ +def subset_variables(ds, variableList): """ Given a data set and a list of variable names, returns a new data set that contains only variables with those names. @@ -163,11 +163,11 @@ def subset_variables(ds, variableList): # {{{ 'are not found within the dataset ' 'variables: {}.'.format(variableList, allvars)) - return ds # }}} + return ds def preprocess(ds, calendar, simulationStartTime, timeVariableName, - variableList, selValues, iselValues): # {{{ + variableList, selValues, iselValues): """ Builds correct time specification for MPAS, allowing a date offset because the time must be between 1678 and 2262 based on the xarray @@ -257,10 +257,10 @@ def preprocess(ds, calendar, simulationStartTime, timeVariableName, if iselValues is not None: ds = ds.isel(**iselValues) - return ds # }}} + return ds -def remove_repeated_time_index(ds): # {{{ +def remove_repeated_time_index(ds): """ Remove repeated times from xarray dataset. @@ -297,10 +297,10 @@ def remove_repeated_time_index(ds): # {{{ # remove repeated indices ds = ds.isel(Time=indices) - return ds # }}} + return ds -def _assert_valid_selections(ds, selvals, iselvals): # {{{ +def _assert_valid_selections(ds, selvals, iselvals): """ Ensure that dataset selections are compatable. @@ -332,10 +332,10 @@ def test_vals_in_ds(vals, dims): test_vals_in_ds(selvals, ds.dims) test_vals_in_ds(iselvals, ds.dims) - return # }}} + return -def _ensure_list(alist): # {{{ +def _ensure_list(alist): """ Ensure that variables used as a list are actually lists. """ @@ -347,12 +347,12 @@ def _ensure_list(alist): # {{{ # print 'Warning, converting %s to a list'%(alist) alist = [alist] - return alist # }}} + return alist def _parse_dataset_time(ds, inTimeVariableName, calendar, simulationStartTime, outTimeVariableName, - referenceDate): # {{{ + referenceDate): """ A helper function for computing a time coordinate from an MPAS time variable. Given a data set and a time variable name (or tuple of 2 @@ -508,10 +508,10 @@ def _parse_dataset_time(ds, inTimeVariableName, calendar, dsOut = ds.copy() dsOut.coords[outTimeVariableName] = (outTimeVariableName, days) - return dsOut # }}} + return dsOut -def process_chunking(ds, chunking): # {{{ +def process_chunking(ds, chunking): """ Computes chunking for a dataset. @@ -559,6 +559,6 @@ def process_chunking(ds, chunking): # {{{ 'Chunking parameter choice is not understood ' 'for {} of type {}\n'.format(chunking, type(chunking))) - return ds # }}} + return ds # vim: ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/shared/plot/climatology_map.py b/mpas_analysis/shared/plot/climatology_map.py index db70b0502..2e75d463b 100644 --- a/mpas_analysis/shared/plot/climatology_map.py +++ b/mpas_analysis/shared/plot/climatology_map.py @@ -731,5 +731,3 @@ def _add_land_lakes_coastline(ax, ice_shelves=True): facecolor='lightgray', linewidth=0.5) ax.add_feature(ice_50m, zorder=3) ax.add_feature(lakes_50m, zorder=4) - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/shared/plot/colormap.py b/mpas_analysis/shared/plot/colormap.py index 33b9fc4b2..07ed38113 100644 --- a/mpas_analysis/shared/plot/colormap.py +++ b/mpas_analysis/shared/plot/colormap.py @@ -493,5 +493,3 @@ def _plot_color_gradients(): ax.set_axis_off() plt.savefig('colormaps.png', dpi=100) - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/shared/plot/oned.py b/mpas_analysis/shared/plot/oned.py index a88a0cad3..dc7d2b7c1 100644 --- a/mpas_analysis/shared/plot/oned.py +++ b/mpas_analysis/shared/plot/oned.py @@ -37,7 +37,7 @@ def plot_1D(config, xArrays, fieldArrays, errArrays, maxTitleLength=80, titleFontSize=None, axisFontSize=None, - defaultFontSize=None): # {{{ + defaultFontSize=None): """ Plots a 1D line plot with error bars if available. @@ -185,7 +185,5 @@ def plot_1D(config, xArrays, fieldArrays, errArrays, if fileout is not None: savefig(fileout, config) - plt.close() # }}} + plt.close() - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/shared/plot/save.py b/mpas_analysis/shared/plot/save.py index 017669a76..10ce1fc5d 100644 --- a/mpas_analysis/shared/plot/save.py +++ b/mpas_analysis/shared/plot/save.py @@ -53,5 +53,3 @@ def savefig(filename, config, tight=True, pad_inches=0.1): plt.close() - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/shared/plot/ticks.py b/mpas_analysis/shared/plot/ticks.py index 801cc9dbf..039ebbaa3 100644 --- a/mpas_analysis/shared/plot/ticks.py +++ b/mpas_analysis/shared/plot/ticks.py @@ -88,5 +88,3 @@ def _date_tick(days, pos, calendar='gregorian', includeMonth=True): else: return '{:04d}'.format(date.year) - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/shared/plot/time_series.py b/mpas_analysis/shared/plot/time_series.py index c8c3530cd..69c4c2ec8 100644 --- a/mpas_analysis/shared/plot/time_series.py +++ b/mpas_analysis/shared/plot/time_series.py @@ -395,5 +395,3 @@ def timeseries_analysis_plot_polar(config, dsvalues, title, plt.title(title, **title_font) return fig - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/shared/plot/vertical_section.py b/mpas_analysis/shared/plot/vertical_section.py index f4646dd6a..44a1036cd 100644 --- a/mpas_analysis/shared/plot/vertical_section.py +++ b/mpas_analysis/shared/plot/vertical_section.py @@ -580,7 +580,7 @@ def plot_vertical_section( comparisonContourLineColor=None, labelContours=False, contourLabelPrecision=1, - maxTitleLength=70): # {{{ + maxTitleLength=70): """ Plots a data set as a x distance (latitude, longitude, or spherical distance) vs depth map (vertical section). @@ -847,7 +847,6 @@ def plot_vertical_section( # compute moving averages with respect to the x dimension if movingAveragePoints is not None and movingAveragePoints != 1: - dim = field.dims[0] field = field.rolling(dim={dim: movingAveragePoints}, center=True).mean().dropna(dim) @@ -931,7 +930,6 @@ def plot_vertical_section( plt.tricontour(unmaskedTriangulation, landMask, levels=[0.0001], colors='black', linewidths=1) - # plot contours, if they were requested contourLevels = colormapDict['contours'] fmt_string = None @@ -966,14 +964,14 @@ def plot_vertical_section( if labelContours: originalFieldName = originalFieldName + " (" + colorbarLabel + ")" comparisonFieldName = comparisonFieldName + " (" + \ - colorbarLabel + ")" + colorbarLabel + ")" ax.legend([h1[0], h2[0]], [originalFieldName, comparisonFieldName], loc='upper center', bbox_to_anchor=(0.5, -0.25), ncol=1) if title is not None: if plotAsContours and labelContours \ and contourComparisonField is None: - title = limit_title(title, maxTitleLength-(3+len(colorbarLabel))) + title = limit_title(title, maxTitleLength - (3 + len(colorbarLabel))) title = title + " (" + colorbarLabel + ")" else: title = limit_title(title, maxTitleLength) @@ -1047,7 +1045,7 @@ def plot_vertical_section( for member in tickValues]) ax3.spines['top'].set_position(('outward', 36)) - return fig, ax # }}} + return fig, ax def _get_triangulation(x, y, mask): @@ -1055,7 +1053,7 @@ def _get_triangulation(x, y, mask): nx = x.sizes[x.dims[0]] - 1 ny = x.sizes[x.dims[1]] - 1 - nTriangles = 2*nx*ny + nTriangles = 2 * nx * ny mask = mask.values mask = np.logical_and(np.logical_and(mask[0:-1, 0:-1], mask[1:, 0:-1]), @@ -1071,13 +1069,13 @@ def _get_triangulation(x, y, mask): tris = np.zeros((nx, ny, 2, 3), int) # upper triangles: - tris[:, :, 0, 0] = (ny+1)*xIndices + yIndices - tris[:, :, 0, 1] = (ny+1)*(xIndices + 1) + yIndices - tris[:, :, 0, 2] = (ny+1)*xIndices + yIndices + 1 + tris[:, :, 0, 0] = (ny + 1) * xIndices + yIndices + tris[:, :, 0, 1] = (ny + 1) * (xIndices + 1) + yIndices + tris[:, :, 0, 2] = (ny + 1) * xIndices + yIndices + 1 # lower triangle - tris[:, :, 1, 0] = (ny+1)*xIndices + yIndices + 1 - tris[:, :, 1, 1] = (ny+1)*(xIndices + 1) + yIndices - tris[:, :, 1, 2] = (ny+1)*(xIndices + 1) + yIndices + 1 + tris[:, :, 1, 0] = (ny + 1) * xIndices + yIndices + 1 + tris[:, :, 1, 1] = (ny + 1) * (xIndices + 1) + yIndices + tris[:, :, 1, 2] = (ny + 1) * (xIndices + 1) + yIndices + 1 tris = tris.reshape((nTriangles, 3)) @@ -1088,5 +1086,3 @@ def _get_triangulation(x, y, mask): unmaskedTriangulation = Triangulation(x=x, y=y, triangles=tris) return maskedTriangulation, unmaskedTriangulation - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/shared/regions/compute_region_masks_subtask.py b/mpas_analysis/shared/regions/compute_region_masks_subtask.py index 8ccd52b1f..ac0ba67ab 100644 --- a/mpas_analysis/shared/regions/compute_region_masks_subtask.py +++ b/mpas_analysis/shared/regions/compute_region_masks_subtask.py @@ -93,7 +93,7 @@ def compute_lon_lat_region_masks(gridFileName, lonVar, latVar, geojsonFileName, check_call(args=args, logger=logger) -class ComputeRegionMasksSubtask(AnalysisTask): # {{{ +class ComputeRegionMasksSubtask(AnalysisTask): """ An analysis tasks for computing cell masks for regions defined by geojson features @@ -129,6 +129,7 @@ class ComputeRegionMasksSubtask(AnalysisTask): # {{{ The name of the mesh or grid, used as part of the mask file name. Default is the MPAS mesh name """ + # Authors # ------- # Xylar Asay-Davis @@ -136,7 +137,7 @@ class ComputeRegionMasksSubtask(AnalysisTask): # {{{ def __init__(self, parentTask, regionGroup, meshName, subprocessCount=1, obsFileName=None, lonVar='lon', latVar='lat', useMpasMaskCreator=False): - # {{{ + """ Construct the analysis task and adds it as a subtask of the ``parentTask``. @@ -211,8 +212,6 @@ def __init__(self, parentTask, regionGroup, meshName, subprocessCount=1, parentTask.add_subtask(self) - # }}} - def make_region_mask(self): """ If the geojson mask file has not already been cached in the diagnostics @@ -246,7 +245,7 @@ def expand_region_names(self, regionNames): regionNames = get_feature_list(self.geojsonFileName) return regionNames - def setup_and_check(self): # {{{ + def setup_and_check(self): """ Perform steps to set up the analysis and check for errors in the setup. @@ -295,9 +294,8 @@ def setup_and_check(self): # {{{ if os.path.exists(self.maskFileName): # nothing to do so don't block a bunch of other processes self.subprocessCount = 1 - # }}} - def run_task(self): # {{{ + def run_task(self): """ Compute the requested climatologies """ @@ -332,7 +330,3 @@ def run_task(self): # {{{ self.geojsonFileName, self.maskFileName, self.logger, self.subprocessCount, multiprocessingMethod=multiprocessingMethod) - - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/shared/time_series/anomaly.py b/mpas_analysis/shared/time_series/anomaly.py index abcb63caf..f2ee540ba 100644 --- a/mpas_analysis/shared/time_series/anomaly.py +++ b/mpas_analysis/shared/time_series/anomaly.py @@ -19,7 +19,7 @@ def compute_moving_avg_anomaly_from_start(timeSeriesFileName, variableList, anomalyStartTime, anomalyEndTime, startDate, endDate, calendar, movingAveragePoints=12, - alter_dataset=None): # {{{ + alter_dataset=None): ''' Compute the rolling mean of the anomaly of a quantity from the beginning of the simulation (such that the rolling mean starts at zero by definition) @@ -88,6 +88,3 @@ def compute_moving_avg_anomaly_from_start(timeSeriesFileName, variableList, return ds - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/shared/time_series/moving_average.py b/mpas_analysis/shared/time_series/moving_average.py index f7569c6ae..f0511f9e6 100644 --- a/mpas_analysis/shared/time_series/moving_average.py +++ b/mpas_analysis/shared/time_series/moving_average.py @@ -12,7 +12,7 @@ # -def compute_moving_avg(ds, movingAveragePoints=12): # {{{ +def compute_moving_avg(ds, movingAveragePoints=12): ''' Compute the rolling mean of a data set @@ -39,6 +39,3 @@ def compute_moving_avg(ds, movingAveragePoints=12): # {{{ return ds - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/shared/time_series/mpas_time_series_task.py b/mpas_analysis/shared/time_series/mpas_time_series_task.py index 9626f1449..43cac37de 100644 --- a/mpas_analysis/shared/time_series/mpas_time_series_task.py +++ b/mpas_analysis/shared/time_series/mpas_time_series_task.py @@ -22,7 +22,7 @@ from mpas_analysis.shared.timekeeping.utility import get_simulation_start_time -class MpasTimeSeriesTask(AnalysisTask): # {{{ +class MpasTimeSeriesTask(AnalysisTask): ''' An analysis tasks for computing time series from output from the ``timeSeriesStatsMonthly`` analysis member. @@ -47,12 +47,13 @@ class MpasTimeSeriesTask(AnalysisTask): # {{{ startYear, endYear : int The start and end years of the time series ''' + # Authors # ------- # Xylar Asay-Davis def __init__(self, config, componentName, taskName=None, - subtaskName=None, section='timeSeries'): # {{{ + subtaskName=None, section='timeSeries'): ''' Construct the analysis task for extracting time series. @@ -88,7 +89,7 @@ def __init__(self, config, componentName, taskName=None, if taskName is None: suffix = section[0].upper() + section[1:] + \ - componentName[0].upper() + componentName[1:] + componentName[0].upper() + componentName[1:] taskName = 'mpas{}'.format(suffix) # call the constructor from the base class (AnalysisTask) @@ -99,9 +100,7 @@ def __init__(self, config, componentName, taskName=None, componentName=componentName, tags=tags) - # }}} - - def add_variables(self, variableList): # {{{ + def add_variables(self, variableList): ''' Add one or more variables to extract as a time series. @@ -139,9 +138,7 @@ def add_variables(self, variableList): # {{{ if variable not in self.variableList: self.variableList.append(variable) - # }}} - - def setup_and_check(self): # {{{ + def setup_and_check(self): ''' Perform steps to set up the analysis and check for errors in the setup. ''' @@ -185,8 +182,8 @@ def setup_and_check(self): # {{{ self.runMessage = '\nComputing MPAS time series from first year ' \ 'plus files:\n' \ ' {} through\n {}'.format( - os.path.basename(self.inputFiles[0]), - os.path.basename(self.inputFiles[-1])) + os.path.basename(self.inputFiles[0]), + os.path.basename(self.inputFiles[-1])) # Make sure first year of data is included for computing anomalies if config.has_option('timeSeries', 'anomalyRefYear'): @@ -210,9 +207,7 @@ def setup_and_check(self): # {{{ with xr.open_dataset(self.inputFiles[0]) as ds: self.allVariables = list(ds.data_vars.keys()) - # }}} - - def run_task(self): # {{{ + def run_task(self): ''' Compute the requested time series ''' @@ -228,10 +223,8 @@ def run_task(self): # {{{ self._compute_time_series_with_ncrcat() - # }}} - def _compute_time_series_with_ncrcat(self): - # {{{ + ''' Uses ncrcat to extact time series from timeSeriesMonthlyOutput files @@ -340,9 +333,3 @@ def _compute_time_series_with_ncrcat(self): if process.returncode != 0: raise subprocess.CalledProcessError(process.returncode, ' '.join(args)) - - # }}} - # }}} - - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/shared/time_series/time_series.py b/mpas_analysis/shared/time_series/time_series.py index 9eb94ac9c..0b8ad4cb5 100644 --- a/mpas_analysis/shared/time_series/time_series.py +++ b/mpas_analysis/shared/time_series/time_series.py @@ -27,7 +27,6 @@ def combine_time_series_with_ncrcat(inFileNames, outFileName, variableList=None, logger=None): - # {{{ ''' Uses ncrcat to extact time series from a series of files @@ -107,12 +106,10 @@ def combine_time_series_with_ncrcat(inFileNames, outFileName, raise subprocess.CalledProcessError(process.returncode, ' '.join(args)) - # }}} - def cache_time_series(timesInDataSet, timeSeriesCalcFunction, cacheFileName, calendar, yearsPerCacheUpdate=1, - logger=None): # {{{ + logger=None): ''' Create or update a NetCDF file ``cacheFileName`` containing the given time series, calculated with ``timeSeriesCalcFunction`` over the given times, @@ -235,7 +232,3 @@ def cache_time_series(timesInDataSet, timeSeriesCalcFunction, cacheFileName, dsCache.to_netcdf(cacheFileName) return dsCache.sel(Time=slice(timesInDataSet[0], timesInDataSet[-1])) - - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/shared/timekeeping/MpasRelativeDelta.py b/mpas_analysis/shared/timekeeping/MpasRelativeDelta.py index a72a96542..70e61de14 100644 --- a/mpas_analysis/shared/timekeeping/MpasRelativeDelta.py +++ b/mpas_analysis/shared/timekeeping/MpasRelativeDelta.py @@ -158,5 +158,3 @@ def __repr__(self): outList.append("calendar='{}'".format(self.calendar)) return "{classname}({attrs})".format(classname=self.__class__.__name__, attrs=", ".join(outList)) - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/shared/timekeeping/utility.py b/mpas_analysis/shared/timekeeping/utility.py index 227266d82..44e627ca5 100644 --- a/mpas_analysis/shared/timekeeping/utility.py +++ b/mpas_analysis/shared/timekeeping/utility.py @@ -68,7 +68,7 @@ def get_simulation_start_time(streams): return simulationStartTime -def string_to_datetime(dateString): # {{{ +def string_to_datetime(dateString): """ Given a date string and a calendar, returns a ``datetime.datetime`` @@ -109,10 +109,10 @@ def string_to_datetime(dateString): # {{{ _parse_date_string(dateString, isInterval=False) return datetime.datetime(year=year, month=month, day=day, hour=hour, - minute=minute, second=second) # }}} + minute=minute, second=second) -def string_to_relative_delta(dateString, calendar='gregorian'): # {{{ +def string_to_relative_delta(dateString, calendar='gregorian'): """ Given a date string and a calendar, returns an instance of ``MpasRelativeDelta`` @@ -159,7 +159,6 @@ def string_to_relative_delta(dateString, calendar='gregorian'): # {{{ return MpasRelativeDelta(years=years, months=months, days=days, hours=hours, minutes=minutes, seconds=seconds, calendar=calendar) - # }}} def string_to_days_since_date(dateString, calendar='gregorian', @@ -375,7 +374,7 @@ def date_to_days(year=1, month=1, day=1, hour=0, minute=0, second=0, calendar=calendar) -def _parse_date_string(dateString, isInterval=False): # {{{ +def _parse_date_string(dateString, isInterval=False): """ Given a string containing a date, returns a tuple defining a date of the form (year, month, day, hour, minute, second) appropriate for constructing @@ -460,7 +459,7 @@ def _parse_date_string(dateString, isInterval=False): # {{{ second = int(hms) minute = 0 hour = 0 - return (year, month, day, hour, minute, second) # }}} + return (year, month, day, hour, minute, second) def _mpas_to_netcdf_calendar(calendar): @@ -490,5 +489,3 @@ def _round_datetime(date): add_seconds = int(1e-6 * microsecond + 0.5) return date + datetime.timedelta(0, add_seconds) - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/shared/transects/compute_transect_masks_subtask.py b/mpas_analysis/shared/transects/compute_transect_masks_subtask.py index 4a9f1babf..0bcac310a 100644 --- a/mpas_analysis/shared/transects/compute_transect_masks_subtask.py +++ b/mpas_analysis/shared/transects/compute_transect_masks_subtask.py @@ -61,7 +61,7 @@ def compute_mpas_transect_masks(geojsonFileName, meshFileName, maskFileName, check_call(args, logger=logger) -class ComputeTransectMasksSubtask(AnalysisTask): # {{{ +class ComputeTransectMasksSubtask(AnalysisTask): """ An analysis tasks for computing cell masks for transects defined by geojson features @@ -87,7 +87,7 @@ class ComputeTransectMasksSubtask(AnalysisTask): # {{{ # Xylar Asay-Davis def __init__(self, parentTask, transectGroup, subprocessCount=None): - # {{{ + """ Construct the analysis task and adds it as a subtask of the ``parentTask``. @@ -137,7 +137,6 @@ def __init__(self, parentTask, transectGroup, subprocessCount=None): self.geojsonFileName = \ get_region_mask(self.config, '{}.geojson'.format(self.outFileSuffix)) - # }}} def make_transect_mask(self): """ @@ -172,7 +171,7 @@ def expand_transect_names(self, transectNames): transectNames = get_feature_list(self.geojsonFileName) return transectNames - def setup_and_check(self): # {{{ + def setup_and_check(self): """ Perform steps to set up the analysis and check for errors in the setup. @@ -223,9 +222,8 @@ def setup_and_check(self): # {{{ if os.path.exists(self.maskFileName): # nothing to do so don't block a bunch of other processes self.subprocessCount = 1 - # }}} - def run_task(self): # {{{ + def run_task(self): """ Compute the requested climatologies """ @@ -244,6 +242,3 @@ def run_task(self): # {{{ logger=self.logger, processCount=self.subprocessCount, dir=self.maskSubdirectory) - # }}} - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/test/test_analysis_task.py b/mpas_analysis/test/test_analysis_task.py index 33bbf8b44..098d64870 100644 --- a/mpas_analysis/test/test_analysis_task.py +++ b/mpas_analysis/test/test_analysis_task.py @@ -165,5 +165,3 @@ def doTest(generate, expectedResults): expectedResults['timeSeriesOHC'] = False doTest("['all', 'no_timeSeriesOHC']", expectedResults) - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/test/test_climatology.py b/mpas_analysis/test/test_climatology.py index b9a9e12cc..4034b018e 100644 --- a/mpas_analysis/test/test_climatology.py +++ b/mpas_analysis/test/test_climatology.py @@ -255,5 +255,3 @@ def test_compute_monthly_climatology(self): self.assertArrayApproxEqual(monthlyClimatology.month.values, refClimatology.month.values) - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/test/test_generalized_reader.py b/mpas_analysis/test/test_generalized_reader.py index 99c3953dc..f64a6c307 100644 --- a/mpas_analysis/test/test_generalized_reader.py +++ b/mpas_analysis/test/test_generalized_reader.py @@ -130,5 +130,3 @@ def test_start_end(self): startDate='0005-02-01', endDate='0005-03-01') self.assertEqual(len(ds.Time), 1) - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/test/test_io_utility.py b/mpas_analysis/test/test_io_utility.py index 9628864c1..e5ea78727 100644 --- a/mpas_analysis/test/test_io_utility.py +++ b/mpas_analysis/test/test_io_utility.py @@ -29,5 +29,3 @@ def test_paths(self): ['0.txt', '1.txt', '2.txt', 'a.txt', 'b.txt', 'c.txt']) - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/test/test_mpas_xarray.py b/mpas_analysis/test/test_mpas_xarray.py index 908fcb29c..07f671d9f 100644 --- a/mpas_analysis/test/test_mpas_xarray.py +++ b/mpas_analysis/test/test_mpas_xarray.py @@ -189,5 +189,3 @@ def test_remove_repeated_time_index(self): # There would be 3 time indices if repeat indices had not been removed. # Make sure there are 2. self.assertEqual(len(ds.Time.values), 2) - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/test/test_namelist_streams_interface.py b/mpas_analysis/test/test_namelist_streams_interface.py index 1bbc5147a..890240cdd 100644 --- a/mpas_analysis/test/test_namelist_streams_interface.py +++ b/mpas_analysis/test/test_namelist_streams_interface.py @@ -114,5 +114,3 @@ def test_read_streamsfile(self): calendar='gregorian_noleap') expectedFiles = ['{}/mesh.nc'.format(self.sf.streamsdir)] self.assertEqual(files, expectedFiles) - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/test/test_open_mpas_dataset.py b/mpas_analysis/test/test_open_mpas_dataset.py index 7ebd437c3..881cb93f3 100644 --- a/mpas_analysis/test/test_open_mpas_dataset.py +++ b/mpas_analysis/test/test_open_mpas_dataset.py @@ -82,5 +82,3 @@ def test_open_process_climatology(self): calendar=calendar, timeVariableNames=['xtime_startMonthly', 'xtime_endMonthly'], variableList=['timeMonthly_avg_tThreshMLD']) - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python diff --git a/mpas_analysis/test/test_remap_obs_clim_subtask.py b/mpas_analysis/test/test_remap_obs_clim_subtask.py index f0b2a102a..c37617503 100644 --- a/mpas_analysis/test/test_remap_obs_clim_subtask.py +++ b/mpas_analysis/test/test_remap_obs_clim_subtask.py @@ -30,15 +30,16 @@ make_directories -class RemapObservedMLDClimatology(RemapObservedClimatologySubtask): # {{{ +class RemapObservedMLDClimatology(RemapObservedClimatologySubtask): """ A subtask for reading and remapping MLD observations """ + # Authors # ------- # Xylar Asay-Davis - def get_observation_descriptor(self, fileName): # {{{ + def get_observation_descriptor(self, fileName): ''' get a MeshDescriptor for the observation grid @@ -61,9 +62,9 @@ def get_observation_descriptor(self, fileName): # {{{ obsDescriptor = LatLonGridDescriptor.read(fileName=fileName, latVarName='lat', lonVarName='lon') - return obsDescriptor # }}} + return obsDescriptor - def build_observational_dataset(self, fileName): # {{{ + def build_observational_dataset(self, fileName): ''' read in the data sets for observations, and possibly rename some variables and dimensions @@ -88,9 +89,7 @@ def build_observational_dataset(self, fileName): # {{{ dsObs.coords['month'] = dsObs['month'] dsObs.coords['year'] = dsObs['year'] - return dsObs # }}} - - # }}} + return dsObs @pytest.mark.usefixtures("loaddatadir") @@ -143,7 +142,7 @@ def test_subtask_run_analysis(self): fileName = remapSubtask.get_file_name( season=season, stage=stage, comparisonGridName=comparisonGridName) - assert(os.path.exists(fileName)) + assert (os.path.exists(fileName)) def test_subtask_get_file_name(self): remapSubtask = self.setup_subtask() @@ -151,7 +150,7 @@ def test_subtask_get_file_name(self): for comparisonGridName in ['latlon', 'antarctic', None]: fileName = remapSubtask.get_file_name( stage='original', comparisonGridName=comparisonGridName) - assert(fileName == '{}/clim/obs/mld_4.0x4.0degree.nc'.format( + assert (fileName == '{}/clim/obs/mld_4.0x4.0degree.nc'.format( str(self.test_dir))) stage = 'climatology' @@ -159,17 +158,17 @@ def test_subtask_get_file_name(self): fileName = remapSubtask.get_file_name(stage=stage, season='JFM', comparisonGridName='latlon') - assert(fileName == '{}/clim/obs/mld_4.0x4.0degree_JFM.nc'.format( + assert (fileName == '{}/clim/obs/mld_4.0x4.0degree_JFM.nc'.format( str(self.test_dir))) stage = 'remapped' fileName = remapSubtask.get_file_name(stage=stage, season='JFM', comparisonGridName='latlon') - assert(fileName == '{}/clim/obs/remapped/mld_4.0x4.0degree_to_' - '0.5x0.5degree_JFM.nc'.format(str(self.test_dir))) + assert (fileName == '{}/clim/obs/remapped/mld_4.0x4.0degree_to_' + '0.5x0.5degree_JFM.nc'.format(str(self.test_dir))) fileName = remapSubtask.get_file_name(stage=stage, season='JFM', comparisonGridName='antarctic') - assert(fileName == '{}/clim/obs/remapped/mld_4.0x4.0degree_to_' - '6000.0x6000.0km_10.0km_Antarctic_stereo_JFM.nc'.format( - str(self.test_dir))) + assert (fileName == '{}/clim/obs/remapped/mld_4.0x4.0degree_to_' + '6000.0x6000.0km_10.0km_Antarctic_stereo_JFM.nc'.format( + str(self.test_dir))) diff --git a/mpas_analysis/test/test_timekeeping.py b/mpas_analysis/test/test_timekeeping.py index 5cb442568..129b39aa7 100644 --- a/mpas_analysis/test/test_timekeeping.py +++ b/mpas_analysis/test/test_timekeeping.py @@ -293,5 +293,3 @@ def test_date_to_days(self): calendar=calendar, referenceDate=referenceDate) self.assertApproxEqual(days, expected_days) - -# vim: foldmethod=marker ai ts=4 sts=4 et sw=4 ft=python From a5ce59adf4a84e66618341ad7bfd8590561b23bc Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Wed, 20 Apr 2022 21:35:50 +0200 Subject: [PATCH 23/40] Fix dostring triple quotes --- mpas_analysis/__main__.py | 4 +- mpas_analysis/analysis_task_template.py | 24 +++++----- mpas_analysis/ocean/climatology_map_argo.py | 16 +++---- mpas_analysis/ocean/climatology_map_bgc.py | 12 ++--- mpas_analysis/ocean/climatology_map_eke.py | 8 ++-- mpas_analysis/ocean/climatology_map_mld.py | 12 ++--- .../ocean/climatology_map_mld_min_max.py | 8 ++-- .../ocean/climatology_map_ohc_anomaly.py | 12 ++--- .../ocean/climatology_map_schmidtko.py | 16 +++---- mpas_analysis/ocean/climatology_map_sose.py | 4 +- mpas_analysis/ocean/climatology_map_ssh.py | 8 ++-- mpas_analysis/ocean/climatology_map_sss.py | 8 ++-- mpas_analysis/ocean/climatology_map_sst.py | 8 ++-- mpas_analysis/ocean/climatology_map_woa.py | 16 +++---- mpas_analysis/ocean/geojson_transects.py | 8 ++-- mpas_analysis/ocean/index_nino34.py | 24 +++++----- .../ocean/meridional_heat_transport.py | 12 ++--- .../ocean/plot_climatology_map_subtask.py | 4 +- mpas_analysis/ocean/plot_transect_subtask.py | 8 ++-- .../ocean/remap_depth_slices_subtask.py | 4 +- mpas_analysis/ocean/remap_sose_climatology.py | 16 +++---- mpas_analysis/ocean/sose_transects.py | 20 ++++----- .../ocean/time_series_ohc_anomaly.py | 4 +- mpas_analysis/ocean/woce_transects.py | 4 +- .../sea_ice/climatology_map_sea_ice_conc.py | 8 ++-- .../sea_ice/climatology_map_sea_ice_thick.py | 8 ++-- .../sea_ice/plot_climatology_map_subtask.py | 4 +- mpas_analysis/sea_ice/time_series.py | 4 +- mpas_analysis/shared/analysis_task.py | 44 +++++++++---------- .../shared/climatology/climatology.py | 28 ++++++------ .../climatology/mpas_climatology_task.py | 40 ++++++++--------- .../ref_year_mpas_climatology_task.py | 8 ++-- .../remap_mpas_climatology_subtask.py | 24 +++++----- .../remap_observed_climatology_subtask.py | 12 ++--- mpas_analysis/shared/interpolation/utility.py | 4 +- mpas_analysis/shared/io/download.py | 8 ++-- mpas_analysis/shared/io/write_netcdf.py | 4 +- mpas_analysis/shared/plot/colormap.py | 16 +++---- mpas_analysis/shared/plot/ticks.py | 4 +- mpas_analysis/shared/time_series/anomaly.py | 4 +- .../shared/time_series/moving_average.py | 4 +- .../time_series/mpas_time_series_task.py | 24 +++++----- .../shared/time_series/time_series.py | 8 ++-- mpas_analysis/test/__init__.py | 4 +- .../test/test_remap_obs_clim_subtask.py | 8 ++-- 45 files changed, 264 insertions(+), 264 deletions(-) diff --git a/mpas_analysis/__main__.py b/mpas_analysis/__main__.py index 9f6606769..9aba67efe 100755 --- a/mpas_analysis/__main__.py +++ b/mpas_analysis/__main__.py @@ -684,11 +684,11 @@ def purge_output(config): def symlink_main_run(config): - ''' + """ Create symlinks to the climatology and time-series directories for the main run that has already been computed so we don't have to recompute the analysis. - ''' + """ def link_dir(section, option): destDirectory = build_config_full_path(config=config, section='output', diff --git a/mpas_analysis/analysis_task_template.py b/mpas_analysis/analysis_task_template.py index 157865de7..49add4ffe 100644 --- a/mpas_analysis/analysis_task_template.py +++ b/mpas_analysis/analysis_task_template.py @@ -8,7 +8,7 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -''' +""" This is an example analysis task to be used as a template for new tasks. It should be copied into one of the component folders (`ocean`, `sea_ice`, `land_ice`, etc.) and modified as needed. @@ -38,7 +38,7 @@ to be generated and is set up properly. Don't forget to remove this docstring. (It's not needed.) -''' +""" # Authors # ------- # Xylar Asay-Davis @@ -64,10 +64,10 @@ # can be helpful in initializing, checking whether to perform analysis and # performing the analysis. See AnalysisTask in shared/analysis_task.py class MyTask(AnalysisTask): - ''' + """ - ''' + """ # Authors # ------- @@ -97,7 +97,7 @@ class MyTask(AnalysisTask): # and yu would then make a new task something like this: # myTask = MyTask(config, fieldName='seaIceArea') def __init__(self, config, prerequsiteTask, myArg='myDefaultValue'): - ''' + """ Construct the analysis task. @@ -114,7 +114,7 @@ def __init__(self, config, prerequsiteTask, myArg='myDefaultValue'): myArg : str, optional - ''' + """ # Authors # ------- # @@ -192,13 +192,13 @@ def __init__(self, config, prerequsiteTask, myArg='myDefaultValue'): # output files exist, etc. If there is a problem, an exception should be # raised (see the example below) so the task will not be run. def setup_and_check(self): - ''' + """ Perform steps to set up the analysis and check for errors in the setup. Raises ------ ValueError: - ''' + """ # Authors # ------- # @@ -309,9 +309,9 @@ def setup_and_check(self): self.filePrefixes[plotParameter] = filePrefix def run_task(self): - ''' + """ The main method of the task that performs the analysis task. - ''' + """ # Authors # ------- # @@ -336,7 +336,7 @@ def run_task(self): # 'save' arguments as member variables of `self` and then get them back # (like `self.myArg` here). def _make_plot(self, plotParameter, optionalArgument=None): - ''' + """ Make a simple plot Parameters @@ -348,7 +348,7 @@ def _make_plot(self, plotParameter, optionalArgument=None): An optional argument - ''' + """ # perform the task # self.myArg is a copy of the argument we passed in to __init__ when we diff --git a/mpas_analysis/ocean/climatology_map_argo.py b/mpas_analysis/ocean/climatology_map_argo.py index ee8f1f61e..692ae75f5 100644 --- a/mpas_analysis/ocean/climatology_map_argo.py +++ b/mpas_analysis/ocean/climatology_map_argo.py @@ -8,9 +8,9 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -''' +""" Analysis tasks for comparing Global climatology maps against Argo data. -''' +""" # Authors # ------- # Luke Van Roekel @@ -325,7 +325,7 @@ def __init__(self, parentTask, seasons, fileName, outFilePrefix, comparisonGridNames=['latlon'], subtaskName='remapObservations'): - ''' + """ Construct one analysis subtask for each plot (i.e. each season and comparison grid) and a subtask for computing climatologies. @@ -357,7 +357,7 @@ def __init__(self, parentTask, seasons, fileName, outFilePrefix, subtaskName : str, optional The name of the subtask - ''' + """ # Authors # ------- # Xylar Asay-Davis, Luke Van Roekel @@ -372,7 +372,7 @@ def __init__(self, parentTask, seasons, fileName, outFilePrefix, comparisonGridNames, subtaskName) def get_observation_descriptor(self, fileName): - ''' + """ get a MeshDescriptor for the observation grid Parameters @@ -384,7 +384,7 @@ def get_observation_descriptor(self, fileName): ------- obsDescriptor : ``MeshDescriptor`` The descriptor for the observation grid - ''' + """ # Authors # ------- # Xylar Asay-Davis, Luke Van Roekel @@ -401,7 +401,7 @@ def get_observation_descriptor(self, fileName): return obsDescriptor def build_observational_dataset(self, fileName): - ''' + """ read in the data sets for observations, and possibly rename some variables and dimensions @@ -414,7 +414,7 @@ def build_observational_dataset(self, fileName): ------- dsObs : ``xarray.Dataset`` The observational dataset - ''' + """ # Authors # ------- # Xylar Asay-Davis, Luke Van Roekel diff --git a/mpas_analysis/ocean/climatology_map_bgc.py b/mpas_analysis/ocean/climatology_map_bgc.py index 597e3e138..e7b389f16 100644 --- a/mpas_analysis/ocean/climatology_map_bgc.py +++ b/mpas_analysis/ocean/climatology_map_bgc.py @@ -207,9 +207,9 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): self.add_subtask(subtask) def setup_and_check(self): - ''' + """ Check if preindustrial flag is turned on or off. - ''' + """ # Authors # ------- # Riley X. Brady @@ -326,7 +326,7 @@ class RemapObservedBGCClimatology(RemapObservedClimatologySubtask): # Riley X. Brady def get_observation_descriptor(self, fileName): - ''' + """ get a MeshDescriptor for the observation grid Parameters @@ -338,7 +338,7 @@ def get_observation_descriptor(self, fileName): ------- obsDescriptor : ``MeshDescriptor`` The descriptor for the observation grid - ''' + """ # Authors # ------- # Riley X. Brady, Xylar Asay-Davis @@ -352,7 +352,7 @@ def get_observation_descriptor(self, fileName): return obsDescriptor def build_observational_dataset(self, fileName): - ''' + """ read in the data sets for observations, and possibly rename some variables and dimensions @@ -365,7 +365,7 @@ def build_observational_dataset(self, fileName): ------ dsObs : ``xarray.Dataset`` The observational dataset - ''' + """ # Authors # ------- # Riley X. Brady, Xylar Asay-Davis diff --git a/mpas_analysis/ocean/climatology_map_eke.py b/mpas_analysis/ocean/climatology_map_eke.py index 6ddd6704c..2c891e575 100644 --- a/mpas_analysis/ocean/climatology_map_eke.py +++ b/mpas_analysis/ocean/climatology_map_eke.py @@ -221,7 +221,7 @@ class RemapObservedEKEClimatology(RemapObservedClimatologySubtask): # Kevin Rosa def get_observation_descriptor(self, fileName): - ''' + """ get a MeshDescriptor for the observation grid Parameters @@ -233,7 +233,7 @@ def get_observation_descriptor(self, fileName): ------- obsDescriptor : ``MeshDescriptor`` The descriptor for the observation grid - ''' + """ # Authors # ------- # Kevin Rosa @@ -247,7 +247,7 @@ def get_observation_descriptor(self, fileName): return obsDescriptor def build_observational_dataset(self, fileName): - ''' + """ read in the data sets for observations, and possibly rename some variables and dimensions @@ -260,7 +260,7 @@ def build_observational_dataset(self, fileName): ------- dsObs : ``xarray.Dataset`` The observational dataset - ''' + """ # Authors # ------- # Kevin Rosa, Xylar Asay-Davis diff --git a/mpas_analysis/ocean/climatology_map_mld.py b/mpas_analysis/ocean/climatology_map_mld.py index d7ed3c206..aa23f746b 100644 --- a/mpas_analysis/ocean/climatology_map_mld.py +++ b/mpas_analysis/ocean/climatology_map_mld.py @@ -144,9 +144,9 @@ def __init__(self, config, mpasClimatologyTask, self.add_subtask(subtask) def setup_and_check(self): - ''' + """ Check if MLD capability was turned on in the run. - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -172,7 +172,7 @@ class RemapObservedMLDClimatology(RemapObservedClimatologySubtask): # Luke Van Roekel, Xylar Asay-Davis, Milena Veneziani def get_observation_descriptor(self, fileName): - ''' + """ get a MeshDescriptor for the observation grid Parameters @@ -184,7 +184,7 @@ def get_observation_descriptor(self, fileName): ------- obsDescriptor : ``MeshDescriptor`` The descriptor for the observation grid - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -201,7 +201,7 @@ def get_observation_descriptor(self, fileName): return obsDescriptor def build_observational_dataset(self, fileName): - ''' + """ read in the data sets for observations, and possibly rename some variables and dimensions @@ -214,7 +214,7 @@ def build_observational_dataset(self, fileName): ------- dsObs : ``xarray.Dataset`` The observational dataset - ''' + """ # Authors # ------- # Xylar Asay-Davis diff --git a/mpas_analysis/ocean/climatology_map_mld_min_max.py b/mpas_analysis/ocean/climatology_map_mld_min_max.py index d2bc21290..7175a8e73 100644 --- a/mpas_analysis/ocean/climatology_map_mld_min_max.py +++ b/mpas_analysis/ocean/climatology_map_mld_min_max.py @@ -71,9 +71,9 @@ def __init__(self, config, mpasClimatologyTasks, controlConfig=None): sectionPrefix='climatologyMapBLD') def setup_and_check(self): - ''' + """ Check if MLD capability was turned on in the run. - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -98,9 +98,9 @@ def setup_and_check(self): def _add_tasks(self, config, mpasClimatologyTasks, controlConfig, title, mpasVariableSuffix, filePrefix, sectionPrefix): - ''' + """ Add tasks for a given variable - ''' + """ iselValues = None # read in what seasons we want to plot diff --git a/mpas_analysis/ocean/climatology_map_ohc_anomaly.py b/mpas_analysis/ocean/climatology_map_ohc_anomaly.py index 0e1fe8a35..2ebe2870b 100644 --- a/mpas_analysis/ocean/climatology_map_ohc_anomaly.py +++ b/mpas_analysis/ocean/climatology_map_ohc_anomaly.py @@ -158,14 +158,14 @@ def __init__(self, config, mpasClimatologyTask, refYearClimatolgyTask, self.add_subtask(subtask) def setup_and_check(self): - ''' + """ Checks whether analysis is being performed only on the reference year, in which case the analysis will not be meaningful. Raises ------ ValueError: if attempting to analyze only the reference year - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -204,7 +204,7 @@ def __init__(self, mpasClimatologyTask, refYearClimatolgyTask, parentTask, climatologyName, variableList, seasons, comparisonGridNames, minDepth, maxDepth): - ''' + """ Construct the analysis task and adds it as a subtask of the ``parentTask``. @@ -241,7 +241,7 @@ def __init__(self, mpasClimatologyTask, refYearClimatolgyTask, parentTask, minDepth, maxDepth : float The minimum and maximum depths for integration - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -261,7 +261,7 @@ def __init__(self, mpasClimatologyTask, refYearClimatolgyTask, parentTask, self.maxDepth = maxDepth def setup_and_check(self): - ''' + """ Perform steps to set up the analysis and check for errors in the setup. Raises @@ -270,7 +270,7 @@ def setup_and_check(self): If a restart file is not available from which to read mesh information or if no history files are available from which to compute the climatology in the desired time range. - ''' + """ # Authors # ------- # Xylar Asay-Davis diff --git a/mpas_analysis/ocean/climatology_map_schmidtko.py b/mpas_analysis/ocean/climatology_map_schmidtko.py index ad7369027..7e70ab2c6 100644 --- a/mpas_analysis/ocean/climatology_map_schmidtko.py +++ b/mpas_analysis/ocean/climatology_map_schmidtko.py @@ -8,10 +8,10 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -''' +""" Analysis tasks for comparing climatology maps of Antarctic seafloor fields against observations from Schmidtko et al. (2014, DOI: 10.1126/science.1256117) -''' +""" # Authors # ------- # Xylar Asay-Davis @@ -197,7 +197,7 @@ def __init__(self, parentTask, seasons, fileName, outFilePrefix, fieldName, comparisonGridNames=['latlon'], subtaskName='remapObservations'): - ''' + """ Construct one analysis subtask for each plot (i.e. each season and comparison grid) and a subtask for computing climatologies. @@ -225,7 +225,7 @@ def __init__(self, parentTask, seasons, fileName, outFilePrefix, subtaskName : str, optional The name of the subtask - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -239,7 +239,7 @@ def __init__(self, parentTask, seasons, fileName, outFilePrefix, comparisonGridNames, subtaskName) def get_observation_descriptor(self, fileName): - ''' + """ get a MeshDescriptor for the observation grid Parameters @@ -251,7 +251,7 @@ def get_observation_descriptor(self, fileName): ------- obsDescriptor : ``MeshDescriptor`` The descriptor for the observation grid - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -264,7 +264,7 @@ def get_observation_descriptor(self, fileName): return obsDescriptor def build_observational_dataset(self, fileName): - ''' + """ read in the data sets for observations, and possibly rename some variables and dimensions @@ -277,7 +277,7 @@ def build_observational_dataset(self, fileName): ------- dsObs : ``xarray.Dataset`` The observational dataset - ''' + """ # Authors # ------- # Xylar Asay-Davis diff --git a/mpas_analysis/ocean/climatology_map_sose.py b/mpas_analysis/ocean/climatology_map_sose.py index cb7f22c17..79a372a40 100644 --- a/mpas_analysis/ocean/climatology_map_sose.py +++ b/mpas_analysis/ocean/climatology_map_sose.py @@ -8,10 +8,10 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -''' +""" Analysis tasks for comparing Antarctic climatology maps against observations and reanalysis data. -''' +""" # Authors # ------- # Xylar Asay-Davis diff --git a/mpas_analysis/ocean/climatology_map_ssh.py b/mpas_analysis/ocean/climatology_map_ssh.py index 4948f40c0..2f901d19a 100644 --- a/mpas_analysis/ocean/climatology_map_ssh.py +++ b/mpas_analysis/ocean/climatology_map_ssh.py @@ -195,7 +195,7 @@ class RemapObservedSSHClimatology(RemapObservedClimatologySubtask): # Xylar Asay-Davis def get_observation_descriptor(self, fileName): - ''' + """ get a MeshDescriptor for the observation grid Parameters @@ -207,7 +207,7 @@ def get_observation_descriptor(self, fileName): ------- obsDescriptor : ``MeshDescriptor`` The descriptor for the observation grid - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -220,7 +220,7 @@ def get_observation_descriptor(self, fileName): return obsDescriptor def build_observational_dataset(self, fileName): - ''' + """ read in the data sets for observations, and possibly rename some variables and dimensions @@ -233,7 +233,7 @@ def build_observational_dataset(self, fileName): ------- dsObs : ``xarray.Dataset`` The observational dataset - ''' + """ # Authors # ------- # Xylar Asay-Davis diff --git a/mpas_analysis/ocean/climatology_map_sss.py b/mpas_analysis/ocean/climatology_map_sss.py index cec650391..cda8b7d15 100644 --- a/mpas_analysis/ocean/climatology_map_sss.py +++ b/mpas_analysis/ocean/climatology_map_sss.py @@ -154,7 +154,7 @@ class RemapObservedSSSClimatology(RemapObservedClimatologySubtask): # Luke Van Roekel, Xylar Asay-Davis, Milena Veneziani def get_observation_descriptor(self, fileName): - ''' + """ get a MeshDescriptor for the observation grid Parameters @@ -166,7 +166,7 @@ def get_observation_descriptor(self, fileName): ------- obsDescriptor : ``MeshDescriptor`` The descriptor for the observation grid - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -179,7 +179,7 @@ def get_observation_descriptor(self, fileName): return obsDescriptor def build_observational_dataset(self, fileName): - ''' + """ read in the data sets for observations, and possibly rename some variables and dimensions @@ -192,7 +192,7 @@ def build_observational_dataset(self, fileName): ------- dsObs : ``xarray.Dataset`` The observational dataset - ''' + """ # Authors # ------- # Xylar Asay-Davis diff --git a/mpas_analysis/ocean/climatology_map_sst.py b/mpas_analysis/ocean/climatology_map_sst.py index 039f55c8b..a28f0faac 100644 --- a/mpas_analysis/ocean/climatology_map_sst.py +++ b/mpas_analysis/ocean/climatology_map_sst.py @@ -163,7 +163,7 @@ class RemapObservedSSTClimatology(RemapObservedClimatologySubtask): # Luke Van Roekel, Xylar Asay-Davis, Milena Veneziani def get_observation_descriptor(self, fileName): - ''' + """ get a MeshDescriptor for the observation grid Parameters @@ -175,7 +175,7 @@ def get_observation_descriptor(self, fileName): ------- obsDescriptor : ``MeshDescriptor`` The descriptor for the observation grid - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -188,7 +188,7 @@ def get_observation_descriptor(self, fileName): return obsDescriptor def build_observational_dataset(self, fileName): - ''' + """ read in the data sets for observations, and possibly rename some variables and dimensions @@ -201,7 +201,7 @@ def build_observational_dataset(self, fileName): ------- dsObs : ``xarray.Dataset`` The observational dataset - ''' + """ # Authors # ------- # Xylar Asay-Davis diff --git a/mpas_analysis/ocean/climatology_map_woa.py b/mpas_analysis/ocean/climatology_map_woa.py index ca14c9895..83e59cbde 100644 --- a/mpas_analysis/ocean/climatology_map_woa.py +++ b/mpas_analysis/ocean/climatology_map_woa.py @@ -8,10 +8,10 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -''' +""" Analysis tasks for comparing Polar (and global) climatology maps against WOA18 climatological data. -''' +""" # Authors # ------- # Milena Veneziani @@ -270,7 +270,7 @@ def __init__(self, parentTask, seasons, fileName, outFilePrefix, comparisonGridNames=['latlon'], subtaskName='remapObservations'): - ''' + """ An analysis task for remapping WOA fields (either annual or monthly mean) to the comparison grid(s), depths and seasons provided @@ -303,7 +303,7 @@ def __init__(self, parentTask, seasons, fileName, outFilePrefix, subtaskName : str, optional The name of the subtask - ''' + """ # Authors # ------- # Xylar Asay-Davis, Milena Veneziani @@ -318,7 +318,7 @@ def __init__(self, parentTask, seasons, fileName, outFilePrefix, comparisonGridNames, subtaskName) def get_observation_descriptor(self, fileName): - ''' + """ get a MeshDescriptor for the observation grid Parameters @@ -330,7 +330,7 @@ def get_observation_descriptor(self, fileName): ------- obsDescriptor : ``MeshDescriptor`` The descriptor for the observation grid - ''' + """ # Authors # ------- # Xylar Asay-Davis, Milena Veneziani @@ -347,7 +347,7 @@ def get_observation_descriptor(self, fileName): return obsDescriptor def build_observational_dataset(self, fileName): - ''' + """ read in the data sets for observations, and possibly rename some variables and dimensions @@ -360,7 +360,7 @@ def build_observational_dataset(self, fileName): ------- dsObs : ``xarray.Dataset`` The observational dataset - ''' + """ # Authors # ------- # Xylar Asay-Davis, Milena Veneziani diff --git a/mpas_analysis/ocean/geojson_transects.py b/mpas_analysis/ocean/geojson_transects.py index c753090ba..a38819e18 100644 --- a/mpas_analysis/ocean/geojson_transects.py +++ b/mpas_analysis/ocean/geojson_transects.py @@ -29,7 +29,7 @@ class GeojsonTransects(AnalysisTask): # Xylar Asay-Davis def __init__(self, config, mpasClimatologyTask, controlConfig=None): - ''' + """ Construct the analysis task and adds it as a subtask of the ``parentTask``. @@ -44,7 +44,7 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -181,7 +181,7 @@ class GeojsonTransectsObservations(TransectsObservations): # Xylar Asay-Davis def build_observational_dataset(self, fileName, transectName): - ''' + """ read in the data sets for observations, and possibly rename some variables and dimensions @@ -197,7 +197,7 @@ def build_observational_dataset(self, fileName, transectName): ------- dsObs : ``xarray.Dataset`` The observational dataset - ''' + """ # Authors # ------- # Xylar Asay-Davis diff --git a/mpas_analysis/ocean/index_nino34.py b/mpas_analysis/ocean/index_nino34.py index 0a823e928..42ee2f910 100644 --- a/mpas_analysis/ocean/index_nino34.py +++ b/mpas_analysis/ocean/index_nino34.py @@ -39,7 +39,7 @@ class IndexNino34(AnalysisTask): - ''' + """ A task for computing and plotting time series and spectra of the El Nino 3.4 climate index @@ -51,14 +51,14 @@ class IndexNino34(AnalysisTask): controlconfig : mpas_tools.config.MpasConfigParser Configuration options for a control run (if any) - ''' + """ # Authors # ------- # Luke Van Roekel, Xylar Asay-Davis def __init__(self, config, mpasTimeSeriesTask, controlConfig=None): - ''' + """ Construct the analysis task. Parameters @@ -71,7 +71,7 @@ def __init__(self, config, mpasTimeSeriesTask, controlConfig=None): controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -89,9 +89,9 @@ def __init__(self, config, mpasTimeSeriesTask, controlConfig=None): self.run_after(mpasTimeSeriesTask) def setup_and_check(self): - ''' + """ Perform steps to set up the analysis and check for errors in the setup. - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -140,10 +140,10 @@ def setup_and_check(self): filePrefix)) def run_task(self): - ''' + """ Computes NINO34 index and plots the time series and power spectrum with 95 and 99% confidence bounds - ''' + """ # Authors # ------- # Luke Van Roekel, Xylar Asay-Davis @@ -683,7 +683,7 @@ def _nino34_timeseries_plot(self, nino34s, title, panelTitles, outFileName, def _plot_nino_timeseries(self, ninoIndex, time, xlabel, ylabel, panelTitle, title_font, axis_font, lineWidth): - ''' + """ Plot the nino time series on a subplot Parameters @@ -705,7 +705,7 @@ def _plot_nino_timeseries(self, ninoIndex, time, xlabel, ylabel, lineWidth : list of str control line width - ''' + """ # Authors # ------- # Luke Van Roekel, Xylar Asay-Davis @@ -745,7 +745,7 @@ def _write_xml(self, filePrefix, plotType, ninoIndexNumber): imageCaption=caption) def _plot_size_y_axis(self, x, ys, xmin, xmax): - ''' + """ Get the maximum y value over the given range of x values Parameters @@ -761,7 +761,7 @@ def _plot_size_y_axis(self, x, ys, xmin, xmax): xmax : float, optional The maximum x values - ''' + """ # Authors # ------- # Luke Van Roekel, Xylar Asay-Davis diff --git a/mpas_analysis/ocean/meridional_heat_transport.py b/mpas_analysis/ocean/meridional_heat_transport.py index 0db4d9b52..47f2dc422 100644 --- a/mpas_analysis/ocean/meridional_heat_transport.py +++ b/mpas_analysis/ocean/meridional_heat_transport.py @@ -25,7 +25,7 @@ class MeridionalHeatTransport(AnalysisTask): - ''' + """ Plot meridional heat transport from the analysis member output. Attributes @@ -36,14 +36,14 @@ class MeridionalHeatTransport(AnalysisTask): controlconfig : mpas_tools.config.MpasConfigParser Configuration options for a control run (if any) - ''' + """ # Authors # ------- # Mark Petersen, Milena Veneziani, Xylar Asay-Davis def __init__(self, config, mpasClimatologyTask, controlConfig=None): - ''' + """ Construct the analysis task. Parameters @@ -56,7 +56,7 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -74,9 +74,9 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): self.controlConfig = controlConfig def setup_and_check(self): - ''' + """ Perform steps to set up the analysis and check for errors in the setup. - ''' + """ # Authors # ------- # Mark Petersen, Milena Veneziani, Xylar Asay-Davis diff --git a/mpas_analysis/ocean/plot_climatology_map_subtask.py b/mpas_analysis/ocean/plot_climatology_map_subtask.py index 6e905471d..618662f8c 100644 --- a/mpas_analysis/ocean/plot_climatology_map_subtask.py +++ b/mpas_analysis/ocean/plot_climatology_map_subtask.py @@ -113,7 +113,7 @@ def __init__(self, parentTask, season, comparisonGridName, remapMpasClimatologySubtask, remapObsClimatologySubtask=None, secondRemapMpasClimatologySubtask=None, controlConfig=None, depth=None, removeMean=False, subtaskName=None): - ''' + """ Construct one analysis subtask for each plot (i.e. each season and comparison grid) and a subtask for computing climatologies. @@ -159,7 +159,7 @@ def __init__(self, parentTask, season, comparisonGridName, The name of the subtask. If not specified, it is ``plot_`` with a suffix indicating the depth being sliced (if any) - ''' + """ # Authors # ------- # Xylar Asay-Davis diff --git a/mpas_analysis/ocean/plot_transect_subtask.py b/mpas_analysis/ocean/plot_transect_subtask.py index a83950f20..370fdd0ee 100644 --- a/mpas_analysis/ocean/plot_transect_subtask.py +++ b/mpas_analysis/ocean/plot_transect_subtask.py @@ -107,7 +107,7 @@ def __init__(self, parentTask, season, transectName, fieldName, computeTransectsSubtask, plotObs=True, controlConfig=None, horizontalBounds=None): - ''' + """ Construct one analysis subtask for each plot (i.e. each season and comparison grid) and a subtask for computing climatologies. @@ -140,7 +140,7 @@ def __init__(self, parentTask, season, transectName, fieldName, horizontalBounds : [float, float], optional The distance in km of the left- and right-hand edges of the plot, chosen automatically by default or if the list is empty - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -177,7 +177,7 @@ def set_plot_info(self, outFileLabel, fieldNameInTitle, mpasFieldName, galleryName, configSectionName, verticalBounds, diffTitleLabel='Model - Observations'): - ''' + """ Store attributes related to plots, plot file names and HTML output. Parameters @@ -228,7 +228,7 @@ def set_plot_info(self, outFileLabel, fieldNameInTitle, mpasFieldName, diffTitleLabel : str, optional the title of the difference subplot - ''' + """ # Authors # ------- # Xylar Asay-Davis diff --git a/mpas_analysis/ocean/remap_depth_slices_subtask.py b/mpas_analysis/ocean/remap_depth_slices_subtask.py index 93b63d2a6..cec51ae77 100644 --- a/mpas_analysis/ocean/remap_depth_slices_subtask.py +++ b/mpas_analysis/ocean/remap_depth_slices_subtask.py @@ -41,7 +41,7 @@ def __init__(self, mpasClimatologyTask, parentTask, climatologyName, variableList, seasons, depths, comparisonGridNames=['latlon'], iselValues=None): - ''' + """ Construct the analysis task and adds it as a subtask of the ``parentTask``. @@ -78,7 +78,7 @@ def __init__(self, mpasClimatologyTask, parentTask, climatologyName, iselValues : dict, optional A dictionary of dimensions and indices (or ``None``) used to extract a slice of the MPAS field(s). - ''' + """ # Authors # ------- # Xylar Asay-Davis diff --git a/mpas_analysis/ocean/remap_sose_climatology.py b/mpas_analysis/ocean/remap_sose_climatology.py index 6bdbf6b7b..54b7b0734 100644 --- a/mpas_analysis/ocean/remap_sose_climatology.py +++ b/mpas_analysis/ocean/remap_sose_climatology.py @@ -8,10 +8,10 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -''' +""" Analysis tasks for comparing Antarctic climatology maps against observations and reanalysis data. -''' +""" # Authors # ------- # Xylar Asay-Davis @@ -38,7 +38,7 @@ def __init__(self, parentTask, seasons, fileName, outFilePrefix, comparisonGridNames=['latlon'], subtaskName='remapObservations'): - ''' + """ Construct one analysis subtask for each plot (i.e. each season and comparison grid) and a subtask for computing climatologies. @@ -74,7 +74,7 @@ def __init__(self, parentTask, seasons, fileName, outFilePrefix, subtaskName : str, optional The name of the subtask - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -93,7 +93,7 @@ def __init__(self, parentTask, seasons, fileName, outFilePrefix, comparisonGridNames, subtaskName) def get_observation_descriptor(self, fileName): - ''' + """ get a MeshDescriptor for the observation grid Parameters @@ -105,7 +105,7 @@ def get_observation_descriptor(self, fileName): ------- obsDescriptor : ``MeshDescriptor`` The descriptor for the observation grid - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -118,7 +118,7 @@ def get_observation_descriptor(self, fileName): return obsDescriptor def build_observational_dataset(self, fileName): - ''' + """ read in the data sets for observations, and possibly rename some variables and dimensions @@ -131,7 +131,7 @@ def build_observational_dataset(self, fileName): ------- dsObs : ``xarray.Dataset`` The observational dataset - ''' + """ # Authors # ------- # Xylar Asay-Davis diff --git a/mpas_analysis/ocean/sose_transects.py b/mpas_analysis/ocean/sose_transects.py index 31cc89365..7a61872c4 100644 --- a/mpas_analysis/ocean/sose_transects.py +++ b/mpas_analysis/ocean/sose_transects.py @@ -39,7 +39,7 @@ class SoseTransects(AnalysisTask): # Xylar Asay-Davis def __init__(self, config, mpasClimatologyTask, controlConfig=None): - ''' + """ Construct the analysis task and adds it as a subtask of the ``parentTask``. @@ -54,7 +54,7 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -225,7 +225,7 @@ class SoseTransectsObservations(TransectsObservations): def __init__(self, config, horizontalResolution, transectCollectionName, fields): - ''' + """ Construct the object, setting the observations dictionary to None. Parameters @@ -244,7 +244,7 @@ def __init__(self, config, horizontalResolution, fields : list of dict dictionaries defining the fields with associated SOSE data - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -260,14 +260,14 @@ def __init__(self, config, horizontalResolution, self.fields = fields def get_observations(self): - ''' + """ Read in and set up the observations. Returns ------- obsDatasets : OrderedDict The observational dataset - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -280,9 +280,9 @@ def get_observations(self): return super(SoseTransectsObservations, self).get_observations() def combine_observations(self): - ''' + """ Combine SOSE oservations into a single file - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -383,7 +383,7 @@ def combine_observations(self): print(' Done.') def build_observational_dataset(self, fileName, transectName): - ''' + """ read in the data sets for observations, and possibly rename some variables and dimensions @@ -399,7 +399,7 @@ def build_observational_dataset(self, fileName, transectName): ------- dsObs : ``xarray.Dataset`` The observational dataset - ''' + """ # Authors # ------- # Xylar Asay-Davis diff --git a/mpas_analysis/ocean/time_series_ohc_anomaly.py b/mpas_analysis/ocean/time_series_ohc_anomaly.py index db606d2aa..f9f35f807 100644 --- a/mpas_analysis/ocean/time_series_ohc_anomaly.py +++ b/mpas_analysis/ocean/time_series_ohc_anomaly.py @@ -130,9 +130,9 @@ def __init__(self, config, mpasTimeSeriesTask, controlConfig=None): self.add_subtask(plotTask) def _compute_ohc(self, ds): - ''' + """ Compute the OHC time series. - ''' + """ # regionNames = self.config.getexpression('regions', 'regions') # ds['regionNames'] = ('nOceanRegionsTmp', regionNames) diff --git a/mpas_analysis/ocean/woce_transects.py b/mpas_analysis/ocean/woce_transects.py index 55d60f8eb..a59c62d8f 100644 --- a/mpas_analysis/ocean/woce_transects.py +++ b/mpas_analysis/ocean/woce_transects.py @@ -29,7 +29,7 @@ class WoceTransects(AnalysisTask): # Xylar Asay-Davis def __init__(self, config, mpasClimatologyTask, controlConfig=None): - ''' + """ Construct the analysis task and adds it as a subtask of the ``parentTask``. @@ -44,7 +44,7 @@ def __init__(self, config, mpasClimatologyTask, controlConfig=None): controlconfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) - ''' + """ # Authors # ------- # Xylar Asay-Davis diff --git a/mpas_analysis/sea_ice/climatology_map_sea_ice_conc.py b/mpas_analysis/sea_ice/climatology_map_sea_ice_conc.py index 0bc5db793..1cd9785e1 100644 --- a/mpas_analysis/sea_ice/climatology_map_sea_ice_conc.py +++ b/mpas_analysis/sea_ice/climatology_map_sea_ice_conc.py @@ -235,7 +235,7 @@ class RemapObservedConcClimatology(RemapObservedClimatologySubtask): # Xylar Asay-Davis def get_observation_descriptor(self, fileName): - ''' + """ get a MeshDescriptor for the observation grid Parameters @@ -247,7 +247,7 @@ def get_observation_descriptor(self, fileName): ------- obsDescriptor : ``MeshDescriptor`` The descriptor for the observation grid - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -260,7 +260,7 @@ def get_observation_descriptor(self, fileName): return obsDescriptor def build_observational_dataset(self, fileName): - ''' + """ read in the data sets for observations, and possibly rename some variables and dimensions @@ -273,7 +273,7 @@ def build_observational_dataset(self, fileName): ------- dsObs : ``xarray.Dataset`` The observational dataset - ''' + """ # Authors # ------- # Xylar Asay-Davis diff --git a/mpas_analysis/sea_ice/climatology_map_sea_ice_thick.py b/mpas_analysis/sea_ice/climatology_map_sea_ice_thick.py index 03c6bb2f5..93292f90f 100644 --- a/mpas_analysis/sea_ice/climatology_map_sea_ice_thick.py +++ b/mpas_analysis/sea_ice/climatology_map_sea_ice_thick.py @@ -181,7 +181,7 @@ class RemapObservedThickClimatology(RemapObservedClimatologySubtask): # Xylar Asay-Davis def get_observation_descriptor(self, fileName): - ''' + """ get a MeshDescriptor for the observation grid Parameters @@ -193,7 +193,7 @@ def get_observation_descriptor(self, fileName): ------- obsDescriptor : ``MeshDescriptor`` The descriptor for the observation grid - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -206,7 +206,7 @@ def get_observation_descriptor(self, fileName): return obsDescriptor def build_observational_dataset(self, fileName): - ''' + """ read in the data sets for observations, and possibly rename some variables and dimensions @@ -219,7 +219,7 @@ def build_observational_dataset(self, fileName): ------- dsObs : ``xarray.Dataset`` The observational dataset - ''' + """ # Authors # ------- # Xylar Asay-Davis diff --git a/mpas_analysis/sea_ice/plot_climatology_map_subtask.py b/mpas_analysis/sea_ice/plot_climatology_map_subtask.py index 2c987b8ee..f11ebbce9 100644 --- a/mpas_analysis/sea_ice/plot_climatology_map_subtask.py +++ b/mpas_analysis/sea_ice/plot_climatology_map_subtask.py @@ -98,7 +98,7 @@ def __init__(self, parentTask, hemisphere, season, comparisonGridName, remapMpasClimatologySubtask, remapObsClimatologySubtask=None, controlConfig=None, subtaskSuffix=None): - ''' + """ Construct one analysis subtask for each plot (i.e. each season and comparison grid) and a subtask for computing climatologies. @@ -131,7 +131,7 @@ def __init__(self, parentTask, hemisphere, season, comparisonGridName, subtaskSuffix : str, optional A suffix on the subtask to ensure that it is unique (e.g. the observations being plotted) - ''' + """ # Authors # ------- # Xylar Asay-Davis diff --git a/mpas_analysis/sea_ice/time_series.py b/mpas_analysis/sea_ice/time_series.py index 0f7070ba1..4e54dac1a 100644 --- a/mpas_analysis/sea_ice/time_series.py +++ b/mpas_analysis/sea_ice/time_series.py @@ -582,10 +582,10 @@ def _replicate_cycle(self, ds, dsToReplicate, calendar): return dsShift def _compute_area_vol(self): - ''' + """ Compute part of the time series of sea ice volume and area, given time indices to process. - ''' + """ outFileNames = {} for hemisphere in ['NH', 'SH']: diff --git a/mpas_analysis/shared/analysis_task.py b/mpas_analysis/shared/analysis_task.py index 61e760a2d..d103e3aa9 100644 --- a/mpas_analysis/shared/analysis_task.py +++ b/mpas_analysis/shared/analysis_task.py @@ -8,9 +8,9 @@ # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at # https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/master/LICENSE -''' +""" Defines the base class for analysis tasks. -''' +""" # Authors # ------- # Xylar Asay-Davis @@ -27,7 +27,7 @@ class AnalysisTask(Process): - ''' + """ The base class for analysis tasks. Attributes @@ -85,7 +85,7 @@ class AnalysisTask(Process): logger : ``logging.Logger`` A logger for output during the run phase of an analysis task - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -100,7 +100,7 @@ class AnalysisTask(Process): def __init__(self, config, taskName, componentName, tags=[], subtaskName=None): - ''' + """ Construct the analysis task. Individual tasks (children classes of this base class) should first @@ -128,7 +128,7 @@ def __init__(self, config, taskName, componentName, tags=[], subtaskName : str, optional If this is a subtask of ``taskName``, the name of the subtask - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -169,7 +169,7 @@ def __init__(self, config, taskName, componentName, tags=[], self.runDirectly = False def setup_and_check(self): - ''' + """ Perform steps to set up the analysis (e.g. reading namelists and streams files). @@ -184,7 +184,7 @@ def setup_and_check(self): analysis-specific setup. For example, this function could check if necessary observations and other data files are found, then, determine the list of files to be read when the analysis is run. - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -232,10 +232,10 @@ def setup_and_check(self): self.fullTaskName) def run_task(self): - ''' + """ Run the analysis. Each task should override this function to do the work of computing and/or plotting analysis - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -243,7 +243,7 @@ def run_task(self): return def run_after(self, task): - ''' + """ Only run this task after the given task has completed. This allows a task to be constructed of multiple subtasks, some of which may block later tasks, while allowing some subtasks to run in parallel. It also @@ -254,7 +254,7 @@ def run_after(self, task): ---------- task : ``AnalysisTask`` The task that should finish before this one begins - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -263,7 +263,7 @@ def run_after(self, task): self.runAfterTasks.append(task) def add_subtask(self, subtask): - ''' + """ Add a subtask to this tasks. This task always runs after the subtask has finished. However, this task gets set up *before* the subtask, so the setup of the subtask can depend on fields defined during the @@ -273,7 +273,7 @@ def add_subtask(self, subtask): ---------- subtask : ``AnalysisTask`` The subtask to run as part of this task - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -282,7 +282,7 @@ def add_subtask(self, subtask): self.subtasks.append(subtask) def run(self, writeLogFile=True): - ''' + """ Sets up logging and then runs the analysis task. Parameters @@ -292,7 +292,7 @@ def run(self, writeLogFile=True): Otherwise, the internal logger ``self.logger`` points to stdout and no log file is created. The intention is for logging to take place in parallel mode but not in serial mode. - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -346,7 +346,7 @@ def run(self, writeLogFile=True): def check_generate(self): - ''' + """ Determines if this analysis should be generated, based on the ``generate`` config option and ``taskName``, ``componentName`` and ``tags``. @@ -363,7 +363,7 @@ def check_generate(self): ------ ValueError : If one of ``self.taskName``, ``self.componentName`` or ``self.tags`` has not been set. - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -412,7 +412,7 @@ def check_generate(self): def check_analysis_enabled(self, analysisOptionName, default=False, raiseException=True): - ''' + """ Check to make sure a given analysis is turned on, issuing a warning or raising an exception if not. @@ -440,7 +440,7 @@ def check_analysis_enabled(self, analysisOptionName, default=False, If the given analysis option is not found and ``default`` is not ``True`` or if the analysis option is found and is ``False``. The exception is only raised if ``raiseException = True``. - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -466,7 +466,7 @@ def check_analysis_enabled(self, analysisOptionName, default=False, return enabled def set_start_end_date(self, section): - ''' + """ Set the start and end dates in the ``config`` correspond to the start and end years in a given category of analysis @@ -476,7 +476,7 @@ def set_start_end_date(self, section): The name of a section in the config file containing ``startYear`` and ``endYear`` options. ``section`` is typically one of ``climatology``, ``timeSeries`` or ``index`` - ''' + """ # Authors # ------- # Xylar Asay-Davis diff --git a/mpas_analysis/shared/climatology/climatology.py b/mpas_analysis/shared/climatology/climatology.py index 27997587f..7ebb60ebe 100644 --- a/mpas_analysis/shared/climatology/climatology.py +++ b/mpas_analysis/shared/climatology/climatology.py @@ -239,7 +239,7 @@ def compute_climatology(ds, monthValues, calendar=None, def add_years_months_days_in_month(ds, calendar=None): - ''' + """ Add ``year``, ``month`` and ``daysInMonth`` as data arrays in ``ds``. The number of days in each month of ``ds`` is computed either using the ``startTime`` and ``endTime`` if available or assuming ``gregorian_noleap`` @@ -261,7 +261,7 @@ def add_years_months_days_in_month(ds, calendar=None): ds : object of same type as ``ds`` The data set with ``year``, ``month`` and ``daysInMonth`` data arrays added (if not already present) - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -606,10 +606,10 @@ def get_remapped_mpas_climatology_file_name(config, season, componentName, def get_climatology_op_directory(config, op='avg'): - ''' + """ Get the output directory for MPAS climatologies from output with the given monthly operator: avg, min or max - ''' + """ climatologyBaseDirectory = build_config_full_path( config, 'output', 'mpasClimatologySubdirectory') @@ -617,11 +617,11 @@ def get_climatology_op_directory(config, op='avg'): def _compute_masked_mean(ds, maskVaries): - ''' + """ Compute the time average of data set, masked out where the variables in ds are NaN and, if ``maskVaries == True``, weighting by the number of days used to compute each monthly mean time in ds. - ''' + """ # Authors # ------- @@ -661,9 +661,9 @@ def ds_to_weights(ds): def _matches_comparison(obsDescriptor, comparisonDescriptor): - ''' + """ Determine if the two meshes are the same - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -700,10 +700,10 @@ def _matches_comparison(obsDescriptor, comparisonDescriptor): def _setup_climatology_caching(ds, startYearClimo, endYearClimo, yearsPerCacheFile, cachePrefix, monthValues): - ''' + """ Determine which cache files already exist, which are incomplete and which years are present in each cache file (whether existing or to be created). - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -764,9 +764,9 @@ def _setup_climatology_caching(ds, startYearClimo, endYearClimo, def _cache_individual_climatologies(ds, cacheInfo, printProgress, yearsPerCacheFile, monthValues, calendar): - ''' + """ Cache individual climatologies for later aggregation. - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -798,9 +798,9 @@ def _cache_individual_climatologies(ds, cacheInfo, printProgress, def _cache_aggregated_climatology(startYearClimo, endYearClimo, cachePrefix, printProgress, monthValues, cacheInfo): - ''' + """ Cache aggregated climatology from individual climatologies. - ''' + """ # Authors # ------- # Xylar Asay-Davis diff --git a/mpas_analysis/shared/climatology/mpas_climatology_task.py b/mpas_analysis/shared/climatology/mpas_climatology_task.py index b5b71987d..7403089ea 100644 --- a/mpas_analysis/shared/climatology/mpas_climatology_task.py +++ b/mpas_analysis/shared/climatology/mpas_climatology_task.py @@ -34,7 +34,7 @@ class MpasClimatologyTask(AnalysisTask): - ''' + """ An analysis tasks for computing climatologies from output from the ``timeSeriesStatsMonthly*`` analysis members. @@ -74,14 +74,14 @@ class MpasClimatologyTask(AnalysisTask): ``timeSeriesStatsMonthlyOutput``, ``timeSeriesStatsMonthlyMinOutput``, ``timeSeriesStatsMonthlyMaxOutput`` - ''' + """ # Authors # ------- # Xylar Asay-Davis def __init__(self, config, componentName, taskName=None, op='avg'): - ''' + """ Construct the analysis task. Parameters @@ -99,7 +99,7 @@ def __init__(self, config, componentName, taskName=None, op='avg'): taskName : str, optional the name of the task, defaults to mpasClimatology - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -177,7 +177,7 @@ def __init__(self, config, componentName, taskName=None, op='avg'): self.seasonSubtasks[monthName]) def add_variables(self, variableList, seasons=None): - ''' + """ Add one or more variables and optionally one or more seasons for which to compute climatologies. @@ -198,7 +198,7 @@ def add_variables(self, variableList, seasons=None): if this funciton is called before this task has been set up (so the list of available variables has not yet been set) or if one or more of the requested variables is not available in the stream. - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -235,7 +235,7 @@ def add_variables(self, variableList, seasons=None): self.add_variables(variableList, seasons=monthNames) def setup_and_check(self): - ''' + """ Perform steps to set up the analysis and check for errors in the setup. Raises @@ -244,7 +244,7 @@ def setup_and_check(self): If a restart file is not available from which to read mesh information or if no history files are available from which to compute the climatology in the desired time range. - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -291,9 +291,9 @@ def setup_and_check(self): self.allVariables = list(ds.data_vars.keys()) def run_task(self): - ''' + """ Compute the requested climatologies - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -433,7 +433,7 @@ def _create_symlinks(self): def _compute_climatologies_with_ncclimo(self, inDirectory, outDirectory, remapper=None, remappedDirectory=None): - ''' + """ Uses ncclimo to compute monthly, seasonal and/or annual climatologies. Parameters @@ -458,7 +458,7 @@ def _compute_climatologies_with_ncclimo(self, inDirectory, outDirectory, ------ OSError If ``ncclimo`` is not in the system path. - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -539,7 +539,7 @@ def _compute_climatologies_with_ncclimo(self, inDirectory, outDirectory, class MpasClimatologySeasonSubtask(AnalysisTask): - ''' + """ An analysis subtasks for computing climatologies from output from the ``timeSeriesStatsMonthly`` analysis member for a single month or season. @@ -551,14 +551,14 @@ class MpasClimatologySeasonSubtask(AnalysisTask): parentTask : ``MpasClimatologyTask`` The task that this subtask belongs to. - ''' + """ # Authors # ------- # Xylar Asay-Davis def __init__(self, parentTask, season, subtaskName=None): - ''' + """ Construct the analysis task and adds it as a subtask of the ``parentTask``. @@ -573,7 +573,7 @@ def __init__(self, parentTask, season, subtaskName=None): subtaskName : str, optional the name of the subtask, defaults to season - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -602,9 +602,9 @@ def __init__(self, parentTask, season, subtaskName=None): self.config.getint('climatology', 'daskThreads')) def run_task(self): - ''' + """ Compute the requested climatologies - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -649,7 +649,7 @@ def run_task(self): def _compute_climatologies_with_xarray(self, inDirectory, outDirectory): - ''' + """ Uses xarray to compute seasonal and/or annual climatologies. Parameters @@ -659,7 +659,7 @@ def _compute_climatologies_with_xarray(self, inDirectory, outDirectory): outDirectory : str The output directory where climatologies will be written - ''' + """ # Authors # ------- diff --git a/mpas_analysis/shared/climatology/ref_year_mpas_climatology_task.py b/mpas_analysis/shared/climatology/ref_year_mpas_climatology_task.py index 1beb9dc57..756373eaf 100644 --- a/mpas_analysis/shared/climatology/ref_year_mpas_climatology_task.py +++ b/mpas_analysis/shared/climatology/ref_year_mpas_climatology_task.py @@ -18,7 +18,7 @@ class RefYearMpasClimatologyTask(MpasClimatologyTask): - ''' + """ An analysis tasks for computing a reference-year climatology for computing climatology anomalies from the``timeSeriesStatsMonthly`` analysis member. @@ -27,13 +27,13 @@ class RefYearMpasClimatologyTask(MpasClimatologyTask): anomalyRefYear : int The reference year over which to compute the climatology - ''' + """ # Authors # ------- # Xylar Asay-Davis def __init__(self, config, componentName, taskName=None): - ''' + """ Construct the analysis task and adds it as a subtask of the ``parentTask``. @@ -48,7 +48,7 @@ def __init__(self, config, componentName, taskName=None): taskName : str, optional the name of the task, defaults to mpasClimatology - ''' + """ # Authors # ------- # Xylar Asay-Davis diff --git a/mpas_analysis/shared/climatology/remap_mpas_climatology_subtask.py b/mpas_analysis/shared/climatology/remap_mpas_climatology_subtask.py index 8571db6d3..c23adf460 100644 --- a/mpas_analysis/shared/climatology/remap_mpas_climatology_subtask.py +++ b/mpas_analysis/shared/climatology/remap_mpas_climatology_subtask.py @@ -31,7 +31,7 @@ class RemapMpasClimatologySubtask(AnalysisTask): - ''' + """ An analysis tasks for computing climatologies from output from the ``timeSeriesStatsMonthly`` analysis member. @@ -72,7 +72,7 @@ class RemapMpasClimatologySubtask(AnalysisTask): op : {'avg', 'min', 'max'} operator for monthly stats - ''' + """ # Authors # ------- @@ -83,7 +83,7 @@ def __init__(self, mpasClimatologyTask, parentTask, climatologyName, iselValues=None, subtaskName='remapMpasClimatology', useNcremap=None): - ''' + """ Construct the analysis task and adds it as a subtask of the ``parentTask``. @@ -130,7 +130,7 @@ def __init__(self, mpasClimatologyTask, parentTask, climatologyName, if it is not explicitly given. If a comparison grid other than ``latlon`` is given, ncremap is not supported so this flag is set to ``False``. - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -175,7 +175,7 @@ def __init__(self, mpasClimatologyTask, parentTask, climatologyName, self.useNcremap = useNcremap def setup_and_check(self): - ''' + """ Perform steps to set up the analysis and check for errors in the setup. Raises @@ -184,7 +184,7 @@ def setup_and_check(self): If a restart file is not available from which to read mesh information or if no history files are available from which to compute the climatology in the desired time range. - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -218,9 +218,9 @@ def setup_and_check(self): make_directories(mappingSubdirectory) def run_task(self): - ''' + """ Compute the requested climatologies - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -259,7 +259,7 @@ def run_task(self): def add_comparison_grid_descriptor(self, comparisonGridName, comparisonDescriptor): - ''' + """ Add a custom grid descriptor (something other than 'latlon', 'antarctic', 'arctic', 'north_atlantic', or 'north_pacific'). @@ -272,7 +272,7 @@ def add_comparison_grid_descriptor(self, comparisonGridName, A descriptor of the comparison grid to use for remapping - ''' + """ self.comparisonDescriptors[comparisonGridName] = \ comparisonDescriptor @@ -488,7 +488,7 @@ def _setup_file_names(self): self._outputFiles[key] = fileName def _mask_climatologies(self, season, dsMask): - ''' + """ For each season, creates a masked version of the climatology Parameters @@ -503,7 +503,7 @@ def _mask_climatologies(self, season, dsMask): Author ------ Xylar Asay-Davis - ''' + """ climatologyFileName = self.mpasClimatologyTask.get_file_name(season) diff --git a/mpas_analysis/shared/climatology/remap_observed_climatology_subtask.py b/mpas_analysis/shared/climatology/remap_observed_climatology_subtask.py index 34cbe4d4a..1d55cee9d 100644 --- a/mpas_analysis/shared/climatology/remap_observed_climatology_subtask.py +++ b/mpas_analysis/shared/climatology/remap_observed_climatology_subtask.py @@ -56,7 +56,7 @@ def __init__(self, parentTask, seasons, fileName, outFilePrefix, comparisonGridNames=['latlon'], subtaskName='remapObservations'): - ''' + """ Construct one analysis subtask for each plot (i.e. each season and comparison grid) and a subtask for computing climatologies. @@ -82,7 +82,7 @@ def __init__(self, parentTask, seasons, fileName, outFilePrefix, subtaskName : str, optional The name of the subtask - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -187,7 +187,7 @@ def run_task(self): logger=self.logger) def get_observation_descriptor(self, fileName): - ''' + """ get a MeshDescriptor for the observation grid. A subclass derived from this class must override this method to create the appropriate descriptor @@ -201,7 +201,7 @@ def get_observation_descriptor(self, fileName): ------- obsDescriptor : ``MeshDescriptor`` The descriptor for the observation grid - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -209,7 +209,7 @@ def get_observation_descriptor(self, fileName): return None def build_observational_dataset(self, fileName): - ''' + """ read in the data sets for observations, and possibly rename some variables and dimensions. A subclass derived from this class must override this method to create the appropriate data set @@ -223,7 +223,7 @@ def build_observational_dataset(self, fileName): ------- dsObs : ``xarray.Dataset`` The observational dataset - ''' + """ # Authors # ------- # Xylar Asay-Davis diff --git a/mpas_analysis/shared/interpolation/utility.py b/mpas_analysis/shared/interpolation/utility.py index fca84df2f..349e039b5 100644 --- a/mpas_analysis/shared/interpolation/utility.py +++ b/mpas_analysis/shared/interpolation/utility.py @@ -14,10 +14,10 @@ def add_periodic_lon(ds, lonDim, degrees=True): - ''' + """ Add a single grid point that is a periodic image to the end of the data set in the lon dimension - ''' + """ lonRange = ds.lon[-1].values - ds.lon[0].values if degrees: diff --git a/mpas_analysis/shared/io/download.py b/mpas_analysis/shared/io/download.py index 713f754b0..592338156 100644 --- a/mpas_analysis/shared/io/download.py +++ b/mpas_analysis/shared/io/download.py @@ -26,9 +26,9 @@ # From https://stackoverflow.com/a/1094933/7728169 def sizeof_fmt(num, suffix='B'): - ''' + """ Covert a number of bytes to a human-readable file size - ''' + """ for unit in ['', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi']: if abs(num) < 1024.0: return "%3.1f%s%s" % (num, unit, suffix) @@ -37,9 +37,9 @@ def sizeof_fmt(num, suffix='B'): def download_files(fileList, urlBase, outDir, verify=True): - ''' + """ Download a list of files from a URL to a directory - ''' + """ # Authors # ------- # Milena Veneziani diff --git a/mpas_analysis/shared/io/write_netcdf.py b/mpas_analysis/shared/io/write_netcdf.py index 136826d7e..0fd7fafc6 100644 --- a/mpas_analysis/shared/io/write_netcdf.py +++ b/mpas_analysis/shared/io/write_netcdf.py @@ -13,7 +13,7 @@ def write_netcdf(ds, fileName, fillValues=netCDF4.default_fillvals): - ''' + """ Write an xarray data set to a NetCDF file using finite fill values and unicode strings @@ -29,7 +29,7 @@ def write_netcdf(ds, fileName, fillValues=netCDF4.default_fillvals): A dictionary of fill values for each supported data type. By default, this is the dictionary used by the netCDF4 package. Key entries should be of the form 'f8' (for float64), 'i4' (for int32), etc. - ''' + """ # Authors # ------- # Xylar Asay-Davis diff --git a/mpas_analysis/shared/plot/colormap.py b/mpas_analysis/shared/plot/colormap.py index 07ed38113..710dd1446 100644 --- a/mpas_analysis/shared/plot/colormap.py +++ b/mpas_analysis/shared/plot/colormap.py @@ -26,7 +26,7 @@ def setup_colormap(config, configSectionName, suffix=''): - ''' + """ Set up a colormap from the registry Parameters @@ -61,7 +61,7 @@ def setup_colormap(config, configSectionName, suffix=''): 'lineWidth' is the width of contour lines or ``None`` if not specified 'lineColor' is the color of contour lines or ``None`` if not specified - ''' + """ # Authors # ------- # Xylar Asay-Davis, Milena Veneziani, Greg Streletz @@ -303,7 +303,7 @@ def register_custom_colormaps(): def _setup_colormap_and_norm(config, configSectionName, suffix=''): - ''' + """ Set up a colormap from the registry Parameters @@ -328,7 +328,7 @@ def _setup_colormap_and_norm(config, configSectionName, suffix=''): ticks : array of float the tick marks on the colormap - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -364,7 +364,7 @@ def _setup_colormap_and_norm(config, configSectionName, suffix=''): def _setup_indexed_colormap(config, configSectionName, suffix=''): - ''' + """ Set up a colormap from the registry Parameters @@ -391,7 +391,7 @@ def _setup_indexed_colormap(config, configSectionName, suffix=''): ticks : array of float the tick marks on the colormap - ''' + """ # Authors # ------- # Xylar Asay-Davis, Milena Veneziani, Greg Streletz @@ -441,7 +441,7 @@ def _setup_indexed_colormap(config, configSectionName, suffix=''): def _read_xml_colormap(xmlFile, map_name): - '''Read in an XML colormap''' + """Read in an XML colormap""" xml = ET.parse(xmlFile) @@ -469,7 +469,7 @@ def _register_colormap_and_reverse(map_name, cmap): def _plot_color_gradients(): - '''from https://matplotlib.org/tutorials/colors/colormaps.html''' + """from https://matplotlib.org/tutorials/colors/colormaps.html""" cmap_list = [m for m in plt.colormaps() if not m.endswith("_r")] diff --git a/mpas_analysis/shared/plot/ticks.py b/mpas_analysis/shared/plot/ticks.py index 039ebbaa3..29598d8cd 100644 --- a/mpas_analysis/shared/plot/ticks.py +++ b/mpas_analysis/shared/plot/ticks.py @@ -22,7 +22,7 @@ def plot_xtick_format(calendar, minDays, maxDays, maxXTicks, yearStride=None): - ''' + """ Formats tick labels and positions along the x-axis for time series / index plots @@ -43,7 +43,7 @@ def plot_xtick_format(calendar, minDays, maxDays, maxXTicks, yearStride=None): yearStride : int, optional the number of years to skip over between ticks - ''' + """ # Authors # ------- # Xylar Asay-Davis diff --git a/mpas_analysis/shared/time_series/anomaly.py b/mpas_analysis/shared/time_series/anomaly.py index f2ee540ba..561a51559 100644 --- a/mpas_analysis/shared/time_series/anomaly.py +++ b/mpas_analysis/shared/time_series/anomaly.py @@ -20,7 +20,7 @@ def compute_moving_avg_anomaly_from_start(timeSeriesFileName, variableList, startDate, endDate, calendar, movingAveragePoints=12, alter_dataset=None): - ''' + """ Compute the rolling mean of the anomaly of a quantity from the beginning of the simulation (such that the rolling mean starts at zero by definition) @@ -55,7 +55,7 @@ def compute_moving_avg_anomaly_from_start(timeSeriesFileName, variableList, ------- ds : ``xarray.Dataset`` The anomaly of the rolling time mean from the start of the simulation - ''' + """ # Authors # ------- # Xylar Asay-Davis diff --git a/mpas_analysis/shared/time_series/moving_average.py b/mpas_analysis/shared/time_series/moving_average.py index f0511f9e6..ab9e0e189 100644 --- a/mpas_analysis/shared/time_series/moving_average.py +++ b/mpas_analysis/shared/time_series/moving_average.py @@ -13,7 +13,7 @@ def compute_moving_avg(ds, movingAveragePoints=12): - ''' + """ Compute the rolling mean of a data set Parameters @@ -29,7 +29,7 @@ def compute_moving_avg(ds, movingAveragePoints=12): ------- ds : ``xarray.Dataset`` The anomaly of the rolling time mean from the start of the simulation - ''' + """ # Authors # ------- # Xylar Asay-Davis diff --git a/mpas_analysis/shared/time_series/mpas_time_series_task.py b/mpas_analysis/shared/time_series/mpas_time_series_task.py index 43cac37de..6320dc258 100644 --- a/mpas_analysis/shared/time_series/mpas_time_series_task.py +++ b/mpas_analysis/shared/time_series/mpas_time_series_task.py @@ -23,7 +23,7 @@ class MpasTimeSeriesTask(AnalysisTask): - ''' + """ An analysis tasks for computing time series from output from the ``timeSeriesStatsMonthly`` analysis member. @@ -46,7 +46,7 @@ class MpasTimeSeriesTask(AnalysisTask): startYear, endYear : int The start and end years of the time series - ''' + """ # Authors # ------- @@ -54,7 +54,7 @@ class MpasTimeSeriesTask(AnalysisTask): def __init__(self, config, componentName, taskName=None, subtaskName=None, section='timeSeries'): - ''' + """ Construct the analysis task for extracting time series. Parameters @@ -76,7 +76,7 @@ def __init__(self, config, componentName, taskName=None, section : str, optional The section of the config file from which to read the start and end times for the time series, also added as a tag - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -101,7 +101,7 @@ def __init__(self, config, componentName, taskName=None, tags=tags) def add_variables(self, variableList): - ''' + """ Add one or more variables to extract as a time series. Parameters @@ -117,7 +117,7 @@ def add_variables(self, variableList): the list of available variables has not yet been set) or if one or more of the requested variables is not available in the ``timeSeriesStatsMonthly`` output. - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -139,9 +139,9 @@ def add_variables(self, variableList): self.variableList.append(variable) def setup_and_check(self): - ''' + """ Perform steps to set up the analysis and check for errors in the setup. - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -208,9 +208,9 @@ def setup_and_check(self): self.allVariables = list(ds.data_vars.keys()) def run_task(self): - ''' + """ Compute the requested time series - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -225,7 +225,7 @@ def run_task(self): def _compute_time_series_with_ncrcat(self): - ''' + """ Uses ncrcat to extact time series from timeSeriesMonthlyOutput files Raises @@ -236,7 +236,7 @@ def _compute_time_series_with_ncrcat(self): Author ------ Xylar Asay-Davis - ''' + """ if find_executable('ncrcat') is None: raise OSError('ncrcat not found. Make sure the latest nco ' diff --git a/mpas_analysis/shared/time_series/time_series.py b/mpas_analysis/shared/time_series/time_series.py index 0b8ad4cb5..9d2a61a89 100644 --- a/mpas_analysis/shared/time_series/time_series.py +++ b/mpas_analysis/shared/time_series/time_series.py @@ -27,7 +27,7 @@ def combine_time_series_with_ncrcat(inFileNames, outFileName, variableList=None, logger=None): - ''' + """ Uses ncrcat to extact time series from a series of files inFileNames : str or list of str @@ -51,7 +51,7 @@ def combine_time_series_with_ncrcat(inFileNames, outFileName, Author ------ Xylar Asay-Davis - ''' + """ if find_executable('ncrcat') is None: raise OSError('ncrcat not found. Make sure the latest nco ' @@ -110,7 +110,7 @@ def combine_time_series_with_ncrcat(inFileNames, outFileName, def cache_time_series(timesInDataSet, timeSeriesCalcFunction, cacheFileName, calendar, yearsPerCacheUpdate=1, logger=None): - ''' + """ Create or update a NetCDF file ``cacheFileName`` containing the given time series, calculated with ``timeSeriesCalcFunction`` over the given times, start and end year, and time frequency with which results are cached. @@ -154,7 +154,7 @@ def cache_time_series(timesInDataSet, timeSeriesCalcFunction, cacheFileName, A data set without the ``'Time'`` coordinate containing the mean of ds over all months in monthValues, weighted by the number of days in each month. - ''' + """ # Authors # ------- # Xylar Asay-Davis diff --git a/mpas_analysis/test/__init__.py b/mpas_analysis/test/__init__.py index 8d116ac95..7788d1aa9 100644 --- a/mpas_analysis/test/__init__.py +++ b/mpas_analysis/test/__init__.py @@ -44,11 +44,11 @@ def requires_numpy(test): # http://stackoverflow.com/questions/29627341/pytest-where-to-store-expected-data @fixture def loaddatadir(request, tmpdir): - ''' + """ Fixture responsible for searching a folder with the same name of test module and, if available, moving all contents to a temporary directory so tests can use them freely. - ''' + """ filename = request.module.__file__ test_dir, _ = os.path.splitext(filename) diff --git a/mpas_analysis/test/test_remap_obs_clim_subtask.py b/mpas_analysis/test/test_remap_obs_clim_subtask.py index c37617503..4f11cb34a 100644 --- a/mpas_analysis/test/test_remap_obs_clim_subtask.py +++ b/mpas_analysis/test/test_remap_obs_clim_subtask.py @@ -40,7 +40,7 @@ class RemapObservedMLDClimatology(RemapObservedClimatologySubtask): # Xylar Asay-Davis def get_observation_descriptor(self, fileName): - ''' + """ get a MeshDescriptor for the observation grid Parameters @@ -52,7 +52,7 @@ def get_observation_descriptor(self, fileName): ------- obsDescriptor : ``MeshDescriptor`` The descriptor for the observation grid - ''' + """ # Authors # ------- # Xylar Asay-Davis @@ -65,7 +65,7 @@ def get_observation_descriptor(self, fileName): return obsDescriptor def build_observational_dataset(self, fileName): - ''' + """ read in the data sets for observations, and possibly rename some variables and dimensions @@ -78,7 +78,7 @@ def build_observational_dataset(self, fileName): ------- dsObs : ``xarray.Dataset`` The observational dataset - ''' + """ # Authors # ------- # Xylar Asay-Davis From 1cee1b75e58f95518127ee28acf98f6a9beb3205 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Wed, 20 Apr 2022 21:38:27 +0200 Subject: [PATCH 24/40] Update copyright to 2022 --- LICENSE | 10 +++++----- docs/conf.py | 2 +- download_analysis_data.py | 6 +++--- licenses/_headers/header-css | 6 +++--- licenses/_headers/header-css-full | 6 +++--- licenses/_headers/header-html | 6 +++--- licenses/_headers/header-html-full | 6 +++--- licenses/_headers/header-ncl | 6 +++--- licenses/_headers/header-ncl-full | 6 +++--- licenses/_headers/header-py | 6 +++--- licenses/_headers/header-py-full | 6 +++--- licenses/_headers/license-bump-copyright.sh | 6 +++--- licenses/_headers/license-prepend-missing.sh | 6 +++--- licenses/_headers/license-setup.sh | 6 +++--- licenses/_headers/update_license.py | 12 ++++++------ mpas_analysis/__main__.py | 6 +++--- mpas_analysis/analysis_task_template.py | 6 +++--- mpas_analysis/download_data.py | 6 +++--- mpas_analysis/obs/make_obs_readme_bibtex.py | 6 +++--- .../ocean/climatology_map_antarctic_melt.py | 6 +++--- mpas_analysis/ocean/climatology_map_argo.py | 6 +++--- mpas_analysis/ocean/climatology_map_eke.py | 6 +++--- mpas_analysis/ocean/climatology_map_mld.py | 6 +++--- mpas_analysis/ocean/climatology_map_mld_min_max.py | 6 +++--- mpas_analysis/ocean/climatology_map_ohc_anomaly.py | 6 +++--- mpas_analysis/ocean/climatology_map_schmidtko.py | 6 +++--- mpas_analysis/ocean/climatology_map_sose.py | 6 +++--- mpas_analysis/ocean/climatology_map_ssh.py | 6 +++--- mpas_analysis/ocean/climatology_map_sss.py | 6 +++--- mpas_analysis/ocean/climatology_map_sst.py | 6 +++--- mpas_analysis/ocean/climatology_map_woa.py | 6 +++--- mpas_analysis/ocean/compute_anomaly_subtask.py | 6 +++--- mpas_analysis/ocean/compute_transects_subtask.py | 6 +++--- .../ocean/compute_transects_with_vel_mag.py | 6 +++--- mpas_analysis/ocean/geojson_transects.py | 6 +++--- mpas_analysis/ocean/hovmoller_ocean_regions.py | 6 +++--- mpas_analysis/ocean/index_nino34.py | 6 +++--- mpas_analysis/ocean/meridional_heat_transport.py | 6 +++--- mpas_analysis/ocean/ocean_regional_profiles.py | 6 +++--- mpas_analysis/ocean/plot_climatology_map_subtask.py | 6 +++--- .../plot_depth_integrated_time_series_subtask.py | 6 +++--- mpas_analysis/ocean/plot_hovmoller_subtask.py | 6 +++--- mpas_analysis/ocean/plot_transect_subtask.py | 6 +++--- mpas_analysis/ocean/regional_ts_diagrams.py | 6 +++--- mpas_analysis/ocean/remap_depth_slices_subtask.py | 6 +++--- mpas_analysis/ocean/remap_sose_climatology.py | 6 +++--- mpas_analysis/ocean/sose_transects.py | 6 +++--- mpas_analysis/ocean/streamfunction_moc.py | 6 +++--- mpas_analysis/ocean/time_series_antarctic_melt.py | 6 +++--- mpas_analysis/ocean/time_series_ocean_regions.py | 6 +++--- mpas_analysis/ocean/time_series_ohc_anomaly.py | 6 +++--- mpas_analysis/ocean/time_series_salinity_anomaly.py | 6 +++--- mpas_analysis/ocean/time_series_ssh_anomaly.py | 6 +++--- mpas_analysis/ocean/time_series_sst.py | 6 +++--- .../ocean/time_series_temperature_anomaly.py | 6 +++--- mpas_analysis/ocean/time_series_transport.py | 6 +++--- mpas_analysis/ocean/utility.py | 6 +++--- mpas_analysis/ocean/woce_transects.py | 6 +++--- .../sea_ice/climatology_map_sea_ice_conc.py | 6 +++--- .../sea_ice/climatology_map_sea_ice_thick.py | 6 +++--- .../sea_ice/plot_climatology_map_subtask.py | 6 +++--- mpas_analysis/sea_ice/time_series.py | 6 +++--- mpas_analysis/shared/analysis_task.py | 6 +++--- mpas_analysis/shared/climatology/climatology.py | 6 +++--- .../shared/climatology/comparison_descriptors.py | 6 +++--- .../shared/climatology/mpas_climatology_task.py | 6 +++--- .../climatology/ref_year_mpas_climatology_task.py | 6 +++--- .../climatology/remap_mpas_climatology_subtask.py | 6 +++--- .../remap_observed_climatology_subtask.py | 6 +++--- mpas_analysis/shared/constants/constants.py | 6 +++--- mpas_analysis/shared/containers.py | 6 +++--- .../shared/generalized_reader/generalized_reader.py | 6 +++--- mpas_analysis/shared/html/image_xml.py | 6 +++--- mpas_analysis/shared/html/pages.py | 6 +++--- mpas_analysis/shared/html/templates/style.css | 6 +++--- mpas_analysis/shared/interpolation/interp_1d.py | 6 +++--- mpas_analysis/shared/interpolation/utility.py | 6 +++--- mpas_analysis/shared/io/download.py | 6 +++--- mpas_analysis/shared/io/mpas_reader.py | 6 +++--- .../shared/io/namelist_streams_interface.py | 6 +++--- mpas_analysis/shared/io/utility.py | 6 +++--- mpas_analysis/shared/io/write_netcdf.py | 6 +++--- mpas_analysis/shared/mpas_xarray/mpas_xarray.py | 6 +++--- mpas_analysis/shared/plot/climatology_map.py | 6 +++--- mpas_analysis/shared/plot/colormap.py | 6 +++--- mpas_analysis/shared/plot/inset.py | 6 +++--- mpas_analysis/shared/plot/oned.py | 6 +++--- mpas_analysis/shared/plot/save.py | 6 +++--- mpas_analysis/shared/plot/ticks.py | 6 +++--- mpas_analysis/shared/plot/time_series.py | 6 +++--- mpas_analysis/shared/plot/vertical_section.py | 6 +++--- mpas_analysis/shared/projection/__init__.py | 6 +++--- mpas_analysis/shared/regions/compute_region_masks.py | 6 +++--- .../shared/regions/compute_region_masks_subtask.py | 6 +++--- mpas_analysis/shared/time_series/anomaly.py | 6 +++--- mpas_analysis/shared/time_series/moving_average.py | 6 +++--- .../shared/time_series/mpas_time_series_task.py | 6 +++--- mpas_analysis/shared/time_series/time_series.py | 6 +++--- .../shared/timekeeping/MpasRelativeDelta.py | 6 +++--- mpas_analysis/shared/timekeeping/utility.py | 6 +++--- .../transects/compute_transect_masks_subtask.py | 6 +++--- mpas_analysis/test/test_analysis_task.py | 6 +++--- mpas_analysis/test/test_climatology.py | 6 +++--- mpas_analysis/test/test_generalized_reader.py | 6 +++--- mpas_analysis/test/test_io_utility.py | 6 +++--- mpas_analysis/test/test_mpas_climatology_task.py | 6 +++--- mpas_analysis/test/test_mpas_xarray.py | 6 +++--- .../test/test_namelist_streams_interface.py | 6 +++--- mpas_analysis/test/test_open_mpas_dataset.py | 6 +++--- mpas_analysis/test/test_remap_obs_clim_subtask.py | 6 +++--- .../test_remap_obs_clim_subtask/remap_mld_obs.py | 6 +++--- mpas_analysis/test/test_timekeeping.py | 6 +++--- preprocess_observations/preprocess_SOSE_data.py | 6 +++--- preprocess_observations/preprocess_Schmidtko_data.py | 6 +++--- preprocess_observations/remap_rignot.py | 6 +++--- setup.py | 6 +++--- utility_scripts/make_ismip6_region_masks.py | 6 +++--- utility_scripts/make_region_mask.py | 6 +++--- 118 files changed, 357 insertions(+), 357 deletions(-) diff --git a/LICENSE b/LICENSE index 8bba651a9..f363b46e6 100644 --- a/LICENSE +++ b/LICENSE @@ -1,11 +1,11 @@ This software is open source software available under the BSD-3 license. -Copyright (c) 2020 Triad National Security, LLC. All rights reserved. -Copyright (c) 2020 Lawrence Livermore National Security, LLC. All rights reserved. -Copyright (c) 2020 UT-Battelle, LLC. All rights reserved. +Copyright (c) 2022 Triad National Security, LLC. All rights reserved. +Copyright (c) 2022 Lawrence Livermore National Security, LLC. All rights reserved. +Copyright (c) 2022 UT-Battelle, LLC. All rights reserved. -Copyright (c) 2020 Triad National Security, LLC. This program was produced +Copyright (c) 2022 Triad National Security, LLC. This program was produced under U.S. Government contract 89233218CNA000001 for Los Alamos National Laboratory (LANL), which is operated by Triad National Security, LLC for the U.S. Department of Energy/National Nuclear Security Administration. All rights @@ -16,7 +16,7 @@ irrevocable worldwide license in this material to reproduce, prepare derivative works, distribute copies to the public, perform publicly and display publicly, and to permit others to do so. -Copyright (c) 2020 Lawrence Livermore National Security, LLC. This work was +Copyright (c) 2022 Lawrence Livermore National Security, LLC. This work was produced under the auspices of the U.S. Department of Energy by Lawrence Livermore National Laboratory under Contract DE-AC52-07NA27344. This work was prepared as an account of work sponsored by an agency of the United States diff --git a/docs/conf.py b/docs/conf.py index 4e9fdd37a..987ac3fa2 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -65,7 +65,7 @@ # General information about the project. project = u'MPAS-Analysis' copyright = u'This software is open source software available under the BSD-3' \ - u'license. Copyright (c) 2020 Triad National Security, LLC. ' \ + u'license. Copyright (c) 2022 Triad National Security, LLC. ' \ u'All rights reserved. Copyright (c) 2018 Lawrence Livermore ' \ u'National Security, LLC. All rights reserved. Copyright (c) ' \ u'2018 UT-Battelle, LLC. All rights reserved.' diff --git a/download_analysis_data.py b/download_analysis_data.py index 0204a9a67..d6714c3e1 100755 --- a/download_analysis_data.py +++ b/download_analysis_data.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # This software is open source software available under the BSD-3 license. # -# Copyright (c) 2020 Triad National Security, LLC. All rights reserved. -# Copyright (c) 2020 Lawrence Livermore National Security, LLC. All rights +# Copyright (c) 2022 Triad National Security, LLC. All rights reserved. +# Copyright (c) 2022 Lawrence Livermore National Security, LLC. All rights # reserved. -# Copyright (c) 2020 UT-Battelle, LLC. All rights reserved. +# Copyright (c) 2022 UT-Battelle, LLC. All rights reserved. # # Additional copyright and license information can be found in the LICENSE file # distributed with this code, or at diff --git a/licenses/_headers/header-css b/licenses/_headers/header-css index 51935faaa..b28084242 100755 --- a/licenses/_headers/header-css +++ b/licenses/_headers/header-css @@ -1,10 +1,10 @@ /* / This software is open source software available under the BSD-3 license. / -/ Copyright (c) 2020 Triad National Security, LLC. All rights reserved. -/ Copyright (c) 2020 Lawrence Livermore National Security, LLC. All rights +/ Copyright (c) 2022 Triad National Security, LLC. All rights reserved. +/ Copyright (c) 2022 Lawrence Livermore National Security, LLC. All rights / reserved. -/ Copyright (c) 2020 UT-Battelle, LLC. All rights reserved. +/ Copyright (c) 2022 UT-Battelle, LLC. All rights reserved. / / Additional copyright and license information can be found in the LICENSE file / distributed with this code, or at diff --git a/licenses/_headers/header-css-full b/licenses/_headers/header-css-full index 0cf4809ed..a7b390bb1 100755 --- a/licenses/_headers/header-css-full +++ b/licenses/_headers/header-css-full @@ -1,9 +1,9 @@ /* / This software is open source software available under the BSD-3 license. / -/ Copyright (c) 2020 Triad National Security, LLC. All rights reserved. -/ Copyright (c) 2020 Lawrence Livermore National Security, LLC. All rights reserved. -/ Copyright (c) 2020 UT-Battelle, LLC. All rights reserved. +/ Copyright (c) 2022 Triad National Security, LLC. All rights reserved. +/ Copyright (c) 2022 Lawrence Livermore National Security, LLC. All rights reserved. +/ Copyright (c) 2022 UT-Battelle, LLC. All rights reserved. / / Copyright 2018. Los Alamos National Security, LLC. This software was produced / under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National diff --git a/licenses/_headers/header-html b/licenses/_headers/header-html index d8dbbb4ed..2296e6812 100755 --- a/licenses/_headers/header-html +++ b/licenses/_headers/header-html @@ -1,10 +1,10 @@