Commit 98da489e authored by PIOLLE's avatar PIOLLE
Browse files

added class for TUM's Jason WHALES output variant

parent cacf1af9
......@@ -13,6 +13,7 @@ import numpy as np
from cerbere.dataset.dataset import Dataset
DEFAULT_TIME_UNITS = "seconds since 2000-01-01 00:00:00.0"
JASON_TIME_UNITS = "days since 2000-01-01 12:00:00"
class WHALESNCDataset(Dataset):
......@@ -69,3 +70,34 @@ class SARALvTWHALESNCDataset(WHALESNCDataset):
elif fieldname != 'time':
values =, 1e19, copy=False)
return values
class JASONWHALESNCDataset(Dataset):
"""WHALES Retracker NetCDF Dataset for Jason-x data
time_units: time units (not provided in WHALES output files)
def __init__(self, *args, time_units: str = DEFAULT_TIME_UNITS, **kwargs):
self.time_units = time_units
return super(JASONWHALESNCDataset, self).__init__(
'time_20hz': 'time', 'glat.00': 'lat', 'glon.00': 'lon',
'swh.07': 'swh_WHALES_20hz',
'stdalt.07': 'swh_WHALES_fitting_error_20hz',
'swhinstrcorr.07': 'swh_WHALES_instr_corr_20hz',
def _transform(self):
self._std_dataset['time'] = xr.DataArray(
self._std_dataset['jday.00'].values, 0, copy=False)
self._std_dataset['time'].attrs['units'] = JASON_TIME_UNITS
self._std_dataset = xr.decode_cf(self._std_dataset)
self._std_dataset = self._std_dataset.drop('jday.00')
return super(JASONWHALESNCDataset, self)._transform()
\ No newline at end of file
......@@ -34,6 +34,7 @@ setup(
'cerbere.plugins': [
'WHALESNCDataset = cerberecontrib_whales.dataset.whalesncdataset:WHALESNCDataset',
'SARALvTWHALESNCDataset = cerberecontrib_whales.dataset.whalesncdataset:SARALvTWHALESNCDataset',
'JASONWHALESNCDataset = cerberecontrib_whales.dataset.whalesncdataset:JASONWHALESNCDataset',
Test class for cerbere WHALESNCDataset class, WHALES output from
AVISO JASON Version T SGDR products.
:copyright: Copyright 2020 Ifremer / Cersat.
:license: Released under GPL v3 license, see :ref:`license`.
.. sectionauthor:: Jeff Piolle <>
.. codeauthor:: Jeff Piolle <>
import unittest
from tests.checker import Checker
class JASONWHALESNCDatasetChecker(Checker, unittest.TestCase):
"""Test class for WHALESNCDataset files"""
def __init__(self, methodName="runTest"):
super(JASONWHALESNCDatasetChecker, self).__init__(methodName)
def dataset(cls):
"""Return the mapper class name"""
return 'JASONWHALESNCDataset'
def feature(cls):
"""Return the related feature class name"""
return 'Trajectory'
def test_file(cls):
"""Return the name of the test file for this test"""
return ""
def download_url(cls):
"""Return the URL of the data test repository where to get the test
return ""
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment