Skip to content
Draft
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
49 changes: 49 additions & 0 deletions src/ccdtools/config/datasets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,30 @@ datasets:
- basal melt rates
- smb
- ice thickness
- paolo 2024
- NSIDC 0792
extension: nc

rema:
display_name: REMA
path: /g/data/av17/admin/staging/cryosphere-data-pool/elevation_geometry/rema
description: The Reference Elevation Model of Antarctica (REMA) is a high resolution, time-stamped Digital Surface Model (DSM) of Antarctica.
tags:
- antarctica
- surface elevation
- rema
extension: tif
doi:
v2: 10.7910/DVN/EBW8UC
resolutions:
v2:
static:
100m: 100m
500m: 500m
1000m: 1km
static_patterns:
v2: "rema_mosaic_"

# GEOSPTATIAL DATASETS
measures_antarctic_boundaries:
display_name: Antarctic Boundaries for IPY 2007-2009 from Satellite Radar
Expand All @@ -133,6 +155,9 @@ datasets:
- grounding line
- ice front
- ice mask
- NSIDC 0709
- boundaries
- drainage basins
extension: shp
doi:
v1: 10.5067/SEVV4MR8P1ZN
Expand Down Expand Up @@ -198,6 +223,30 @@ datasets:
50km: "50"
static_patterns:
v1: "aq1_01_"

annual_ice_shelves_mass_balance:
doi: 10.5281/zenodo.8052519
display_name: Annual mass budget of Antarctic ice shelves from 1997 to 2021
path: /g/data/av17/admin/staging/cryosphere-data-pool/basal_forcing/ice_shelves_annual_mass_balance_1997_2021
description: Sub-ice shelf basal melt rates, masks, and basal mass balance timeseries from Davison et al. 2023.
tags:
- antarctica
- basal melt rates
- davison 2023
ignore_dirs:
- code
subdatasets:
v1:
melt_rate:
subpath: data/basal_melt
extension: tif
masks:
subpath: data/masks/merged
extension: shp
timeseries:
subpath: data/basal_melt/timeseries/csv_outputs
extension: csv
loader: davison_timeseries

# ICE VELOCITY DATASETS
measures_annual_antarctic_ice_velocity_maps:
Expand Down
40 changes: 40 additions & 0 deletions src/ccdtools/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from datetime import datetime
import re
import warnings
import pathlib

def default(self, row, resolution = None, static = True, **kwargs):
"""
Expand Down Expand Up @@ -532,4 +533,43 @@ def _preprocessor(ds):
"for timesteps where a given variable does not have data. Users should use caution when considering\n"
"time-varying analysis and might consider 'trimming' data to isolate all non-NaN arrays for a given variable.")

return output

def davison_timeseries(self, row, **kwargs):

# Extract parameters from row
path, ext, skip_lines, no_data, ignore_dirs, ignore_files, loader, resolutions, static_patterns = self._extract_row_params(row)

# Normalise lists as needed
ignore_dirs = self._normalise_list(ignore_dirs)
ignore_files = self._normalise_list(ignore_files)

# Find files
files = self._recursive_find_files(path, ext, ignore_dirs = ignore_dirs, ignore_files = ignore_files)

# Set low_memory option
low_memory = kwargs.pop("low_memory", False)

# Empty lisy to store all files
data_list = []

# Loop over files, read them in, append them to list, and strip ice shelf name
for f in files:
# Extract name before "-timeseries.csv"
name = pathlib.Path(f).stem.replace("-timeseries", "")

data = pd.read_csv(f, skiprows = skip_lines, low_memory = low_memory, index_col = 0, **kwargs)

# Add new column with extracted name as the first colum
data.insert(0, "shelf_name", name)

data_list.append(data)

# Concatenate all CSVs
output = pd.concat(data_list, ignore_index=True)

# Replace no_data values
if no_data is not None:
output = output.replace(no_data, np.nan)

return output
Loading