From ea182368f826c344c6315b6278118942d0ca9f93 Mon Sep 17 00:00:00 2001 From: "Nina.Hakansson" Date: Tue, 26 Nov 2024 16:49:20 +0100 Subject: [PATCH 01/13] first try can read and remap the cloud top composite --- .../multiple_sensors_isccpng_l1g_nc.yaml | 265 ++++++++++++++++++ .../multiple_sensors_isccpng_l1g_nc.py | 82 ++++++ 2 files changed, 347 insertions(+) create mode 100644 satpy/etc/readers/multiple_sensors_isccpng_l1g_nc.yaml create mode 100644 satpy/readers/multiple_sensors_isccpng_l1g_nc.py diff --git a/satpy/etc/readers/multiple_sensors_isccpng_l1g_nc.yaml b/satpy/etc/readers/multiple_sensors_isccpng_l1g_nc.yaml new file mode 100644 index 0000000000..0cf4274205 --- /dev/null +++ b/satpy/etc/readers/multiple_sensors_isccpng_l1g_nc.yaml @@ -0,0 +1,265 @@ +reader: + name: multiple_sensors_isccpng_l1g_nc + short_name: ISCCP NG NetCDF4 + long_name: ISCCP NG Level 1c NetCDF4 + description: > + NetCDF4 reader for ISCCP Level 1g files. + sensors: [seviri, abi, ahi] + reader: !!python/name:satpy.readers.yaml_reader.FileYAMLReader + group_keys: ["start_time", "satid"] + +file_types: + isccp_ng_l1g_nc_refl_01_60um: + file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler + file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__refl_01_60um__{start_time:%Y%m%dT%H%M}.nc'] + isccp_ng_l1g_nc_temp_03_80um: + file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler + file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__temp_03_80um__{start_time:%Y%m%dT%H%M}.nc'] + isccp_ng_l1g_nc_temp_08_60um: + file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler + file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__temp_08_60um__{start_time:%Y%m%dT%H%M}.nc'] + isccp_ng_l1g_nc_temp_09_70um: + file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler + file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__temp_09_70um__{start_time:%Y%m%dT%H%M}.nc'] + isccp_ng_l1g_nc_temp_11_00um: + file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler + file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__temp_11_00um__{start_time:%Y%m%dT%H%M}.nc'] + isccp_ng_l1g_nc_temp_12_00um: + file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler + file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__temp_12_00um__{start_time:%Y%m%dT%H%M}.nc'] + isccp_ng_l1g_nc_temp_13_30um: + file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler + file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__temp_13_30um__{start_time:%Y%m%dT%H%M}.nc'] + isccp_ng_l1g_nc_refl_00_65um: + file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler + file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__refl_00_65um__{start_time:%Y%m%dT%H%M}.nc'] + isccp_ng_l1g_nc_refl_00_86um: + file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler + file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__refl_00_86um__{start_time:%Y%m%dT%H%M}.nc'] + isccp_ng_l1g_nc_temp_06_20um: + file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler + file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__temp_06_20um__{start_time:%Y%m%dT%H%M}.nc'] + isccp_ng_l1g_nc_temp_07_30um: + file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler + file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__temp_07_30um__{start_time:%Y%m%dT%H%M}.nc'] + isccp_ng_l1g_nc_solar_zenith: + file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler + file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__solar_zenith_angle__{start_time:%Y%m%dT%H%M}.nc'] + isccp_ng_l1g_nc_sensor_zenith: + file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler + file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__sensor_zenith_angle__{start_time:%Y%m%dT%H%M}.nc'] + isccp_ng_l1g_nc_solar_azimuth: + file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler + file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__solar_azimuth_angle__{start_time:%Y%m%dT%H%M}.nc'] + isccp_ng_l1g_nc_sensor_azimuth: + file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler + file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__sensor_azimuth_angle__{start_time:%Y%m%dT%H%M}.nc'] + isccp_ng_l1g_nc_time: + file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler + file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__pixel_time__{start_time:%Y%m%dT%H%M}.nc'] + isccp_ng_l1g_nc_wmo_id: + file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler + file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__wmo_id__{start_time:%Y%m%dT%H%M}.nc'] + + +datasets: + refl_01_60um: + name: refl_01_60um + resolution: 3000.403165817 + wavelength: [1.5, 1.64, 1.78] + calibration: + reflectance: + standard_name: toa_bidirectional_reflectance + units: "%" + coordinates: [lon, lat] + file_type: isccp_ng_l1g_nc_refl_01_60um + nc_key: 'refl_01_60um' + + temp_03_80um: + name: temp_03_80um + resolution: 3000.403165817 + wavelength: [3.48, 3.92, 4.36] + calibration: + brightness_temperature: + standard_name: toa_brightness_temperature + units: K + coordinates: [lon, lat] + file_type: isccp_ng_l1g_nc_temp_03_80um + nc_key: 'temp_03_80um' + + temp_08_60um: + name: temp_08_60um + resolution: 3000.403165817 + wavelength: [8.3, 8.7, 9.1] + calibration: + brightness_temperature: + standard_name: toa_brightness_temperature + units: K + coordinates: [lon, lat] + file_type: isccp_ng_l1g_nc_temp_08_60um + nc_key: 'temp_08_60um' + + temp_09_70um: + name: temp_09_70um + resolution: 3000.403165817 + wavelength: [9.38, 9.66, 9.94] + calibration: + brightness_temperature: + standard_name: toa_brightness_temperature + units: K + coordinates: [lon, lat] + file_type: isccp_ng_l1g_nc_temp_09_70um + nc_key: 'temp_09_70um' + + temp_11_00um: + name: temp_11_00um + resolution: 3000.403165817 + wavelength: [9.8, 10.8, 11.8] + calibration: + brightness_temperature: + standard_name: toa_brightness_temperature + units: K + coordinates: [lon, lat] + file_type: isccp_ng_l1g_nc_temp_11_00um + nc_key: 'temp_11_00um' + + temp_12_00um: + name: temp_12_00um + resolution: 3000.403165817 + wavelength: [11.0, 12.0, 13.0] + calibration: + brightness_temperature: + standard_name: toa_brightness_temperature + units: K + coordinates: [lon, lat] + file_type: isccp_ng_l1g_nc_temp_12_00um + nc_key: 'temp_12_00um' + + temp_13_30um: + name: temp_13_30um + resolution: 3000.403165817 + wavelength: [12.4, 13.4, 14.4] + calibration: + brightness_temperature: + standard_name: toa_brightness_temperature + units: K + coordinates: [lon, lat] + file_type: isccp_ng_l1g_nc_temp_13_30um + nc_key: 'temp_13_30um' + + refl_00_65um: + name: refl_00_65um + resolution: 3000.403165817 + wavelength: [0.56, 0.635, 0.71] + calibration: + reflectance: + standard_name: toa_bidirectional_reflectance + units: "%" + coordinates: [lon, lat] + file_type: isccp_ng_l1g_nc_refl_00_65um + nc_key: 'refl_00_65um' + + + refl_00_86um: + name: refl_00_86um + resolution: 3000.403165817 + wavelength: [0.74, 0.81, 0.88] + calibration: + reflectance: + standard_name: toa_bidirectional_reflectance + units: "%" + file_type: isccp_ng_l1g_nc_refl_00_86um + nc_key: 'refl_00_86um' + + temp_06_20um: + name: temp_06_20um + resolution: 3000.403165817 + wavelength: [5.35, 6.25, 7.15] + calibration: + brightness_temperature: + standard_name: toa_brightness_temperature + units: "K" + coordinates: [lon, lat] + file_type: isccp_ng_l1g_nc_temp_06_20um + nc_key: 'temp_06_20um' + + temp_07_30um: + name: temp_07_30um + resolution: 3000.403165817 + wavelength: [6.85, 7.35, 7.85] + calibration: + brightness_temperature: + standard_name: toa_brightness_temperature + units: "K" + coordinates: [lon, lat] + file_type: isccp_ng_l1g_nc_temp_07_30um + nc_key: 'temp_07_30um' + + solar_zenith_angle: + name: solar_zenith_angle + standard_name: solar_zenith_angle + resolution: 3000 + file_type: isccp_ng_l1g_nc_solar_zenith + units: degrees + nc_key: 'solar_zenith_angle' + + sensor_zenith_angle: + name: sensor_zenith_angle + standard_name: sensor_zenith_angle + resolution: 3000 + file_type: isccp_ng_l1g_nc_sensor_zenith + units: degrees + nc_key: 'satellite_zenith_angle' + + solar_azimuth_angle: + name: solar_azimuth_angle + standard_name: solar_azimuth_angle + resolution: 3000 + file_type: isccp_ng_l1g_nc_solar_azimuth + units: degrees + nc_key: 'solar_azimuth_angle' + + satellite_azimuth_angle: + name: satellite_azimuth_angle + standard_name: satellite_azimuth_angle + resolution: 3000 + file_type: isccp_ng_l1g_nc_satellite_azimuth + units: degrees + nc_key: 'satellite_azimuth_angle' + + lon: + name: lon + resolution: 3000.403165817 + file_type: + - isccp_ng_l1g_nc_time + - isccp_ng_l1g_nc_temp_11_00um + - isccp_ng_l1g_nc_temp_12_00um + - isccp_ng_l1g_nc_temp_03_80um + standard_name: longitude + units: "degrees" + nc_key: 'longitude' + + lat: + name: lat + resolution: 3000.403165817 + file_type: + - isccp_ng_l1g_nc_time + - isccp_ng_l1g_nc_temp_11_00um + - isccp_ng_l1g_nc_temp_12_00um + - isccp_ng_l1g_nc_temp_03_80um + standard_name: latitude + units: "degrees" + nc_key: 'latitude' + + pixel_time: + name: pixel_time + standard_name: pixel_time + resolution: 3000 + file_type: isccp_ng_l1g_nc_time + nc_key: 'pixel_time' + + wmo_id: + name: wmo_id + resolution: 3000 + file_type: isccp_ng_l1g_nc_wmo_id + nc_key: 'wmo_id' \ No newline at end of file diff --git a/satpy/readers/multiple_sensors_isccpng_l1g_nc.py b/satpy/readers/multiple_sensors_isccpng_l1g_nc.py new file mode 100644 index 0000000000..d4327cb8ff --- /dev/null +++ b/satpy/readers/multiple_sensors_isccpng_l1g_nc.py @@ -0,0 +1,82 @@ +# Copyright (c) 2009-2024 Satpy developers +# +# This file is part of satpy. +# +# satpy is free software: you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later +# version. +# +# satpy is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# satpy. If not, see . +"""Reader for ISCCP-NG L1G data.""" + +import datetime as dt +import logging + +import numpy as np +import xarray as xr + +from satpy.readers.file_handlers import BaseFileHandler +from satpy.utils import get_legacy_chunk_size + +CHUNK_SIZE = get_legacy_chunk_size() +logger = logging.getLogger(__name__) + + +class IsccpngL1gFileHandler(BaseFileHandler): + """Reader L1G ISCCP-NG data.""" + + def __init__(self, filename, filename_info, filetype_info): + """Init the file handler.""" + super(IsccpngL1gFileHandler, self).__init__( + filename, filename_info, filetype_info) + + self.engine = "h5netcdf" + self._start_time = filename_info["start_time"] + self._end_time = None + self.sensor = "multiple_sensors" + self.filename_info = filename_info + + def tile_geolocation(self, data, key): + if key in "latitude": + return xr.DataArray(np.tile(data.values[:, np.newaxis], (1, 7200)), dims=["y", "x"], attrs=data.attrs) + if key in "longitude": + return xr.DataArray(np.tile(data.values, (3600, 1)), dims=["y", "x"], attrs=data.attrs) + return data + + def get_dataset(self, key, yaml_info): + """Get dataset.""" + logger.debug("Getting data for: %s", yaml_info["name"]) + # res = super(IsccpngL1gFileHandler, self).get_dataset(key, yaml_info) + nc = xr.open_dataset(self.filename, engine=self.engine, + chunks={"y": CHUNK_SIZE, "x": 800}) + name = yaml_info.get("nc_store_name", yaml_info["name"]) + file_key = yaml_info.get("nc_key", name) + data = nc[file_key] + if len(data.dims) > 2 : + # lat = self.tile_geolocation(data.coords["latitude"], "latitude") + # lon = self.tile_geolocation(data.coords["longitude"], "longitude") + data = data[0, 0, :, :].squeeze(drop=True) + data = data.drop_vars('latitude') + data = data.drop_vars('longitude') + data = data.drop_vars('start_time') + data = data.drop_vars('end_time') + data = data.rename({'longitude': 'x','latitude': 'y'}) + # data = data.assign_coords({"lat": lat, "lon": lon}) + data = self.tile_geolocation(data, file_key) + return data + + @property + def start_time(self): + """Get the start time.""" + return self._start_time + + @property + def end_time(self): + """Get the end time.""" + return self._end_time From de8eac449493ba0581e07d81eaf046a6c8646086 Mon Sep 17 00:00:00 2001 From: "Nina.Hakansson" Date: Wed, 27 Nov 2024 11:30:38 +0100 Subject: [PATCH 02/13] Rearrange the code --- .../multiple_sensors_isccpng_l1g_nc.py | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/satpy/readers/multiple_sensors_isccpng_l1g_nc.py b/satpy/readers/multiple_sensors_isccpng_l1g_nc.py index d4327cb8ff..0c062b8e4e 100644 --- a/satpy/readers/multiple_sensors_isccpng_l1g_nc.py +++ b/satpy/readers/multiple_sensors_isccpng_l1g_nc.py @@ -36,38 +36,44 @@ def __init__(self, filename, filename_info, filetype_info): super(IsccpngL1gFileHandler, self).__init__( filename, filename_info, filetype_info) - self.engine = "h5netcdf" self._start_time = filename_info["start_time"] self._end_time = None self.sensor = "multiple_sensors" self.filename_info = filename_info def tile_geolocation(self, data, key): + """Get geolocation on full swath.""" if key in "latitude": return xr.DataArray(np.tile(data.values[:, np.newaxis], (1, 7200)), dims=["y", "x"], attrs=data.attrs) if key in "longitude": return xr.DataArray(np.tile(data.values, (3600, 1)), dims=["y", "x"], attrs=data.attrs) return data - - def get_dataset(self, key, yaml_info): - """Get dataset.""" - logger.debug("Getting data for: %s", yaml_info["name"]) - # res = super(IsccpngL1gFileHandler, self).get_dataset(key, yaml_info) - nc = xr.open_dataset(self.filename, engine=self.engine, - chunks={"y": CHUNK_SIZE, "x": 800}) - name = yaml_info.get("nc_store_name", yaml_info["name"]) - file_key = yaml_info.get("nc_key", name) - data = nc[file_key] + + def get_best_layer_of_data(self, data): + """Get the layer with best data (= layer 0). There are two more layers with additional data.""" + if len(data.dims) > 2 : + return data[0, 0, :, :].squeeze(drop=True) + return data + + def modify_dims_and_coords(self, data): + """Remove coords and rename dims to x and y.""" if len(data.dims) > 2 : - # lat = self.tile_geolocation(data.coords["latitude"], "latitude") - # lon = self.tile_geolocation(data.coords["longitude"], "longitude") - data = data[0, 0, :, :].squeeze(drop=True) data = data.drop_vars('latitude') data = data.drop_vars('longitude') data = data.drop_vars('start_time') data = data.drop_vars('end_time') data = data.rename({'longitude': 'x','latitude': 'y'}) - # data = data.assign_coords({"lat": lat, "lon": lon}) + return data + + def get_dataset(self, key, yaml_info): + """Get dataset.""" + logger.debug("Getting data for: %s", yaml_info["name"]) + nc = xr.open_dataset(self.filename, chunks={"y": CHUNK_SIZE, "x": 800}) + name = yaml_info.get("nc_store_name", yaml_info["name"]) + file_key = yaml_info.get("nc_key", name) + data = nc[file_key] + data = self.modify_dims_and_coords(data) + data = self.get_best_layer_of_data(data) data = self.tile_geolocation(data, file_key) return data From 92be03c7a6a98a80ddfb99efc8346e516e86e219 Mon Sep 17 00:00:00 2001 From: "Nina.Hakansson" Date: Wed, 27 Nov 2024 12:38:03 +0100 Subject: [PATCH 03/13] Fix reading angles --- .../readers/multiple_sensors_isccpng_l1g_nc.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/satpy/etc/readers/multiple_sensors_isccpng_l1g_nc.yaml b/satpy/etc/readers/multiple_sensors_isccpng_l1g_nc.yaml index 0cf4274205..4322a4651d 100644 --- a/satpy/etc/readers/multiple_sensors_isccpng_l1g_nc.yaml +++ b/satpy/etc/readers/multiple_sensors_isccpng_l1g_nc.yaml @@ -45,15 +45,15 @@ file_types: isccp_ng_l1g_nc_solar_zenith: file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__solar_zenith_angle__{start_time:%Y%m%dT%H%M}.nc'] - isccp_ng_l1g_nc_sensor_zenith: + isccp_ng_l1g_nc_satellite_zenith: file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler - file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__sensor_zenith_angle__{start_time:%Y%m%dT%H%M}.nc'] + file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__satellite_zenith_angle__{start_time:%Y%m%dT%H%M}.nc'] isccp_ng_l1g_nc_solar_azimuth: file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__solar_azimuth_angle__{start_time:%Y%m%dT%H%M}.nc'] - isccp_ng_l1g_nc_sensor_azimuth: + isccp_ng_l1g_nc_satellite_azimuth: file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler - file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__sensor_azimuth_angle__{start_time:%Y%m%dT%H%M}.nc'] + file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__satellite_azimuth_angle__{start_time:%Y%m%dT%H%M}.nc'] isccp_ng_l1g_nc_time: file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__pixel_time__{start_time:%Y%m%dT%H%M}.nc'] @@ -203,11 +203,11 @@ datasets: units: degrees nc_key: 'solar_zenith_angle' - sensor_zenith_angle: - name: sensor_zenith_angle - standard_name: sensor_zenith_angle + satellite_zenith_angle: + name: satellite_zenith_angle + standard_name: satellite_zenith_angle resolution: 3000 - file_type: isccp_ng_l1g_nc_sensor_zenith + file_type: isccp_ng_l1g_nc_satellite_zenith units: degrees nc_key: 'satellite_zenith_angle' From f5aa7eaee47e7650c55cc48be4af9c0ba4bc887c Mon Sep 17 00:00:00 2001 From: "Nina.Hakansson" Date: Wed, 27 Nov 2024 12:39:27 +0100 Subject: [PATCH 04/13] Fix time attrs Also sun zenith angles only contains one layer of data. --- .../readers/multiple_sensors_isccpng_l1g_nc.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/satpy/readers/multiple_sensors_isccpng_l1g_nc.py b/satpy/readers/multiple_sensors_isccpng_l1g_nc.py index 0c062b8e4e..533c8fa27c 100644 --- a/satpy/readers/multiple_sensors_isccpng_l1g_nc.py +++ b/satpy/readers/multiple_sensors_isccpng_l1g_nc.py @@ -51,13 +51,13 @@ def tile_geolocation(self, data, key): def get_best_layer_of_data(self, data): """Get the layer with best data (= layer 0). There are two more layers with additional data.""" - if len(data.dims) > 2 : - return data[0, 0, :, :].squeeze(drop=True) - return data + if len(data.dims) == 4: + data = data[0, 0, :, :] + return data.squeeze(drop=True) def modify_dims_and_coords(self, data): """Remove coords and rename dims to x and y.""" - if len(data.dims) > 2 : + if len(data.dims) > 2: data = data.drop_vars('latitude') data = data.drop_vars('longitude') data = data.drop_vars('start_time') @@ -65,6 +65,15 @@ def modify_dims_and_coords(self, data): data = data.rename({'longitude': 'x','latitude': 'y'}) return data + def set_time_attrs(self, data): + """Set time from attributes.""" + if "start_time" in data.coords: + data.attrs["start_time"] = data["start_time"].values[0] + data.attrs["end_time"] = data["end_time"].values[0] + self._end_time = data.attrs["end_time"] + self._start_time = data.attrs["start_time"] + + def get_dataset(self, key, yaml_info): """Get dataset.""" logger.debug("Getting data for: %s", yaml_info["name"]) @@ -72,6 +81,7 @@ def get_dataset(self, key, yaml_info): name = yaml_info.get("nc_store_name", yaml_info["name"]) file_key = yaml_info.get("nc_key", name) data = nc[file_key] + self.set_time_attrs(data) data = self.modify_dims_and_coords(data) data = self.get_best_layer_of_data(data) data = self.tile_geolocation(data, file_key) From 7c1c0febe55c5e41022d7d49692c7bd441fed4f5 Mon Sep 17 00:00:00 2001 From: "Nina.Hakansson" Date: Wed, 27 Nov 2024 14:12:09 +0100 Subject: [PATCH 05/13] All datasets have the same resolution --- .../readers/multiple_sensors_isccpng_l1g_nc.yaml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/satpy/etc/readers/multiple_sensors_isccpng_l1g_nc.yaml b/satpy/etc/readers/multiple_sensors_isccpng_l1g_nc.yaml index 4322a4651d..2b223c25de 100644 --- a/satpy/etc/readers/multiple_sensors_isccpng_l1g_nc.yaml +++ b/satpy/etc/readers/multiple_sensors_isccpng_l1g_nc.yaml @@ -198,7 +198,7 @@ datasets: solar_zenith_angle: name: solar_zenith_angle standard_name: solar_zenith_angle - resolution: 3000 + resolution: 3000.403165817 file_type: isccp_ng_l1g_nc_solar_zenith units: degrees nc_key: 'solar_zenith_angle' @@ -206,7 +206,7 @@ datasets: satellite_zenith_angle: name: satellite_zenith_angle standard_name: satellite_zenith_angle - resolution: 3000 + resolution: 3000.403165817 file_type: isccp_ng_l1g_nc_satellite_zenith units: degrees nc_key: 'satellite_zenith_angle' @@ -214,7 +214,7 @@ datasets: solar_azimuth_angle: name: solar_azimuth_angle standard_name: solar_azimuth_angle - resolution: 3000 + resolution: 3000.403165817 file_type: isccp_ng_l1g_nc_solar_azimuth units: degrees nc_key: 'solar_azimuth_angle' @@ -222,7 +222,7 @@ datasets: satellite_azimuth_angle: name: satellite_azimuth_angle standard_name: satellite_azimuth_angle - resolution: 3000 + resolution: 3000.403165817 file_type: isccp_ng_l1g_nc_satellite_azimuth units: degrees nc_key: 'satellite_azimuth_angle' @@ -254,12 +254,14 @@ datasets: pixel_time: name: pixel_time standard_name: pixel_time - resolution: 3000 + resolution: 3000.403165817 file_type: isccp_ng_l1g_nc_time + coordinates: [lon, lat] nc_key: 'pixel_time' wmo_id: name: wmo_id - resolution: 3000 + resolution: 3000.403165817 file_type: isccp_ng_l1g_nc_wmo_id + coordinates: [lon, lat] nc_key: 'wmo_id' \ No newline at end of file From ec07c3af75502572d05cd38f150f7dcbc18d9274 Mon Sep 17 00:00:00 2001 From: "Nina.Hakansson" Date: Wed, 27 Nov 2024 14:15:59 +0100 Subject: [PATCH 06/13] flake8 --- satpy/readers/multiple_sensors_isccpng_l1g_nc.py | 16 +++++++--------- satpy/readers/viirs_vgac_l1c_nc.py | 1 + 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/satpy/readers/multiple_sensors_isccpng_l1g_nc.py b/satpy/readers/multiple_sensors_isccpng_l1g_nc.py index 533c8fa27c..2da22ad3fa 100644 --- a/satpy/readers/multiple_sensors_isccpng_l1g_nc.py +++ b/satpy/readers/multiple_sensors_isccpng_l1g_nc.py @@ -15,7 +15,6 @@ # satpy. If not, see . """Reader for ISCCP-NG L1G data.""" -import datetime as dt import logging import numpy as np @@ -48,7 +47,7 @@ def tile_geolocation(self, data, key): if key in "longitude": return xr.DataArray(np.tile(data.values, (3600, 1)), dims=["y", "x"], attrs=data.attrs) return data - + def get_best_layer_of_data(self, data): """Get the layer with best data (= layer 0). There are two more layers with additional data.""" if len(data.dims) == 4: @@ -58,11 +57,11 @@ def get_best_layer_of_data(self, data): def modify_dims_and_coords(self, data): """Remove coords and rename dims to x and y.""" if len(data.dims) > 2: - data = data.drop_vars('latitude') - data = data.drop_vars('longitude') - data = data.drop_vars('start_time') - data = data.drop_vars('end_time') - data = data.rename({'longitude': 'x','latitude': 'y'}) + data = data.drop_vars("latitude") + data = data.drop_vars("longitude") + data = data.drop_vars("start_time") + data = data.drop_vars("end_time") + data = data.rename({"longitude": "x", "latitude": "y"}) return data def set_time_attrs(self, data): @@ -71,8 +70,7 @@ def set_time_attrs(self, data): data.attrs["start_time"] = data["start_time"].values[0] data.attrs["end_time"] = data["end_time"].values[0] self._end_time = data.attrs["end_time"] - self._start_time = data.attrs["start_time"] - + self._start_time = data.attrs["start_time"] def get_dataset(self, key, yaml_info): """Get dataset.""" diff --git a/satpy/readers/viirs_vgac_l1c_nc.py b/satpy/readers/viirs_vgac_l1c_nc.py index 6a2b1abcae..1a3e022b49 100644 --- a/satpy/readers/viirs_vgac_l1c_nc.py +++ b/satpy/readers/viirs_vgac_l1c_nc.py @@ -102,6 +102,7 @@ def get_dataset(self, key, yaml_info): name = yaml_info.get("nc_store_name", yaml_info["name"]) file_key = yaml_info.get("nc_key", name) data = nc[file_key] + import pdb;pdb.set_trace() data = self.calibrate(data, yaml_info, file_key, nc) data = self.decode_time_variable(data, file_key, nc) data.attrs.update(nc.attrs) # For now add global attributes to all datasets From 8f0eb6aedc6d55048b732ef9a41caaa3b3d1a8f5 Mon Sep 17 00:00:00 2001 From: "Nina.Hakansson" Date: Wed, 27 Nov 2024 15:18:54 +0100 Subject: [PATCH 07/13] fix description --- satpy/etc/readers/multiple_sensors_isccpng_l1g_nc.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/satpy/etc/readers/multiple_sensors_isccpng_l1g_nc.yaml b/satpy/etc/readers/multiple_sensors_isccpng_l1g_nc.yaml index 2b223c25de..1e3c1c9d2a 100644 --- a/satpy/etc/readers/multiple_sensors_isccpng_l1g_nc.yaml +++ b/satpy/etc/readers/multiple_sensors_isccpng_l1g_nc.yaml @@ -1,9 +1,8 @@ reader: name: multiple_sensors_isccpng_l1g_nc short_name: ISCCP NG NetCDF4 - long_name: ISCCP NG Level 1c NetCDF4 - description: > - NetCDF4 reader for ISCCP Level 1g files. + long_name: ISCCP NG Level 1g NetCDF4 + description: https://cimss.ssec.wisc.edu/isccp-ng/ sensors: [seviri, abi, ahi] reader: !!python/name:satpy.readers.yaml_reader.FileYAMLReader group_keys: ["start_time", "satid"] From 5b526926c80670d22f34cedb84cdf3e9628bf6c7 Mon Sep 17 00:00:00 2001 From: "Nina.Hakansson" Date: Wed, 27 Nov 2024 15:36:21 +0100 Subject: [PATCH 08/13] Add some more channels --- .../multiple_sensors_isccpng_l1g_nc.yaml | 91 ++++++++++++++++++- 1 file changed, 90 insertions(+), 1 deletion(-) diff --git a/satpy/etc/readers/multiple_sensors_isccpng_l1g_nc.yaml b/satpy/etc/readers/multiple_sensors_isccpng_l1g_nc.yaml index 1e3c1c9d2a..1362b53f49 100644 --- a/satpy/etc/readers/multiple_sensors_isccpng_l1g_nc.yaml +++ b/satpy/etc/readers/multiple_sensors_isccpng_l1g_nc.yaml @@ -8,6 +8,18 @@ reader: group_keys: ["start_time", "satid"] file_types: + isccp_ng_l1g_nc_refl_0047um: + file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler + file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__refl_0047um__{start_time:%Y%m%dT%H%M}.nc'] + isccp_ng_l1g_nc_refl_00_51um: + file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler + file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__refl_00_51um__{start_time:%Y%m%dT%H%M}.nc'] + isccp_ng_l1g_nc_refl_01_38um: + file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler + file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__refl_01_38um__{start_time:%Y%m%dT%H%M}.nc'] + isccp_ng_l1g_nc_refl_02_20um: + file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler + file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__refl_02_20um__{start_time:%Y%m%dT%H%M}.nc'] isccp_ng_l1g_nc_refl_01_60um: file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__refl_01_60um__{start_time:%Y%m%dT%H%M}.nc'] @@ -23,6 +35,9 @@ file_types: isccp_ng_l1g_nc_temp_11_00um: file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__temp_11_00um__{start_time:%Y%m%dT%H%M}.nc'] + isccp_ng_l1g_nc_temp_10_40um: + file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler + file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__temp_10_40um__{start_time:%Y%m%dT%H%M}.nc'] isccp_ng_l1g_nc_temp_12_00um: file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__temp_12_00um__{start_time:%Y%m%dT%H%M}.nc'] @@ -38,6 +53,9 @@ file_types: isccp_ng_l1g_nc_temp_06_20um: file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__temp_06_20um__{start_time:%Y%m%dT%H%M}.nc'] + isccp_ng_l1g_nc_temp_06_70um: + file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler + file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__temp_06_70um__{start_time:%Y%m%dT%H%M}.nc'] isccp_ng_l1g_nc_temp_07_30um: file_reader: !!python/name:satpy.readers.multiple_sensors_isccpng_l1g_nc.IsccpngL1gFileHandler file_patterns: ['ISCCP-NG_L1g_demo_v{version}_res_0_05deg__temp_07_30um__{start_time:%Y%m%dT%H%M}.nc'] @@ -62,6 +80,54 @@ file_types: datasets: + refl_0047um: + name: refl_0047um + resolution: 3000.403165817 + wavelength: [0.450, 0.470, 0.490] + calibration: + reflectance: + standard_name: toa_bidirectional_reflectance + units: "%" + coordinates: [lon, lat] + file_type: isccp_ng_l1g_nc_refl_0047um + nc_key: 'refl_0047um' + + refl_00_51um: + name: refl_00_51um + resolution: 3000.403165817 + wavelength: [0.49,0.51,0.53] + calibration: + reflectance: + standard_name: toa_bidirectional_reflectance + units: "%" + coordinates: [lon, lat] + file_type: isccp_ng_l1g_nc_refl_00_51um + nc_key: 'refl_00_51um' + + refl_01_38um: + name: refl_01_38um + resolution: 3000.403165817 + wavelength: [1.3705, 1.378, 1.3855] + calibration: + reflectance: + standard_name: toa_bidirectional_reflectance + units: "%" + coordinates: [lon, lat] + file_type: isccp_ng_l1g_nc_refl_01_38um + nc_key: 'refl_01_38um' + + refl_02_20um: + name: refl_02_20um + resolution: 3000.403165817 + wavelength: [2.225, 2.250, 2.275] + calibration: + reflectance: + standard_name: toa_bidirectional_reflectance + units: "%" + coordinates: [lon, lat] + file_type: isccp_ng_l1g_nc_refl_02_20um + nc_key: 'refl_02_20um' + refl_01_60um: name: refl_01_60um resolution: 3000.403165817 @@ -122,6 +188,18 @@ datasets: file_type: isccp_ng_l1g_nc_temp_11_00um nc_key: 'temp_11_00um' + temp_10_40um: + name: temp_10_40um + resolution: 3000.403165817 + wavelength: [10.2, 10.4, 10.6] + calibration: + brightness_temperature: + standard_name: toa_brightness_temperature + units: K + coordinates: [lon, lat] + file_type: isccp_ng_l1g_nc_temp_10_40um + nc_key: 'temp_10_40um' + temp_12_00um: name: temp_12_00um resolution: 3000.403165817 @@ -158,7 +236,6 @@ datasets: file_type: isccp_ng_l1g_nc_refl_00_65um nc_key: 'refl_00_65um' - refl_00_86um: name: refl_00_86um resolution: 3000.403165817 @@ -182,6 +259,18 @@ datasets: file_type: isccp_ng_l1g_nc_temp_06_20um nc_key: 'temp_06_20um' + temp_06_70um: + name: temp_06_70um + resolution: 3000.403165817 + wavelength: [6.7, 6.9, 7.1] + calibration: + brightness_temperature: + standard_name: toa_brightness_temperature + units: "K" + coordinates: [lon, lat] + file_type: isccp_ng_l1g_nc_temp_06_70um + nc_key: 'temp_06_70um' + temp_07_30um: name: temp_07_30um resolution: 3000.403165817 From 968c64b048380e9adb477ae276b084193f2459f9 Mon Sep 17 00:00:00 2001 From: "Nina.Hakansson" Date: Wed, 27 Nov 2024 15:40:55 +0100 Subject: [PATCH 09/13] Remove change commited by mistake --- satpy/readers/viirs_vgac_l1c_nc.py | 1 - 1 file changed, 1 deletion(-) diff --git a/satpy/readers/viirs_vgac_l1c_nc.py b/satpy/readers/viirs_vgac_l1c_nc.py index 1a3e022b49..6a2b1abcae 100644 --- a/satpy/readers/viirs_vgac_l1c_nc.py +++ b/satpy/readers/viirs_vgac_l1c_nc.py @@ -102,7 +102,6 @@ def get_dataset(self, key, yaml_info): name = yaml_info.get("nc_store_name", yaml_info["name"]) file_key = yaml_info.get("nc_key", name) data = nc[file_key] - import pdb;pdb.set_trace() data = self.calibrate(data, yaml_info, file_key, nc) data = self.decode_time_variable(data, file_key, nc) data.attrs.update(nc.attrs) # For now add global attributes to all datasets From 937d352827faba8d94b3510aeffb02aec287ae29 Mon Sep 17 00:00:00 2001 From: "Nina.Hakansson" <6160529+ninahakansson@users.noreply.github.com> Date: Wed, 27 Nov 2024 15:53:47 +0100 Subject: [PATCH 10/13] Updated doc string --- satpy/readers/multiple_sensors_isccpng_l1g_nc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/satpy/readers/multiple_sensors_isccpng_l1g_nc.py b/satpy/readers/multiple_sensors_isccpng_l1g_nc.py index 2da22ad3fa..d438788213 100644 --- a/satpy/readers/multiple_sensors_isccpng_l1g_nc.py +++ b/satpy/readers/multiple_sensors_isccpng_l1g_nc.py @@ -13,7 +13,7 @@ # # You should have received a copy of the GNU General Public License along with # satpy. If not, see . -"""Reader for ISCCP-NG L1G data.""" +"""Reader for ISCCP-NG L1G data (https://cimss.ssec.wisc.edu/isccp-ng/).""" import logging From f28fe3cf3c0cc305fb3d5d709c6d0379093cf763 Mon Sep 17 00:00:00 2001 From: "Nina.Hakansson" <6160529+ninahakansson@users.noreply.github.com> Date: Fri, 29 Nov 2024 11:11:55 +0100 Subject: [PATCH 11/13] Added tests --- .../multiple_sensors_isccpng_l1g_nc.yaml | 2 +- .../test_multiple_sensors_isccpng_l1g_nc.py | 84 +++++++++++++++++++ 2 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 satpy/tests/reader_tests/test_multiple_sensors_isccpng_l1g_nc.py diff --git a/satpy/etc/readers/multiple_sensors_isccpng_l1g_nc.yaml b/satpy/etc/readers/multiple_sensors_isccpng_l1g_nc.yaml index 1362b53f49..d6c5c6b809 100644 --- a/satpy/etc/readers/multiple_sensors_isccpng_l1g_nc.yaml +++ b/satpy/etc/readers/multiple_sensors_isccpng_l1g_nc.yaml @@ -352,4 +352,4 @@ datasets: resolution: 3000.403165817 file_type: isccp_ng_l1g_nc_wmo_id coordinates: [lon, lat] - nc_key: 'wmo_id' \ No newline at end of file + nc_key: 'wmo_id' diff --git a/satpy/tests/reader_tests/test_multiple_sensors_isccpng_l1g_nc.py b/satpy/tests/reader_tests/test_multiple_sensors_isccpng_l1g_nc.py new file mode 100644 index 0000000000..7efcb6c42e --- /dev/null +++ b/satpy/tests/reader_tests/test_multiple_sensors_isccpng_l1g_nc.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2023- Satpy developers +# +# satpy is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# satpy is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with satpy. If not, see . + +"""The multiple_sensors_isccpng_l1g_nc reader tests package. + +This version tests the readers for ISCCP L1G data. + +""" + + +import datetime as dt + +import numpy as np +import pytest +import xarray as xr + + +@pytest.fixture +def nc_filename(tmp_path): + """Create nc test data file and return its filename.""" + now = dt.datetime.now(dt.timezone.utc) + filename = f"ISCCP-NG_L1g_demo_v5_res_0_05deg__temp_11_00um__{now:%Y%m%dT%H%M}.nc" + filename_str = str(tmp_path / filename) + + jan_1970 = dt.datetime(1970, 1, 1, tzinfo=dt.timezone.utc) + delta_t = now - jan_1970 + stime = delta_t.seconds + etime = delta_t.seconds + 600 + # Create test data + nscn = 3600 + npix = 7200 + lats = np.linspace(-90, 90, nscn) + lons = np.linspace(-180, 180, npix) + array = 27000 * np.ones((1, 3, nscn, npix)) + ds = xr.Dataset({"temp_11_00um": (('time', "layer", 'latitude', 'longitude'), array), + }, + coords={'start_time': ('time', [stime]), + "end_time": ('time', [etime]), + 'latitude': lats[:], + 'longitude': lons[:]}, + attrs={"scale_factor": 0.01, "units": "K"}) + + ds["temp_11_00um"].attrs['_FillValue'] = -32767 + ds["temp_11_00um"].attrs['scale_factor'] = 0.01 + ds["temp_11_00um"].attrs['units'] = "K" + ds["longitude"].attrs['standard_name'] = "longitude" + ds["latitude"].attrs['standard_name'] = "latitude" + ds["temp_11_00um"].attrs['standard_name'] = "temp_11_00um" + comp = dict(zlib=True, complevel=5) + encoding = {var: comp for var in ds.data_vars} + ds.to_netcdf(filename_str, encoding=encoding) + return filename_str + + +class TestISCCPNGL1gReader: + """Test the IsccpngL1gFileHandler reader.""" + + def test_read_isccpng_l1g(self, nc_filename): + """Test reading reflectances and BT.""" + from satpy.scene import Scene + # Read data + scn_ = Scene( + reader="multiple_sensors_isccpng_l1g_nc", + filenames=[nc_filename]) + scn_.load(["temp_11_00um", "lon", "lat"]) + assert (scn_["lat"].shape == (3600, 7200)) + assert (scn_["lon"].shape == (3600, 7200)) + assert (scn_["temp_11_00um"].shape == (3600, 7200)) + assert (scn_["temp_11_00um"].values[0, 0] == 270) From 77d520ae517c301c9277057f33b10fe68a6bc31f Mon Sep 17 00:00:00 2001 From: "Nina.Hakansson" <6160529+ninahakansson@users.noreply.github.com> Date: Fri, 29 Nov 2024 11:19:28 +0100 Subject: [PATCH 12/13] Fix quotes --- .../test_multiple_sensors_isccpng_l1g_nc.py | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/satpy/tests/reader_tests/test_multiple_sensors_isccpng_l1g_nc.py b/satpy/tests/reader_tests/test_multiple_sensors_isccpng_l1g_nc.py index 7efcb6c42e..5e2a2f3a65 100644 --- a/satpy/tests/reader_tests/test_multiple_sensors_isccpng_l1g_nc.py +++ b/satpy/tests/reader_tests/test_multiple_sensors_isccpng_l1g_nc.py @@ -47,20 +47,20 @@ def nc_filename(tmp_path): lats = np.linspace(-90, 90, nscn) lons = np.linspace(-180, 180, npix) array = 27000 * np.ones((1, 3, nscn, npix)) - ds = xr.Dataset({"temp_11_00um": (('time', "layer", 'latitude', 'longitude'), array), + ds = xr.Dataset({"temp_11_00um": (("time", "layer", "latitude", "longitude"), array), }, - coords={'start_time': ('time', [stime]), - "end_time": ('time', [etime]), - 'latitude': lats[:], - 'longitude': lons[:]}, + coords={"start_time": ("time", [stime]), + "end_time": ("time", [etime]), + "latitude": lats[:], + "longitude": lons[:]}, attrs={"scale_factor": 0.01, "units": "K"}) - ds["temp_11_00um"].attrs['_FillValue'] = -32767 - ds["temp_11_00um"].attrs['scale_factor'] = 0.01 - ds["temp_11_00um"].attrs['units'] = "K" - ds["longitude"].attrs['standard_name'] = "longitude" - ds["latitude"].attrs['standard_name'] = "latitude" - ds["temp_11_00um"].attrs['standard_name'] = "temp_11_00um" + ds["temp_11_00um"].attrs["_FillValue"] = -32767 + ds["temp_11_00um"].attrs["scale_factor"] = 0.01 + ds["temp_11_00um"].attrs["units"] = "K" + ds["longitude"].attrs["standard_name"] = "longitude" + ds["latitude"].attrs["standard_name"] = "latitude" + ds["temp_11_00um"].attrs["standard_name"] = "temp_11_00um" comp = dict(zlib=True, complevel=5) encoding = {var: comp for var in ds.data_vars} ds.to_netcdf(filename_str, encoding=encoding) From 51fde457343ae7098b0ed794e255a5ca4718f99b Mon Sep 17 00:00:00 2001 From: "Nina.Hakansson" <6160529+ninahakansson@users.noreply.github.com> Date: Fri, 29 Nov 2024 11:25:29 +0100 Subject: [PATCH 13/13] isort --- satpy/tests/reader_tests/test_multiple_sensors_isccpng_l1g_nc.py | 1 + 1 file changed, 1 insertion(+) diff --git a/satpy/tests/reader_tests/test_multiple_sensors_isccpng_l1g_nc.py b/satpy/tests/reader_tests/test_multiple_sensors_isccpng_l1g_nc.py index 5e2a2f3a65..a4b38cc0cd 100644 --- a/satpy/tests/reader_tests/test_multiple_sensors_isccpng_l1g_nc.py +++ b/satpy/tests/reader_tests/test_multiple_sensors_isccpng_l1g_nc.py @@ -73,6 +73,7 @@ class TestISCCPNGL1gReader: def test_read_isccpng_l1g(self, nc_filename): """Test reading reflectances and BT.""" from satpy.scene import Scene + # Read data scn_ = Scene( reader="multiple_sensors_isccpng_l1g_nc",