Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ data/3369779
data/3369779.mat
data/mocha_mht_data_ERA5_v2020.nc

data/Q_ARGO_obs_dens_2000depth_ERA5*.nc
data/trans_ARGO_ERA5*.nc
data/Q_ARGO_obs_dens_2000depth_ERA5.nc
data/trans_ARGO_ERA5.nc

data/2d_gridded.nc
data/Johns_2023_mht_data_2020_ERA5.zip
Expand Down
43 changes: 9 additions & 34 deletions amocatlas/data_sources/wh41n.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

import xarray as xr
import datetime
import pandas
from pandas.errors import EmptyDataError, ParserError

# Import the modules used
from amocatlas import logger, utilities
Expand All @@ -32,11 +30,11 @@
"Q_ARGO_obs_dens_2000depth_ERA5.nc",
]
A41N_TRANSPORT_FILES = ["hobbs_willis_amoc41N_tseries.txt"]
A41N_DEFAULT_SOURCE = "https://zenodo.org/records/18238115/files/"
A41N_DEFAULT_SOURCE = "https://zenodo.org/records/14681441/files/"

A41N_METADATA = {
"project": "Atlantic Meridional Overturning Circulation Near 41N from Altimetry and Argo Observations",
"weblink": "https://zenodo.org/records/18238115",
"weblink": "https://zenodo.org/records/14681441",
"comment": "Dataset accessed and processed via http://github.com/AMOCcommunity/amocatlas",
"acknowledgement": "This study has been conducted using E.U. Copernicus Marine Service Information; https://doi.org/10.48670/moi-00149 and https://doi.org/10.48670/moi-00148. These data were collected and made freely available by the International Argo Program and the national programs that contribute to it. (https://argo.ucsd.edu, https://www.ocean-ops.org). The Argo Program is part of the Global Ocean Observing System.",
"doi": "10.5281/zenodo.8170365",
Expand Down Expand Up @@ -158,14 +156,16 @@ def read_41n(
f"Converting YYYYMM time format to datetime for {file}"
)

import pandas as pd

# Convert YYYYMM to datetime
yyyymm_values = time_data.values
datetime_values = []
for yyyymm in yyyymm_values:
year = yyyymm // 100
month = yyyymm % 100
# Use 15th of month as representative date
dt = pandas.Timestamp(year=year, month=month, day=15)
dt = pd.Timestamp(year=year, month=month, day=15)
datetime_values.append(dt)

# Replace time coordinate with TIME and convert to standard format
Expand All @@ -182,45 +182,20 @@ def read_41n(
}
)
else:
# file .txt - handle both old format (with % comments) and new CSV format
# file .txt
try:
column_names, _ = utilities.parse_ascii_header(
file_path, comment_char="%"
)
df = utilities.read_ascii_file(file_path, comment_char="%")

