Skip to content

Commit

Permalink
Merge pull request #1002 from MPAS-Dev/develop
Browse files Browse the repository at this point in the history
Merge develop into main
  • Loading branch information
xylar authored Apr 30, 2024
2 parents 79bc218 + e57f81c commit ab83cbc
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 16 deletions.
6 changes: 3 additions & 3 deletions ci/recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% set name = "MPAS-Analysis" %}
{% set version = "1.10.0" %}
{% set version = "1.11.0rc1" %}

package:
name: {{ name|lower }}
Expand Down Expand Up @@ -27,7 +27,7 @@ requirements:
- cartopy_offlinedata
- cmocean
- dask
- esmf >=8.4.2,<8.5.0
- esmf >=8.4.2,<8.7.0
- esmf=*=mpi_mpich_*
- f90nml
- geometric_features >=1.2.0
Expand All @@ -46,7 +46,7 @@ requirements:
- pyremap >=1.2.0,<2.0.0
- python-dateutil
- requests
- scipy
- scipy >=1.7.0
- setuptools
- shapely >=2.0,<3.0
- xarray >=0.14.1
Expand Down
4 changes: 2 additions & 2 deletions dev-spec.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ cartopy >=0.18.0
cartopy_offlinedata
cmocean
dask
esmf >=8.4.0,<8.5.0
esmf >=8.4.2,<8.7.0
esmf=*=mpi_mpich_*
f90nml
geometric_features>=1.2.0
Expand All @@ -29,7 +29,7 @@ pyproj
pyremap>=1.2.0,<2.0.0
python-dateutil
requests
scipy
scipy >=1.7.0
setuptools
shapely>=2.0,<3.0
xarray>=0.14.1
Expand Down
3 changes: 3 additions & 0 deletions docs/versions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Documentation On GitHub
`v1.8.0`_ `1.8.0`_
`v1.9.0`_ `1.9.0`_
`v1.10.0`_ `1.10.0`_
`v1.11.0`_ `1.11.0`_
================ ===============

.. _`stable`: ../stable/index.html
Expand All @@ -40,6 +41,7 @@ Documentation On GitHub
.. _`v1.8.0`: ../1.8.0/index.html
.. _`v1.9.0`: ../1.9.0/index.html
.. _`v1.10.0`: ../1.10.0/index.html
.. _`v1.11.0`: ../1.11.0/index.html
.. _`main`: https://github.com/MPAS-Dev/MPAS-Analysis/tree/main
.. _`develop`: https://github.com/MPAS-Dev/MPAS-Analysis/tree/develop
.. _`1.2.6`: https://github.com/MPAS-Dev/MPAS-Analysis/tree/1.2.6
Expand All @@ -57,3 +59,4 @@ Documentation On GitHub
.. _`1.8.0`: https://github.com/MPAS-Dev/MPAS-Analysis/tree/1.8.0
.. _`1.9.0`: https://github.com/MPAS-Dev/MPAS-Analysis/tree/1.9.0
.. _`1.10.0`: https://github.com/MPAS-Dev/MPAS-Analysis/tree/1.10.0
.. _`1.11.0`: https://github.com/MPAS-Dev/MPAS-Analysis/tree/1.11.0
2 changes: 1 addition & 1 deletion mpas_analysis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
import matplotlib as mpl
mpl.use('Agg')

__version_info__ = (1, 10, 0)
__version_info__ = (1, 11, 0)
__version__ = '.'.join(str(vi) for vi in __version_info__)
3 changes: 3 additions & 0 deletions mpas_analysis/default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3970,6 +3970,9 @@ areaSH = IceArea_timeseries/iceAreaSH_climo_20180710.nc
volNH = PIOMAS/PIOMASvolume_monthly_climo_20180710.nc
volSH = none

# mask sea ice that is thicker than this a threshold (m)
maxAllowedSeaIceThickness = None


[climatologyMapSeaIceProductionNH]
# options related to plotting horizontally remapped climatologies of
Expand Down
3 changes: 2 additions & 1 deletion mpas_analysis/ocean/index_nino34.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import pandas as pd
import numpy as np
from scipy import signal, stats
from scipy.signal.windows import tukey
import matplotlib.pyplot as plt

