diff --git a/ci/recipe/meta.yaml b/ci/recipe/meta.yaml index c1396472a..1c6dcd7fb 100644 --- a/ci/recipe/meta.yaml +++ b/ci/recipe/meta.yaml @@ -1,5 +1,5 @@ {% set name = "MPAS-Analysis" %} -{% set version = "1.7.0" %} +{% set version = "1.7.1" %} package: name: {{ name|lower }} diff --git a/docs/versions.rst b/docs/versions.rst index f9407897a..2aa20538b 100644 --- a/docs/versions.rst +++ b/docs/versions.rst @@ -16,6 +16,7 @@ Documentation On GitHub `v1.6.0`_ `1.6.0`_ `v1.6.1`_ `1.6.1`_ `v1.7.0`_ `1.7.0`_ +`v1.7.1`_ `1.7.1`_ ================ =============== .. _`stable`: ../stable/index.html @@ -30,6 +31,7 @@ Documentation On GitHub .. _`v1.6.0`: ../1.6.0/index.html .. _`v1.6.1`: ../1.6.1/index.html .. _`v1.7.0`: ../1.7.0/index.html +.. _`v1.7.1`: ../1.7.1/index.html .. _`master`: https://github.com/MPAS-Dev/MPAS-Analysis/tree/master .. _`develop`: https://github.com/MPAS-Dev/MPAS-Analysis/tree/develop .. _`1.2.6`: https://github.com/MPAS-Dev/MPAS-Analysis/tree/1.2.6 @@ -42,3 +44,4 @@ Documentation On GitHub .. _`1.6.0`: https://github.com/MPAS-Dev/MPAS-Analysis/tree/1.6.0 .. _`1.6.1`: https://github.com/MPAS-Dev/MPAS-Analysis/tree/1.6.1 .. _`1.7.0`: https://github.com/MPAS-Dev/MPAS-Analysis/tree/1.7.0 +.. _`1.7.1`: https://github.com/MPAS-Dev/MPAS-Analysis/tree/1.7.1 diff --git a/mpas_analysis/__init__.py b/mpas_analysis/__init__.py index 2aa385a38..ac634dd0f 100644 --- a/mpas_analysis/__init__.py +++ b/mpas_analysis/__init__.py @@ -3,5 +3,5 @@ import matplotlib as mpl mpl.use('Agg') -__version_info__ = (1, 7, 0) +__version_info__ = (1, 7, 1) __version__ = '.'.join(str(vi) for vi in __version_info__) diff --git a/mpas_analysis/ocean/index_nino34.py b/mpas_analysis/ocean/index_nino34.py index 9a3aa286f..791cc3f4f 100644 --- a/mpas_analysis/ocean/index_nino34.py +++ b/mpas_analysis/ocean/index_nino34.py @@ -328,7 +328,7 @@ def _compute_nino34_index(self, regionSST, calendar): regionSST : xarray.DataArray object values of SST in the nino region - calendar: {'gregorian', 'gregorian_noleap'} + calendar: {'gregorian', 'noleap'} The name of the calendars used in the MPAS run Returns diff --git a/mpas_analysis/ocean/regional_ts_diagrams.py b/mpas_analysis/ocean/regional_ts_diagrams.py index add1dccd8..ba219b869 100644 --- a/mpas_analysis/ocean/regional_ts_diagrams.py +++ b/mpas_analysis/ocean/regional_ts_diagrams.py @@ -77,7 +77,7 @@ def __init__(self, config, mpasClimatologyTask, regionMasksTask, regionMasksTask : ``ComputeRegionMasks`` A task for computing region masks - controlconfig : mpas_tools.config.MpasConfigParser, optional + controlConfig : mpas_tools.config.MpasConfigParser, optional Configuration options for a control run (if any) """ # Authors @@ -658,12 +658,9 @@ def _write_mpas_t_s(self, config): ds = ds.where(cellMask, drop=True) - self.logger.info("Don't worry about the following dask " - "warnings.") depthMask = numpy.logical_and(ds.zMid >= zmin, ds.zMid <= zmax) depthMask.compute() - self.logger.info("Dask warnings should be done.") ds['depthMask'] = depthMask for var in variableList: @@ -715,7 +712,7 @@ def _write_obs_t_s(self, obsDict, zmin, zmax): xarray.open_dataset(regionMaskFileName).chunk(chunk).stack( nCells=(obsDict['latVar'], obsDict['lonVar'])) dsRegionMask = dsRegionMask.reset_index('nCells').drop_vars( - [obsDict['latVar'], obsDict['lonVar']]) + [obsDict['latVar'], obsDict['lonVar'], 'nCells']) maskRegionNames = decode_strings(dsRegionMask.regionNames) regionIndex = maskRegionNames.index(self.regionName) @@ -745,7 +742,7 @@ def _write_obs_t_s(self, obsDict, zmin, zmax): ds = xarray.open_dataset(obsFileName, chunks=chunk) ds = ds.stack(nCells=(obsDict['latVar'], obsDict['lonVar'])) ds = ds.reset_index('nCells').drop_vars( - [obsDict['latVar'], obsDict['lonVar']]) + [obsDict['latVar'], obsDict['lonVar'], 'nCells']) ds = ds.where(cellMask, drop=True) diff --git a/mpas_analysis/ocean/time_series_ocean_regions.py b/mpas_analysis/ocean/time_series_ocean_regions.py index ae169be51..bb516c4cf 100644 --- a/mpas_analysis/ocean/time_series_ocean_regions.py +++ b/mpas_analysis/ocean/time_series_ocean_regions.py @@ -871,7 +871,7 @@ def run_task(self): xarray.open_dataset(regionMaskFileName).stack( nCells=(obsDict['latVar'], obsDict['lonVar'])) dsRegionMask = dsRegionMask.reset_index('nCells').drop_vars( - [obsDict['latVar'], obsDict['lonVar']]) + [obsDict['latVar'], obsDict['lonVar'], 'nCells']) maskRegionNames = decode_strings(dsRegionMask.regionNames) regionIndex = maskRegionNames.index(self.regionName) @@ -956,7 +956,7 @@ def run_task(self): dsMonth = dsMonth.stack(nCells=(obsDict['latVar'], obsDict['lonVar'])) dsMonth = dsMonth.reset_index('nCells').drop_vars( - [obsDict['latVar'], obsDict['lonVar']]) + [obsDict['latVar'], obsDict['lonVar'], 'nCells']) dsMonth = dsMonth.where(cellMask, drop=True) diff --git a/mpas_analysis/sea_ice/time_series.py b/mpas_analysis/sea_ice/time_series.py index 2b48d5304..b22371035 100644 --- a/mpas_analysis/sea_ice/time_series.py +++ b/mpas_analysis/sea_ice/time_series.py @@ -525,7 +525,7 @@ def _replicate_cycle(self, ds, dsToReplicate, calendar): length of dsToReplicate plus the time between the first two time values (typically one year total). - calendar : {'gregorian', 'gregorian_noleap'} + calendar : {'gregorian', 'noleap'} The name of one of the calendars supported by MPAS cores Returns: diff --git a/mpas_analysis/shared/climatology/climatology.py b/mpas_analysis/shared/climatology/climatology.py index 46b59ae93..65e24bfa8 100644 --- a/mpas_analysis/shared/climatology/climatology.py +++ b/mpas_analysis/shared/climatology/climatology.py @@ -147,7 +147,7 @@ def compute_monthly_climatology(ds, calendar=None, maskVaries=True): A data set with a ``Time`` coordinate expressed as days since 0001-01-01 or ``month`` coordinate - calendar : {'gregorian', 'gregorian_noleap'}, optional + calendar : {'gregorian', 'noleap'}, optional The name of one of the calendars supported by MPAS cores, used to determine ``month`` from ``Time`` coordinate, so must be supplied if ``ds`` does not already have a ``month`` coordinate or data array @@ -201,7 +201,7 @@ def compute_climatology(ds, monthValues, calendar=None, monthValues : int or array-like of ints A single month or an array of months to be averaged together - calendar : {'gregorian', 'gregorian_noleap'}, optional + calendar : {'gregorian', 'noleap'}, optional The name of one of the calendars supported by MPAS cores, used to determine ``month`` from ``Time`` coordinate, so must be supplied if ``ds`` does not already have a ``month`` coordinate or data array @@ -242,7 +242,7 @@ 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`` + ``startTime`` and ``endTime`` if available or assuming ``noleap`` calendar and ignoring leap years. ``year`` and ``month`` are computed accounting correctly for the the calendar. @@ -252,7 +252,7 @@ def add_years_months_days_in_month(ds, calendar=None): A data set with a ``Time`` coordinate expressed as days since 0001-01-01 - calendar : {'gregorian', 'gregorian_noleap'}, optional + calendar : {'gregorian', 'noleap'}, optional The name of one of the calendars supported by MPAS cores, used to determine ``year`` and ``month`` from ``Time`` coordinate 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 db494b0e9..7f13f1046 100644 --- a/mpas_analysis/shared/climatology/ref_year_mpas_climatology_task.py +++ b/mpas_analysis/shared/climatology/ref_year_mpas_climatology_task.py @@ -100,10 +100,12 @@ def get_start_and_end(self): startDate = '{:04d}-01-01_00:00:00'.format(startYear) endDate = '{:04d}-12-31_23:59:59'.format(endYear) - config.set('climatology', 'startYear', str(startYear)) - config.set('climatology', 'startDate', startDate) - config.set('climatology', 'endYear', str(endYear)) - config.set('climatology', 'endDate', endDate) + # using "user=True" so these changes take priority over user config + # options + config.set('climatology', 'startYear', str(startYear), user=True) + config.set('climatology', 'startDate', startDate, user=True) + config.set('climatology', 'endYear', str(endYear), user=True) + config.set('climatology', 'endDate', endDate, user=True) return startYear, endYear diff --git a/mpas_analysis/shared/generalized_reader/generalized_reader.py b/mpas_analysis/shared/generalized_reader/generalized_reader.py index 70b904d6a..8e0e7ce11 100644 --- a/mpas_analysis/shared/generalized_reader/generalized_reader.py +++ b/mpas_analysis/shared/generalized_reader/generalized_reader.py @@ -47,7 +47,7 @@ def open_multifile_dataset(fileNames, calendar, config, fileNames : list of strings A lsit of file paths to read - calendar : {``'gregorian'``, ``'gregorian_noleap'``}, optional + calendar : {``'gregorian'``, ``'noleap'``}, optional The name of one of the calendars supported by MPAS cores config : mpas_tools.config.MpasConfigParser @@ -186,7 +186,7 @@ def _preprocess(ds, calendar, simulationStartTime, timeVariableName, an xarray time coordinate and with variable names to be substituted. - calendar : {'gregorian', 'gregorian_noleap'} + calendar : {'gregorian', 'noleap'} The name of one of the calendars supported by MPAS cores The name of the time variable (typically 'Time' if using a variableMap diff --git a/mpas_analysis/shared/io/mpas_reader.py b/mpas_analysis/shared/io/mpas_reader.py index 26057fe48..7cd986a16 100644 --- a/mpas_analysis/shared/io/mpas_reader.py +++ b/mpas_analysis/shared/io/mpas_reader.py @@ -35,7 +35,7 @@ def open_mpas_dataset(fileName, calendar, fileName : str File path to read - calendar : {``'gregorian'``, ``'gregorian_noleap'``}, optional + calendar : {``'gregorian'``, ``'noleap'``}, optional The name of one of the calendars supported by MPAS cores timeVariableNames : str or list of 2 str, optional @@ -120,7 +120,7 @@ def _parse_dataset_time(ds, inTimeVariableName, calendar, inTimeVariableName is typically ``['xtime_startMonthly', 'xtime_endMonthly']``. - calendar : {'gregorian', 'gregorian_noleap'} + calendar : {'gregorian', 'noleap'} The name of one of the calendars supported by MPAS cores outTimeVariableName : str diff --git a/mpas_analysis/shared/io/namelist_streams_interface.py b/mpas_analysis/shared/io/namelist_streams_interface.py index aaa646d94..f226203d0 100644 --- a/mpas_analysis/shared/io/namelist_streams_interface.py +++ b/mpas_analysis/shared/io/namelist_streams_interface.py @@ -390,7 +390,7 @@ def readpath(self, streamName, startDate=None, endDate=None, and added to endDate because the file date might be the first or last date contained in the file (or anything in between). - calendar : {'gregorian', 'gregorian_noleap'}, optional + calendar : {'gregorian', 'noleap'}, optional The name of one of the calendars supported by MPAS cores, and is required if startDate and/or endDate are supplied diff --git a/mpas_analysis/shared/mpas_xarray/mpas_xarray.py b/mpas_analysis/shared/mpas_xarray/mpas_xarray.py index 2990fd543..f2f477077 100644 --- a/mpas_analysis/shared/mpas_xarray/mpas_xarray.py +++ b/mpas_analysis/shared/mpas_xarray/mpas_xarray.py @@ -44,7 +44,7 @@ def open_multifile_dataset(fileNames, calendar, fileNames : list of strings A lsit of file paths to read - calendar : {``'gregorian'``, ``'gregorian_noleap'``}, optional + calendar : {'gregorian', 'noleap'}, optional The name of one of the calendars supported by MPAS cores simulationStartTime : string, optional @@ -181,7 +181,7 @@ def preprocess(ds, calendar, simulationStartTime, timeVariableName, The data set containing an MPAS time variable to be used to build an xarray time coordinate. - calendar : {``'gregorian'``, ``'gregorian_noleap'``} + calendar : {'gregorian', 'noleap'} The name of one of the calendars supported by MPAS cores simulationStartTime : string, optinal @@ -376,7 +376,7 @@ def _parse_dataset_time(ds, inTimeVariableName, calendar, determine the value of the time coordinate. In such cases, inTimeVariableName is typically {['xtime_start', 'xtime_end']}. - calendar : {'gregorian', 'gregorian_noleap'} + calendar : {'gregorian', 'noleap'} The name of one of the calendars supported by MPAS cores diff --git a/mpas_analysis/shared/time_series/time_series.py b/mpas_analysis/shared/time_series/time_series.py index 4f6e3efd4..77a9173b9 100644 --- a/mpas_analysis/shared/time_series/time_series.py +++ b/mpas_analysis/shared/time_series/time_series.py @@ -135,7 +135,7 @@ def cache_time_series(timesInDataSet, timeSeriesCalcFunction, cacheFileName, The absolute path to the cache file where the times series will be stored - calendar : {'gregorian', 'gregorian_noleap'} + calendar : {'gregorian', 'noleap'} The name of one of the calendars supported by MPAS cores, used to determine ``year`` and ``month`` from ``Time`` coordinate diff --git a/mpas_analysis/shared/timekeeping/MpasRelativeDelta.py b/mpas_analysis/shared/timekeeping/MpasRelativeDelta.py index 7ff0b70e7..3e9bfbfa5 100644 --- a/mpas_analysis/shared/timekeeping/MpasRelativeDelta.py +++ b/mpas_analysis/shared/timekeeping/MpasRelativeDelta.py @@ -31,7 +31,7 @@ class MpasRelativeDelta(relativedelta): def __init__(self, dt1=None, dt2=None, years=0, months=0, days=0, hours=0, minutes=0, seconds=0, calendar='gregorian'): - if calendar not in ['gregorian', 'gregorian_noleap']: + if calendar not in ['gregorian', 'noleap', 'gregorian_noleap']: raise ValueError('Unsupported MPAs calendar {}'.format(calendar)) self.calendar = calendar super(MpasRelativeDelta, self).__init__(dt1=dt1, dt2=dt2, years=years, @@ -79,7 +79,7 @@ def __add__(self, other): if self.calendar == 'gregorian': daysInMonth = monthrange(year, month)[1] - elif self.calendar == 'gregorian_noleap': + elif self.calendar in ['noleap', 'gregorian_noleap']: # use year 0001, which is not a leapyear daysInMonth = monthrange(1, month)[1] @@ -87,7 +87,7 @@ def __add__(self, other): repl = {"year": year, "month": month, "day": day} days = self.days - if self.calendar == 'gregorian_noleap' and isleap(year): + if self.calendar in ['noleap', 'gregorian_noleap'] and isleap(year): if month == 2 and day + days >= 29: # skip forward over the leap day days += 1 diff --git a/mpas_analysis/shared/timekeeping/utility.py b/mpas_analysis/shared/timekeeping/utility.py index bdae07da2..5bd023fc8 100644 --- a/mpas_analysis/shared/timekeeping/utility.py +++ b/mpas_analysis/shared/timekeeping/utility.py @@ -137,7 +137,7 @@ def string_to_relative_delta(dateString, calendar='gregorian'): Note: either underscores or spaces can be used to separate the date from the time portion of the string. - calendar: {'gregorian', 'gregorian_noleap'}, optional + calendar: {'gregorian', 'noleap'}, optional The name of one of the calendars supported by MPAS cores Returns @@ -189,7 +189,7 @@ def string_to_days_since_date(dateString, calendar='gregorian', Note: either underscores or spaces can be used to separate the date from the time portion of the string. - calendar: {'gregorian', 'gregorian_noleap'}, optional + calendar: {'gregorian', 'noleap'}, optional The name of one of the calendars supported by MPAS cores referenceDate : str, optional @@ -232,14 +232,14 @@ def string_to_days_since_date(dateString, calendar='gregorian', def days_to_datetime(days, calendar='gregorian', referenceDate='0001-01-01'): """ Covert days to ``datetime.datetime`` objects given a reference date and an - MPAS calendar (either 'gregorian' or 'gregorian_noleap'). + MPAS calendar (either 'gregorian' or 'noleap'). Parameters ---------- days : float or array-like of floats The number of days since the reference date. - calendar : {'gregorian', 'gregorian_noleap'}, optional + calendar : {'gregorian', 'noleap'}, optional A calendar to be used to convert days to a ``datetime.datetime`` object. @@ -293,7 +293,7 @@ def datetime_to_days(dates, calendar='gregorian', referenceDate='0001-01-01'): The date(s) to be converted to days since ``referenceDate`` on the given ``calendar``. - calendar : {'gregorian', 'gregorian_noleap'}, optional + calendar : {'gregorian', 'noleap'}, optional A calendar to be used to convert days to a ``datetime.datetime`` object. referenceDate : str, optional @@ -342,7 +342,7 @@ def date_to_days(year=1, month=1, day=1, hour=0, minute=0, second=0, The date to be converted to days since ``referenceDate`` on the given ``calendar``. - calendar : {'gregorian', 'gregorian_noleap'}, optional + calendar : {'gregorian', 'noleap'}, optional A calendar to be used to convert days to a ``datetime.datetime`` object. @@ -469,7 +469,7 @@ def _mpas_to_netcdf_calendar(calendar): if calendar == 'gregorian_noleap': calendar = 'noleap' - elif calendar != 'gregorian': + if calendar not in ['gregorian', 'noleap']: raise ValueError('Unsupported calendar {}'.format(calendar)) return calendar diff --git a/mpas_analysis/test/test_climatology.py b/mpas_analysis/test/test_climatology.py index 98f251cca..f9053644d 100644 --- a/mpas_analysis/test/test_climatology.py +++ b/mpas_analysis/test/test_climatology.py @@ -197,7 +197,7 @@ def test_get_observations_remapper(self): def test_compute_climatology(self): config = self.setup_config() - calendar = 'gregorian_noleap' + calendar = 'noleap' ds = self.open_test_ds(config, calendar) assert('month' not in ds.coords.keys()) @@ -237,7 +237,7 @@ def test_compute_climatology(self): def test_compute_monthly_climatology(self): config = self.setup_config() - calendar = 'gregorian_noleap' + calendar = 'noleap' ds = self.open_test_ds(config, calendar) monthlyClimatology = compute_monthly_climatology(ds, calendar) diff --git a/mpas_analysis/test/test_generalized_reader.py b/mpas_analysis/test/test_generalized_reader.py index 296cba8d1..93aaeeec5 100644 --- a/mpas_analysis/test/test_generalized_reader.py +++ b/mpas_analysis/test/test_generalized_reader.py @@ -56,7 +56,7 @@ def test_variableMap(self): 'refBottomDepth', 'daysSinceStartOfSim'] config = self.setup_config() - for calendar in ['gregorian', 'gregorian_noleap']: + for calendar in ['gregorian', 'noleap']: # preprocess_mpas will use variableMap to map the variable names # from their values in the file to the desired values in # variableList @@ -80,7 +80,7 @@ def test_open_dataset_fn(self): ['time_avg_avgValueWithinOceanRegion_avgSurfaceTemperature'] config = self.setup_config() - for calendar in ['gregorian', 'gregorian_noleap']: + for calendar in ['gregorian', 'noleap']: ds = open_multifile_dataset( fileNames=fileName, calendar=calendar, @@ -97,7 +97,7 @@ def test_start_end(self): ['time_avg_avgValueWithinOceanRegion_avgSurfaceTemperature'] config = self.setup_config() - for calendar in ['gregorian', 'gregorian_noleap']: + for calendar in ['gregorian', 'noleap']: # all dates ds = open_multifile_dataset( fileNames=fileName, diff --git a/mpas_analysis/test/test_mpas_climatology_task/mpas-o_in b/mpas_analysis/test/test_mpas_climatology_task/mpas-o_in index 0d8ba89a3..6896f1efe 100644 --- a/mpas_analysis/test/test_mpas_climatology_task/mpas-o_in +++ b/mpas_analysis/test/test_mpas_climatology_task/mpas-o_in @@ -2,7 +2,7 @@ config_ocean_run_mode = 'forward' / &time_management - config_calendar_type = 'gregorian_noleap' + config_calendar_type = 'noleap' config_do_restart = .true. config_restart_timestamp_name = 'rpointer.ocn' config_start_time = 'file' diff --git a/mpas_analysis/test/test_mpas_xarray.py b/mpas_analysis/test/test_mpas_xarray.py index 5f3716180..71f916591 100644 --- a/mpas_analysis/test/test_mpas_xarray.py +++ b/mpas_analysis/test/test_mpas_xarray.py @@ -29,7 +29,7 @@ class TestMpasXarray(TestCase): def test_subset_variables(self): fileName = str(self.datadir.join('example_jan.nc')) - calendar = 'gregorian_noleap' + calendar = 'noleap' timestr = ['xtime_start', 'xtime_end'] variableList = \ ['time_avg_avgValueWithinOceanRegion_avgSurfaceTemperature'] @@ -63,7 +63,7 @@ def test_subset_variables(self): def test_iselvals(self): fileName = str(self.datadir.join('example_jan.nc')) - calendar = 'gregorian_noleap' + calendar = 'noleap' simulationStartTime = '0001-01-01' timestr = 'time_avg_daysSinceStartOfSim' variableList = \ @@ -93,7 +93,7 @@ def test_iselvals(self): def test_no_units(self): fileName = str(self.datadir.join('example_no_units_jan.nc')) - calendar = 'gregorian_noleap' + calendar = 'noleap' simulationStartTime = '0001-01-01' timestr = 'time_avg_daysSinceStartOfSim' variableList = \ @@ -117,7 +117,7 @@ def test_no_units(self): def test_bad_selvals(self): fileName = str(self.datadir.join('example_jan.nc')) - calendar = 'gregorian_noleap' + calendar = 'noleap' simulationStartTime = '0001-01-01' timestr = 'time_avg_daysSinceStartOfSim' variableList = \ @@ -138,7 +138,7 @@ def test_bad_selvals(self): def test_selvals(self): fileName = str(self.datadir.join('example_jan.nc')) - calendar = 'gregorian_noleap' + calendar = 'noleap' simulationStartTime = '0001-01-01' timestr = 'time_avg_daysSinceStartOfSim' variableList = \ @@ -172,7 +172,7 @@ def test_selvals(self): def test_remove_repeated_time_index(self): fileName = str(self.datadir.join('example_jan*.nc')) - calendar = 'gregorian_noleap' + calendar = 'noleap' timestr = ['xtime_start', 'xtime_end'] variableList = \ ['time_avg_avgValueWithinOceanRegion_avgSurfaceTemperature'] diff --git a/mpas_analysis/test/test_namelist_streams_interface.py b/mpas_analysis/test/test_namelist_streams_interface.py index 98af81974..873320210 100644 --- a/mpas_analysis/test/test_namelist_streams_interface.py +++ b/mpas_analysis/test/test_namelist_streams_interface.py @@ -69,7 +69,7 @@ def test_read_streamsfile(self): files = self.sf.readpath('output', startDate='0001-01-02', endDate='0001-12-30', - calendar='gregorian_noleap') + calendar='noleap') expectedFiles = [] for date in ['0001-01-02', '0001-02-01']: expectedFiles.append('{}/output/output.{}_00.00.00.nc' @@ -78,7 +78,7 @@ def test_read_streamsfile(self): files = self.sf.readpath('output', startDate='0001-01-02', - calendar='gregorian_noleap') + calendar='noleap') expectedFiles = [] for date in ['0001-01-02', '0001-02-01', '0002-01-01']: expectedFiles.append('{}/output/output.{}_00.00.00.nc' @@ -87,7 +87,7 @@ def test_read_streamsfile(self): files = self.sf.readpath('output', endDate='0001-12-30', - calendar='gregorian_noleap') + calendar='noleap') expectedFiles = [] for date in ['0001-01-01', '0001-01-02', '0001-02-01']: expectedFiles.append('{}/output/output.{}_00.00.00.nc' @@ -97,7 +97,7 @@ def test_read_streamsfile(self): files = self.sf.readpath('restart', startDate='0001-01-01', endDate='0001-12-31', - calendar='gregorian_noleap') + calendar='noleap') expectedFiles = [] for seconds in ['00010', '00020']: expectedFiles.append('{}/restarts/restart.0001-01-01_{}.nc' @@ -111,6 +111,6 @@ def test_read_streamsfile(self): files = self.sf.readpath('mesh', startDate='0001-01-01', endDate='0001-12-31', - calendar='gregorian_noleap') + calendar='noleap') expectedFiles = ['{}/mesh.nc'.format(self.sf.streamsdir)] self.assertEqual(files, expectedFiles) diff --git a/mpas_analysis/test/test_namelist_streams_interface/namelist.ocean b/mpas_analysis/test/test_namelist_streams_interface/namelist.ocean index e51e9e314..c4685f1a9 100644 --- a/mpas_analysis/test/test_namelist_streams_interface/namelist.ocean +++ b/mpas_analysis/test/test_namelist_streams_interface/namelist.ocean @@ -8,7 +8,7 @@ config_start_time = '0000-01-01_00:00:00' config_stop_time = 'none' config_run_duration = '1000_00:00:00' - config_calendar_type = 'gregorian_noleap' + config_calendar_type = 'noleap' / &time_integration config_dt = '00:10:00' diff --git a/mpas_analysis/test/test_open_mpas_dataset.py b/mpas_analysis/test/test_open_mpas_dataset.py index d24293cc8..953b324a2 100644 --- a/mpas_analysis/test/test_open_mpas_dataset.py +++ b/mpas_analysis/test/test_open_mpas_dataset.py @@ -29,7 +29,7 @@ def test_open_dataset_fn(self): variableList = \ ['time_avg_avgValueWithinOceanRegion_avgSurfaceTemperature'] - for calendar in ['gregorian', 'gregorian_noleap']: + for calendar in ['gregorian', 'noleap']: ds = open_mpas_dataset( fileName=fileName, calendar=calendar, @@ -43,7 +43,7 @@ def test_start_end(self): variableList = \ ['time_avg_avgValueWithinOceanRegion_avgSurfaceTemperature'] - for calendar in ['gregorian', 'gregorian_noleap']: + for calendar in ['gregorian', 'noleap']: # all dates ds = open_mpas_dataset( fileName=fileName, @@ -76,7 +76,7 @@ def test_start_end(self): def test_open_process_climatology(self): fileName = str(self.datadir.join('timeSeries.nc')) - calendar = 'gregorian_noleap' + calendar = 'noleap' open_mpas_dataset( fileName=fileName, calendar=calendar, diff --git a/mpas_analysis/test/test_remap_obs_clim_subtask/mpas-o_in b/mpas_analysis/test/test_remap_obs_clim_subtask/mpas-o_in index 0d8ba89a3..6896f1efe 100644 --- a/mpas_analysis/test/test_remap_obs_clim_subtask/mpas-o_in +++ b/mpas_analysis/test/test_remap_obs_clim_subtask/mpas-o_in @@ -2,7 +2,7 @@ config_ocean_run_mode = 'forward' / &time_management - config_calendar_type = 'gregorian_noleap' + config_calendar_type = 'noleap' config_do_restart = .true. config_restart_timestamp_name = 'rpointer.ocn' config_start_time = 'file' diff --git a/mpas_analysis/test/test_timekeeping.py b/mpas_analysis/test/test_timekeeping.py index 00abfd1d9..52952f495 100644 --- a/mpas_analysis/test/test_timekeeping.py +++ b/mpas_analysis/test/test_timekeeping.py @@ -40,7 +40,7 @@ def test_timekeeping(self): # YYYY-MM-DD # SSSSS - for calendar in ['gregorian', 'gregorian_noleap']: + for calendar in ['gregorian', 'noleap']: # test datetime.datetime # YYYY-MM-DD_hh:mm:ss date1 = string_to_datetime('0001-01-01_00:00:00') @@ -136,7 +136,7 @@ def test_MpasRelativeDeltaOps(self): # also, test addition and subtraction of the form # datetime.datetime +/- MpasRelativeDelta above # both calendars with adding one day - for calendar, expected in zip(['gregorian', 'gregorian_noleap'], + for calendar, expected in zip(['gregorian', 'noleap'], ['2016-02-29', '2016-03-01']): self.assertEqual(string_to_datetime('2016-02-28') + string_to_relative_delta('0000-00-01', @@ -144,7 +144,7 @@ def test_MpasRelativeDeltaOps(self): string_to_datetime(expected)) # both calendars with subtracting one day - for calendar, expected in zip(['gregorian', 'gregorian_noleap'], + for calendar, expected in zip(['gregorian', 'noleap'], ['2016-02-29', '2016-02-28']): self.assertEqual(string_to_datetime('2016-03-01') - string_to_relative_delta('0000-00-01', @@ -152,7 +152,7 @@ def test_MpasRelativeDeltaOps(self): string_to_datetime(expected)) # both calendars with adding one month - for calendar, expected in zip(['gregorian', 'gregorian_noleap'], + for calendar, expected in zip(['gregorian', 'noleap'], ['2016-02-29', '2016-02-28']): self.assertEqual(string_to_datetime('2016-01-31') + string_to_relative_delta('0000-01-00', @@ -160,14 +160,14 @@ def test_MpasRelativeDeltaOps(self): string_to_datetime(expected)) # both calendars with subtracting one month - for calendar, expected in zip(['gregorian', 'gregorian_noleap'], + for calendar, expected in zip(['gregorian', 'noleap'], ['2016-02-29', '2016-02-28']): self.assertEqual(string_to_datetime('2016-03-31') - string_to_relative_delta('0000-01-00', calendar=calendar), string_to_datetime(expected)) - for calendar in ['gregorian', 'gregorian_noleap']: + for calendar in ['gregorian', 'noleap']: delta1 = string_to_relative_delta('0000-01-00', calendar=calendar) delta2 = string_to_relative_delta('0000-00-01', calendar=calendar) @@ -207,12 +207,12 @@ def test_MpasRelativeDeltaOps(self): delta1 = string_to_relative_delta('0000-01-00', calendar='gregorian') delta2 = string_to_relative_delta('0000-00-01', - calendar='gregorian_noleap') + calendar='noleap') deltaSum = delta1 + delta2 def test_string_to_days_since_date(self): referenceDate = '0001-01-01' - for calendar in ['gregorian', 'gregorian_noleap']: + for calendar in ['gregorian', 'noleap']: for dateString, expected_days in [('0001-01-01', 0.), ('0001-01-02', 1.), ('0001-02-01', 31.), @@ -224,7 +224,7 @@ def test_string_to_days_since_date(self): referenceDate = '2016-01-01' for calendar, expected_days in [('gregorian', 366.), - ('gregorian_noleap', 365.)]: + ('noleap', 365.)]: days = string_to_days_since_date(dateString='2017-01-01', calendar=calendar, referenceDate=referenceDate) @@ -232,7 +232,7 @@ def test_string_to_days_since_date(self): def test_days_to_datetime(self): referenceDate = '0001-01-01' - for calendar in ['gregorian', 'gregorian_noleap']: + for calendar in ['gregorian', 'noleap']: for dateString, days in [('0001-01-01', 0.), ('0001-01-02', 1.), ('0001-02-01', 31.), @@ -244,7 +244,7 @@ def test_days_to_datetime(self): referenceDate = '2016-01-01' for calendar, days in [('gregorian', 366.), - ('gregorian_noleap', 365.)]: + ('noleap', 365.)]: datetime = days_to_datetime(days=days, calendar=calendar, referenceDate=referenceDate) @@ -252,7 +252,7 @@ def test_days_to_datetime(self): def test_datetime_to_days(self): referenceDate = '0001-01-01' - for calendar in ['gregorian', 'gregorian_noleap']: + for calendar in ['gregorian', 'noleap']: for dateString, expected_days in [('0001-01-01', 0.), ('0001-01-02', 1.), ('0001-02-01', 31.), @@ -264,7 +264,7 @@ def test_datetime_to_days(self): referenceDate = '2016-01-01' for calendar, expected_days in [('gregorian', 366.), - ('gregorian_noleap', 365.)]: + ('noleap', 365.)]: days = datetime_to_days(dates=string_to_datetime('2017-01-01'), calendar=calendar, referenceDate=referenceDate) @@ -272,7 +272,7 @@ def test_datetime_to_days(self): def test_date_to_days(self): referenceDate = '0001-01-01' - for calendar in ['gregorian', 'gregorian_noleap']: + for calendar in ['gregorian', 'noleap']: days = date_to_days(year=1, month=1, day=1, calendar=calendar, referenceDate=referenceDate) self.assertApproxEqual(days, 0.) @@ -288,7 +288,7 @@ def test_date_to_days(self): referenceDate = '2016-01-01' for calendar, expected_days in [('gregorian', 366.), - ('gregorian_noleap', 365.)]: + ('noleap', 365.)]: days = date_to_days(year=2017, month=1, day=1, calendar=calendar, referenceDate=referenceDate)