Skip to content

Commit

Permalink
Fix modes and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mraspaud committed Mar 8, 2024
1 parent 9390945 commit f2e70a0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion satpy/readers/sar_c_safe.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ def get_dataset(self, key, info):

@cached_property
def _data(self):
data = xr.open_dataarray(open_file_or_filename(self.filename), engine="rasterio",
data = xr.open_dataarray(open_file_or_filename(self.filename, mode="rb"), engine="rasterio",
chunks="auto"
).squeeze()
self.chunks = data.data.chunksize
Expand Down
12 changes: 7 additions & 5 deletions satpy/tests/reader_tests/test_sar_c_safe.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import os
from datetime import datetime
from enum import Enum
from io import BytesIO
from pathlib import Path

import numpy as np
Expand Down Expand Up @@ -106,12 +105,15 @@ def noise_filehandler(noise_file, annotation_filehandler):


@pytest.fixture(scope="module")
def noise_with_holes_filehandler(annotation_filehandler):
def noise_with_holes_filehandler(annotation_filehandler, tmpdir_factory):
"""Create a noise filehandler from data with holes."""
filename_info = dict(start_time=START_TIME, end_time=END_TIME, polarization="vv")
noise_filehandler = Denoiser(BytesIO(noise_xml_with_holes),
filename_info, None,
image_shape=annotation_filehandler.image_shape)
noise_xml_file = tmpdir_factory.mktemp("data").join("noise_with_holes.xml")
with open(noise_xml_file, "wb") as fd:
fd.write(noise_xml_with_holes)
noise_filehandler = Denoiser(noise_xml_file,
filename_info, None,
image_shape=annotation_filehandler.image_shape)
return noise_filehandler


Expand Down

0 comments on commit f2e70a0

Please sign in to comment.