from mpas_analysis.shared.climatology import climatology
Expand Down Expand Up @@ -400,7 +401,7 @@ def _compute_nino34_spectra(self, nino34Index):

# Move nino34Index to numpy to allow functionality with scipy routines
ninoIndex = nino34Index.values
window = signal.tukey(len(ninoIndex), alpha=0.1)
window = tukey(len(ninoIndex), alpha=0.1)
f, Pxx = signal.periodogram(window * ninoIndex,
1.0 / constants.sec_per_month)

Expand Down
27 changes: 22 additions & 5 deletions mpas_analysis/sea_ice/time_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# distributed with this code, or at
# https://raw.githubusercontent.com/MPAS-Dev/MPAS-Analysis/main/LICENSE

import numpy as np
import xarray as xr

from mpas_analysis.shared import AnalysisTask
Expand Down Expand Up @@ -590,6 +591,14 @@ def _compute_area_vol(self):
config = self.config
chunkYears = config.getint('timeSeriesSeaIceAreaVol', 'chunkYears')

maxAllowedSeaIceThickness = config.get(
'timeSeriesSeaIceAreaVol', 'maxAllowedSeaIceThickness')

if maxAllowedSeaIceThickness == 'None':
maxAllowedSeaIceThickness = None
else:
maxAllowedSeaIceThickness = float(maxAllowedSeaIceThickness)

outFileNames = {}
for hemisphere in ['NH', 'SH']:
baseDirectory = build_config_full_path(
Expand All @@ -612,6 +621,10 @@ def _compute_area_vol(self):
startDate=self.startDate,
endDate=self.endDate)

ds = ds.rename(
{'timeMonthly_avg_iceAreaCell': 'iceConc',
'timeMonthly_avg_iceVolumeCell': 'iceThick'})

nTime = ds.sizes['Time']
# chunk into 10-year seguments so we don't run out of memory
if nTime > 12 * chunkYears:
Expand All @@ -624,22 +637,26 @@ def _compute_area_vol(self):
else:
mask = dsMesh.latCell < 0

if maxAllowedSeaIceThickness is not None:
mask = np.logical_and(mask,
ds.iceThick <= maxAllowedSeaIceThickness)

dsAreaSum = (ds.where(mask) * dsMesh.areaCell).sum('nCells')
dsAreaSum = dsAreaSum.rename(
{'timeMonthly_avg_iceAreaCell': 'iceArea',
'timeMonthly_avg_iceVolumeCell': 'iceVolume'})
{'iceConc': 'iceArea',
'iceThick': 'iceVolume'})
dsAreaSum['iceThickness'] = (dsAreaSum.iceVolume /
dsMesh.areaCell.sum('nCells'))

dsAreaSum['iceArea'].attrs['units'] = 'm$^2$'
dsAreaSum['iceArea'].attrs['description'] = \
'Total {} sea ice area'.format(hemisphere)
f'Total {hemisphere} sea ice area'
dsAreaSum['iceVolume'].attrs['units'] = 'm$^3$'
dsAreaSum['iceVolume'].attrs['description'] = \
'Total {} sea ice volume'.format(hemisphere)
f'Total {hemisphere} sea ice volume'
dsAreaSum['iceThickness'].attrs['units'] = 'm'
dsAreaSum['iceThickness'].attrs['description'] = \
'Mean {} sea ice volume'.format(hemisphere)
f'Mean {hemisphere} sea ice volume'

dsTimeSeries[hemisphere] = dsAreaSum

Expand Down
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
'pyproj',
'python-dateutil',
'requests',
'scipy',
'scipy>=1.7.0',
'setuptools',
'shapely>=2.0,<3.0',
'six',
Expand All @@ -41,9 +41,8 @@
with open(os.path.join(here, 'mpas_analysis', '__init__.py')) as f:
init_file = f.read()

# version = re.search(r'{}\s*=\s*[(]([^)]*)[)]'.format('__version_info__'),
# init_file).group(1).replace(', ', '.')
version = '1.10.0rc2'
version = re.search(r'{}\s*=\s*[(]([^)]*)[)]'.format('__version_info__'),
init_file).group(1).replace(', ', '.')

setup(name='mpas_analysis',
version=version,
Expand Down

0 comments on commit ab83cbc

Please sign in to comment.