Skip to content

Commit

Permalink
Cleaning code removing debug statements.
Browse files Browse the repository at this point in the history
  • Loading branch information
GMV - Emmanuel Roche committed Oct 2, 2024
1 parent 6021c92 commit 837e844
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
3 changes: 3 additions & 0 deletions satpy/etc/readers/iasi_ng_l2_nc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ file_types:
"{pflag}_{country}-{organization}-{location},{data_designator},{spacecraft}-{instrument}-{processing_level}-{product_type:3s}_{oflag}_{originator}_{generation_time}_{mission_type}_{environment}_{sensing_start_time:%Y%m%d%H%M%S}_{sensing_end_time:%Y%m%d%H%M%S}_{disposition_mode}_{processing_mode}_{free_text1}_{free_text2}_{free_text3}_{extension}.nc",
]

# keeping optimal_estimation folder for the moment due to feature freeze,
# but it might be necessary to re-introduce this in a near future.
# So keeping this reference entry here for now.
# ignored_patterns:
# - /optimal_estimation/ # cf. eum respase2 task2 issue #4

Expand Down
18 changes: 4 additions & 14 deletions satpy/readers/iasi_ng_l2_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
* IASI-L2-CO
"""

import logging
import re

import netCDF4
Expand All @@ -37,8 +36,6 @@

from .netcdf_utils import NetCDF4FsspecFileHandler

logger = logging.getLogger(__name__)


class IASINGL2NCFileHandler(NetCDF4FsspecFileHandler):
"""Reader for IASI-NG L2 products in NetCDF format."""
Expand Down Expand Up @@ -130,7 +127,7 @@ def register_dataset(self, ds_name, desc):
def process_dimension(self, key, value):
"""Process a dimension entry from the file_content."""
dim_name = key.split("/")[-1]
# print(f"Found dimension: {dim_name}={val}")

if dim_name in self.dimensions_desc and self.dimensions_desc[dim_name] != value:
# This might happen if we have the same dim name from different groups:
raise KeyError(f"Detected duplicated dim name: {dim_name}")
Expand All @@ -140,7 +137,6 @@ def process_dimension(self, key, value):
def process_attribute(self, key, value):
"""Process a attribute entry from the file_content."""
var_path, aname = key.split("/attr/")
# print(f"Found attrib for: {var_path}: {aname}")

if var_path not in self.variable_desc:
# maybe this variable is ignored, or this is a group attr.
Expand All @@ -151,14 +147,14 @@ def process_attribute(self, key, value):
def process_variable(self, key):
"""Process a variable entry from the file_content."""
shape = self.file_content[f"{key}/shape"]
# print(f"Found variable: {key}")

if np.prod(shape) <= 1:
# print(f"Ignoring scalar variable {key}")
# Ignoring scalar variable.
return

Check warning on line 153 in satpy/readers/iasi_ng_l2_nc.py

View check run for this annotation

Codecov / codecov/patch

satpy/readers/iasi_ng_l2_nc.py#L153

Added line #L153 was not covered by tests

# Check if this variable should be ignored:
if any(p.search(key) is not None for p in self.ignored_patterns):
# print(f"Ignoring variable {key}")
# Ignoring variable on user request.
return

Check warning on line 158 in satpy/readers/iasi_ng_l2_nc.py

View check run for this annotation

Codecov / codecov/patch

satpy/readers/iasi_ng_l2_nc.py#L158

Added line #L158 was not covered by tests

# Prepare a description for this variable:
Expand All @@ -181,7 +177,6 @@ def process_variable(self, key):
def parse_file_content(self):
"""Parse the file_content to discover the available datasets and dimensions."""
for key, val in self.file_content.items():
# print(f"Found key: {key}")

if "/dimension/" in key:
self.process_dimension(key, val)
Expand All @@ -196,10 +191,6 @@ def parse_file_content(self):
self.process_variable(key)
continue

# print(f"Found {len(self.variable_desc)} variables:")
# for vpath, desc in self.variable_desc.items():
# print(f"{vpath}: {desc}")

def register_available_datasets(self):
"""Register the available dataset in the current product file."""
if self.dataset_infos is not None:
Expand All @@ -224,7 +215,6 @@ def register_available_datasets(self):
# Extract the captured group(s)
var_name = match.group(1)
ds_name = sub.replace("${VAR_NAME}", var_name)
# logger.info("=> matched vpath %s: ds_name: %s", vpath, ds_name)
break

Check warning on line 218 in satpy/readers/iasi_ng_l2_nc.py

View check run for this annotation

Codecov / codecov/patch

satpy/readers/iasi_ng_l2_nc.py#L216-L218

Added lines #L216 - L218 were not covered by tests

if vpath in self.dataset_aliases:
Expand Down
4 changes: 0 additions & 4 deletions satpy/tests/reader_tests/test_iasi_ng_l2_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# along with satpy. If not, see <http://www.gnu.org/licenses/>.

"""Unit tests on the IASI NG L2 reader using the conventional mock constructed context."""
import logging
import os
from datetime import datetime
from unittest import mock
Expand All @@ -29,8 +28,6 @@
from satpy.readers.iasi_ng_l2_nc import IASINGL2NCFileHandler
from satpy.tests.reader_tests.test_netcdf_utils import FakeNetCDF4FileHandler

logger = logging.getLogger(__name__)

d_lff = ("n_lines", "n_for", "n_fov")

DATA_DESC = [
Expand Down Expand Up @@ -317,7 +314,6 @@ def _create_file_handler(self, filename):
# We should have our handler now:
assert len(reader.file_handlers) == 1

# logger.info("File handlers are: %s", reader.file_handlers)
assert self.reader_name in reader.file_handlers

handlers = reader.file_handlers[self.reader_name]
Expand Down

0 comments on commit 837e844

Please sign in to comment.