Skip to content

Commit

Permalink
#15: fix syntax errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mortenwh committed Apr 17, 2024
1 parent 1ad13e2 commit 74452a4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
7 changes: 3 additions & 4 deletions sarwind/sarwind.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ def set_related_dataset(self, metadata, auxm):
related_dataset = ""
if "id" in metadata.keys() and "naming_authority" in metadata.keys():
related_dataset += "%s:%s (auxiliary)" % (metadata.get("naming_authority", ""),
metadata.get("id", ""))
metadata.get("id", ""))
if "id" in auxm.keys() and "naming_authority" in auxm.keys():
related_dataset += "%s:%s (auxiliary)" % (auxm.get("naming_authority", ""),
auxm.get("id", ""))
auxm.get("id", ""))
if related_dataset != "":
self.set_metadata(
"related_dataset",
Expand Down Expand Up @@ -264,7 +264,6 @@ def export(self, bands=None, *args, **kwargs):
# Get metadata
old_metadata = self.get_metadata()


sar_filename = old_metadata["sar_filename"].split("/")[-1]
platforms = {
"S1A": ["Sentinel-1A", "SAR-C"],
Expand Down Expand Up @@ -343,7 +342,7 @@ def export(self, bands=None, *args, **kwargs):
metadata["iso_topic_category"] = "climatologyMeteorologyAtmosphere"
metadata["quality_control"] = "No quality control"

### END MOVE
# END MOVE

# Set metadata from dict
nc_ds = netCDF4.Dataset(filename, "a")
Expand Down
3 changes: 3 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,23 @@ def sarIW_SAFE(filesDir):
filename = "S1A_IW_GRDH_1SDV_20221026T054447_20221026T054512_045609_05740C_2B2A.SAFE.nc"
return os.path.join(filesDir, filename)


@pytest.fixture(scope="session")
def s1a_20240416(filesDir):
""" Test file with id and naming_authority.
"""
filename = "S1A_IW_GRDM_1SDV_20240416T171946_20240416T172013_053462_067C88_E676.nc"
return os.path.join(filesDir, filename)


@pytest.fixture(scope="session")
def meps_20240416(filesDir):
""" Test file with id and naming_authority.
"""
filename = "meps_mbr000_sfc_20240416T18Z.nc"
return os.path.join(filesDir, filename)


@pytest.fixture(scope="session")
def meps(filesDir):
filename = "meps_det_vdiv_2_5km_20221026T06Z_nansat05.nc"
Expand Down
1 change: 1 addition & 0 deletions tests/test_sarwind.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def testSARWind_set_related_dataset(meps_20240416, s1a_20240416):
assert os.path.isfile(fp.name)
assert not os.path.isfile(fp.name)


@pytest.mark.sarwind
def testSARWind_export(monkeypatch, sarIW_SAFE, meps):
""" Test the export function
Expand Down

0 comments on commit 74452a4

Please sign in to comment.