Skip to content

Commit

Permalink
Add read_trpdataset as alias
Browse files Browse the repository at this point in the history
Meng's original func name
  • Loading branch information
zmoon committed Sep 17, 2024
1 parent 8fee18c commit 626b95c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
14 changes: 13 additions & 1 deletion monetio/sat/_tropomi_l2_no2_mm.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import logging
import os
import sys
import warnings
from collections import OrderedDict
from datetime import datetime
from glob import glob
Expand Down Expand Up @@ -195,7 +196,8 @@ def apply_quality_flag(ds):


def open_dataset(fnames, variable_dict, debug=False):
"""
"""Open one or more TROPOMI L2 NO2 files.
Parameters
----------
fnames : str
Expand Down Expand Up @@ -259,3 +261,13 @@ def open_dataset(fnames, variable_dict, debug=False):
granules[key] = [granule]

return granules


def read_trpdataset(*args, **kwargs):
"""Alias for :func:`open_dataset`."""
warnings.warn(
"read_trpdataset is an alias for open_dataset and may be removed in the future",
FutureWarning,
stacklevel=2,
)
return open_dataset(*args, **kwargs)
6 changes: 5 additions & 1 deletion tests/test_tropomi_l2.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import pytest
from filelock import FileLock

from monetio.sat._tropomi_l2_no2_mm import open_dataset
from monetio.sat._tropomi_l2_no2_mm import open_dataset, read_trpdataset

HERE = Path(__file__).parent

Expand Down Expand Up @@ -63,6 +63,10 @@ def test_open_dataset(test_file_path):

ds = open_dataset(test_file_path, vn)[KEY][0]

with pytest.warns(FutureWarning, match="read_trpdataset is an alias"):
ds_alias = read_trpdataset(test_file_path, vn)[KEY][0]
assert ds_alias.identical(ds)

assert set(ds.coords) == {"time", "lat", "lon", "scan_time"}
assert set(ds) == {vn}

Expand Down

0 comments on commit 626b95c

Please sign in to comment.