Skip to content

Commit

Permalink
Improvements following review comments.
Browse files Browse the repository at this point in the history
Signed-off-by: Adam.Dybbroe <[email protected]>
  • Loading branch information
Adam.Dybbroe committed Jan 13, 2025
1 parent d4654d1 commit 0b9760c
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 22 deletions.
1 change: 1 addition & 0 deletions satpy/etc/composites/microwave.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sensor_name: microwave
2 changes: 1 addition & 1 deletion satpy/etc/composites/mwr.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sensor_name: mwr
sensor_name: microwave/mwr

composites:
mw183_humidity:
Expand Down
5 changes: 4 additions & 1 deletion satpy/etc/readers/aws1_mwr_l1b_nc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,10 @@ file_types:
aws_l1b_nc:
# W_XX-OHB-Unknown,SAT,1-AWS-1B-RAD_C_OHB_20230707124607_G_D_20220621090100_20220621090618_T_B____.nc
# W_XX-OHB-Stockholm,SAT,AWS1-MWR-1B-RAD_C_OHB_20230823161321_G_D_20240115111111_20240115125434_T_B____.nc
# W_NO-KSAT-Tromso,SAT,AWS1-MWR-1B-RAD_C_OHB__20250110134851_G_O_20250110114708_20250110132329_C_N____.nc
file_reader: !!python/name:satpy.readers.mwr_l1b.AWS_EPS_Sterna_MWR_L1BFile
file_patterns: [
'W_{country:2s}-{organisation:s}-{location:s},SAT,{platform_name}-MWR-1B-RAD_C_{originator:4s}_{processing_time:%Y%m%d%H%M%S}_G_D_{start_time:%Y%m%d%H%M%S}_{end_time:%Y%m%d%H%M%S}_{disposition_mode:1s}_{processing_mode:1s}____.nc'
'W_{country:2s}-{organisation:s}-{location:s},SAT,{platform_name}-MWR-1B-RAD_C_{originator:4s}_{processing_time:%Y%m%d%H%M%S}_G_D_{start_time:%Y%m%d%H%M%S}_{end_time:%Y%m%d%H%M%S}_{disposition_mode:1s}_{processing_mode:1s}____.nc',
'W_{country:2s}-{organisation:s}-{location:s},SAT,{platform_name}-MWR-1B-RAD_C_{originator:4s}_{processing_time:%Y%m%d%H%M%S}_G_O_{start_time:%Y%m%d%H%M%S}_{end_time:%Y%m%d%H%M%S}_{disposition_mode:1s}_{processing_mode:1s}____.nc'
]
feed_horn_group_name: n_geo_groups
1 change: 1 addition & 0 deletions satpy/etc/readers/eps_sterna_mwr_l1b_nc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -530,3 +530,4 @@ file_types:
file_patterns: [
'W_{country:2s}-{organisation:s}-{location:s},SAT,{platform_name}-MWR-1B-RAD_C_{originator:4s}_{processing_time:%Y%m%d%H%M%S}_G_D_{start_time:%Y%m%d%H%M%S}_{end_time:%Y%m%d%H%M%S}_{disposition_mode:1s}_{processing_mode:1s}____.nc'
]
feed_horn_group_name: n_feedhorns
54 changes: 36 additions & 18 deletions satpy/readers/mwr_l1b.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2023, 2024 Pytroll Developers
# Copyright (c) 2023 - 2025 Pytroll Developers

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -23,6 +23,36 @@
Sample EPS-Sterna l1b format AWS data from 16 orbits the 9th of November 2024.
Continous feed (though restricted to the SAG members and selected European
users/evaluators) in the EUMETSAT Data Store of global AWS data from January
9th, 2025.
Example:
--------
Here is an example how to read the data in satpy:
.. code-block:: python
from satpy import Scene
from glob import glob
filenames = glob("data/W_NO-KSAT-Tromso,SAT,AWS1-MWR-1B-RAD_C_OHB__*_G_O_20250110114708*.nc"
scn = Scene(filenames=filenames, reader='aws1_mwr_l1b_nc')
composites = ['mw183_humidity']
dataset_names = composites + ['1']
scn.load(dataset_names)
print(scn['1'])
scn.show('mw183_humidity')
As the file format for the EPS Sterna Level-1b is slightly different from the
ESA format, reading the EPS Sterna level-1b data uses a different reader, named
`eps_sterna_mwr_l1b_nc`. So, if specifying the reader name as in the above code
example, please provide the actual name for that data: eps_sterna_mwr_l1b_nc.
"""

import xarray as xr
Expand All @@ -46,7 +76,9 @@
"satellite_azimuth_horn1",
"satellite_azimuth_horn2",
"satellite_azimuth_horn3",
"satellite_azimuth_horn4"]
"satellite_azimuth_horn4",
"longitude",
"latitude"]

class AWS_EPS_Sterna_BaseFileHandler(NetCDF4FileHandler):
"""Base class implementing the AWS/EPS-Sterna MWR Level-1b&c Filehandlers."""
Expand Down Expand Up @@ -103,23 +135,12 @@ def _get_channel_data(self, dataset_id, dataset_info):


class AWS_EPS_Sterna_MWR_L1BFile(AWS_EPS_Sterna_BaseFileHandler):
"""Class implementing the AWS/EPS-Sterna MWR L1b Filehandler.
"""Class implementing the AWS/EPS-Sterna MWR L1b Filehandler."""

This class implements the ESA Arctic Weather Satellite (AWS) and EPS-Sterna
MWR Level-1b NetCDF reader. It is designed to be used through the
:class:`~satpy.Scene` class using the :mod:`~satpy.Scene.load` method with
the reader ``"mwr_l1b_nc"``.
"""
def __init__(self, filename, filename_info, filetype_info, auto_maskandscale=True):
"""Initialize the handler."""
super().__init__(filename, filename_info, filetype_info, auto_maskandscale)

if filetype_info["file_type"].startswith("eps_sterna"):
self._feed_horn_group_name = "n_feedhorns"
else:
self._feed_horn_group_name = "n_geo_groups"

self._feed_horn_group_name = filetype_info.get("feed_horn_group_name")

@property
def sub_satellite_longitude_start(self):
Expand Down Expand Up @@ -147,9 +168,6 @@ def get_dataset(self, dataset_id, dataset_info):
data_array = self._get_channel_data(dataset_id, dataset_info)
elif dataset_id["name"] in NAVIGATION_DATASET_NAMES:
data_array = self._get_navigation_data(dataset_id, dataset_info)

elif dataset_id["name"] in ["longitude", "latitude"]:
data_array = self._get_navigation_data(dataset_id, dataset_info)
else:
raise NotImplementedError(f"Dataset {dataset_id['name']} not available or not supported yet!")

Expand Down
25 changes: 24 additions & 1 deletion satpy/readers/mwr_l1c.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2024 Pytroll Developers
# Copyright (c) 2024 - 2025 Pytroll Developers

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -17,8 +17,31 @@
MWR = Microwave Radiometer, onboard AWS and EPS-Sterna
Sample data provided by ESA September 27, 2024.
Example:
--------
Here is an example how to read the data in satpy:
.. code-block:: python
from satpy import Scene
from glob import glob
filenames = glob("data/W_XX-OHB-Stockholm,SAT,AWS1-MWR-1C-RAD_C_OHB_*20240913204851_*.nc")
scn = Scene(filenames=filenames, reader='aws1_mwr_l1c_nc')
composites = ['mw183_humidity']
dataset_names = composites + ['1']
scn.load(dataset_names)
print(scn['1'])
scn.show('mw183_humidity')
"""


from satpy.readers.mwr_l1b import MWR_CHANNEL_NAMES, AWS_EPS_Sterna_BaseFileHandler, mask_and_scale


Expand Down
5 changes: 4 additions & 1 deletion satpy/tests/reader_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def random_date(start, end):
return start + dt.timedelta(seconds=random_second)


@pytest.fixture(scope="session")
@pytest.fixture(scope="module")
def fake_mwr_data_array():
"""Return a fake AWS/EPS-Sterna MWR l1b data array."""
fake_data_np = rng.integers(0, 700000, size=10*145*19).reshape((10, 145, 19))
Expand Down Expand Up @@ -194,6 +194,7 @@ def eps_sterna_mwr_handler(eps_sterna_mwr_file):
filename_info = parse(file_pattern, os.path.basename(eps_sterna_mwr_file))
filetype_info = dict()
filetype_info["file_type"] = "eps_sterna_mwr_l1b"
filetype_info["feed_horn_group_name"] = "n_feedhorns"
return AWS_EPS_Sterna_MWR_L1BFile(eps_sterna_mwr_file, filename_info, filetype_info)


Expand All @@ -203,6 +204,7 @@ def aws_mwr_handler(aws_mwr_file):
filename_info = parse(file_pattern, os.path.basename(aws_mwr_file))
filetype_info = dict()
filetype_info["file_type"] = "aws1_mwr_l1b"
filetype_info["feed_horn_group_name"] = "n_geo_groups"
return AWS_EPS_Sterna_MWR_L1BFile(aws_mwr_file, filename_info, filetype_info)


Expand All @@ -212,4 +214,5 @@ def aws_mwr_l1c_handler(aws_mwr_l1c_file):
filename_info = parse(file_pattern, os.path.basename(aws_mwr_l1c_file))
filetype_info = dict()
filetype_info["file_type"] = "aws1_mwr_l1c"
filetype_info["feed_horn_group_name"] = None
return AWS_MWR_L1CFile(aws_mwr_l1c_file, filename_info, filetype_info)

0 comments on commit 0b9760c

Please sign in to comment.