if column_names:
# Old format with % comment headers - use parsed column names
df.columns = column_names
else:
# New CSV format (v5) - file starts directly with header line
# Re-read as proper CSV to get correct column parsing
df = pandas.read_csv(file_path)
# Ensure we have the expected 5 columns
expected_columns = [
"Decimal year",
"Ekman (Sv)",
"Geos (Sv)",
"MOC (Sv)",
"MOC (PW)",
]
if len(df.columns) == len(expected_columns):
df.columns = expected_columns
else:
log_error(
"Unexpected number of columns (%d) in CSV file %s",
len(df.columns),
file,
)
# Use expected columns anyway as fallback
df.columns = expected_columns[: len(df.columns)]
df.columns = column_names
except (
OSError,
IOError,
ValueError,
KeyError,
EmptyDataError,
ParserError,
pd.errors.EmptyDataError,
pd.errors.ParserError,
) as e:
log_error("Failed to parse ASCII file: %s: %s", file_path, e)
raise FileNotFoundError(
Expand Down
2 changes: 1 addition & 1 deletion amocatlas/metadata/noac47n.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
comment: "Dataset accessed and processed via http://github.com/AMOCcommunity/amocatlas"
references: >
Wett, S., Rhein, M., Kieke, D., Mertens, C., & Moritz, M. (2023). Meridional connectivity of a 25-year observational AMOC record at 47°N. Geophysical Research Letters, 50, e2023GL103284. https://doi.org/10.1029/2023GL103284
license: CC-BY-4.0 # Based on feedback from Christian Mertens on 2026-02-10
license:
citation: >
Wett, Simon; Rhein, Monika; Kieke, Dagmar; Mertens, Christian; Moritz, Martin; Nowitzki, Hannah (2023): Basin-wide AMOC volume transport from the NOAC array at 47°N in the subpolar North Atlantic (1993-2018) [dataset]. PANGAEA, https://doi.org/10.1594/PANGAEA.959558
featureType: "timeSeries"
Expand Down
38 changes: 3 additions & 35 deletions amocatlas/metadata/wh41n.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,52 +6,20 @@ metadata:
comment: Dataset accessed and processed via http://github.com/AMOCcommunity/amocatlas
citation: >
Willis, J. K., and Hobbs, W. R., Atlantic Meridional Overturning Circulation Near 41N from Altimetry and Argo Observations. Dataset accessed at 10.5281/zenodo.8170366.
license: CC-BY-4.0 # Based on feedback from Josh Willis on 2026-02-10
license:
Conventions: CF-1.8, ACDD-1.3
time_coverage_start: '2002-02-15'
time_coverage_end: '2024-12-16'
platform_type: Argo floats
contributing_institutions: NASA JPL
source_url: https://doi.org/10.5281/zenodo.8170365

files:
hobbs_willis_amoc41N_tseries.txt:
version: "v5"
featureType: timeSeries
contributor_name: "Will Hobbs, Josh Willis"
contributor_role: "creator, PI"
data_product: "Atlantic Meridional Overturning Circulation Near 41N from Altimetry and Argo Observations"
variable_mapping:
"Ekman (Sv)": TRANS_EKMAN
"Geos (Sv)": TRANS_GEO
"MOC (Sv)": MOC
"MHT (PW)": MHT
original_variable_metadata:
"Ekman (Sv)":
long_name: "Ekman"
description: "Ekman Volume Transport"
units: Sverdrup
standard_name: ocean_volume_transport_across_line
"Geos (Sv)":
long_name: "Geostrophic Transport"
description: "Northward Geostrophic Transport"
units: Sverdrup
standard_name: ocean_volume_transport_across_line
"MOC (Sv)":
long_name: "MOC_z"
description: "Meridional Overturning Volume Transport"
units: Sverdrup
standard_name: ocean_meridional_overturning_transport
"MHT (PW)":
long_name: "MHT"
description: "Meridional Overturning Heat Transport"
units: PW
standard_name: northward_ocean_heat_transport

hobbs_willis_amoc41N_tseries_v2025_01.txt:
featureType: timeSeries
version: "v2025_01"
contributor_name: "Will Hobbs, Josh Willis"
contributor_role: "creator, PI"
data_product: "Atlantic Meridional Overturning Circulation Near 41N from Altimetry and Argo Observations"
variable_mapping:
"Ekman Volume Transport (Sverdrups)": TRANS_EKMAN
"Northward Geostrophic Transport (Sverdrups)": TRANS_GEO
Expand Down
18 changes: 6 additions & 12 deletions amocatlas/plotters.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,25 +137,19 @@ def format_units_for_plotting(units: str) -> str:
unit_mappings = {
"Sverdrup": "Sv",
"sverdrup": "Sv",
"degree_north": "°N",
"degrees_north": "°N",
"degree_south": "°S",
"degrees_south": "°S",
"degree_east": "°E",
"degrees_east": "°E",
"degree_west": "°W",
"degrees_west": "°W",
"degree_C": "°C",
"degree_celsius": "°C",
"degree_Celsius": "°C",
"degrees_Celsius": "°C",
"degrees_celsius": "°C",
"degree_Celsius": "°C",
"degree_celsius": "°C",
"degrees C": "°C",
"deg C": "°C",
"meters": "m",
"meter": "m",
"seconds": "s",
"m s-1": "m/s",
"Sverdrup/m": "Sv/m",
"second": "s",
"PetaWatts": "PW",
"petawatts": "PW",
Expand Down Expand Up @@ -621,7 +615,7 @@ def plot_amoc_timeseries(
units = da.attrs.get("units", "")
if units:
formatted_units = _format_units_for_plots(units)
ylabel = f"{label_text} ({formatted_units})"
ylabel = f"{label_text} [{formatted_units}]"
else:
ylabel = label_text

Expand Down Expand Up @@ -1491,7 +1485,7 @@ def plot_amoc_2d_data(
units = da.attrs.get("units", "")
if units:
formatted_units = _format_units_for_plots(units)
colorbar_label = f"{label_text} ({formatted_units})"
colorbar_label = f"{label_text} [{formatted_units}]"
else:
colorbar_label = label_text
im.colorbar.set_label(colorbar_label, fontsize=12)
Expand All @@ -1516,7 +1510,7 @@ def plot_amoc_2d_data(
units = vertical_var.attrs.get("units", "")
if units:
formatted_units = _format_units_for_plots(units)
ylabel += f" ({formatted_units})"
ylabel += f" [{formatted_units}]"
except KeyError:
# Coordinate doesn't exist in dataset, use dimension name as fallback
ylabel = format_variable_name_for_plotting(vertical_coord.title())
Expand Down
6 changes: 2 additions & 4 deletions amocatlas/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ def generate_plot(dataset: xr.Dataset, dataset_name: str) -> Optional[str]:
plots_dir.mkdir(parents=True, exist_ok=True)

# Generate base filename (clean dataset name for filename)
clean_name = dataset_name.replace(" ", "_").replace(".nc", "").lower()
clean_name = dataset_name.replace(" ", "_").replace(".nc", "")

# Find 1-dimensional time series variables indexed against time
data_vars = list(dataset.data_vars.keys())
Expand Down Expand Up @@ -1646,9 +1646,7 @@ def _generate_plot(self) -> Optional[str]:
plots_dir.mkdir(parents=True, exist_ok=True)

# Generate plot filename
plot_filename = (
f"{self.dataset_name.replace(' ', '_').lower()}_timeseries.png"
)
plot_filename = f"{self.dataset_name}_timeseries.png"
plot_path = plots_dir / plot_filename

# Try to find a suitable variable for plotting (prefer MOC variables)
Expand Down
Loading