Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 28 additions & 29 deletions isschecker/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ def _report_not_modelled(
else:
suppressed.add(name)

reporter.write(" \n")
reporter.write("\n")
return suppressed


Expand Down Expand Up @@ -1091,14 +1091,14 @@ def _process_single_experiment(
if experiment_name in [dic["experiment"] for dic in experiments]:
reporter.write("\n ")
reporter.write("**********************************************************\n")
reporter.write(" ** Experiment: " + experiment_name + " \n ")
reporter.write(" ** Experiment: " + experiment_name + "\n ")
reporter.write("**********************************************************\n")
reporter.write("\n ")
if not temp_mandatory_var:
reporter.write(
"Mandatory variables Test: "
+ experiment_name
+ " : all mandatory variables exist. \n"
+ " : all mandatory variables exist.\n"
)
else:
presence_reporter.error(
Expand Down Expand Up @@ -1129,15 +1129,15 @@ def _process_single_experiment(
else:
reporter.write("\n ")
reporter.write("**********************************************************\n")
reporter.write(" ** Experiment: " + experiment_name + " \n ")
reporter.write(" ** Experiment: " + experiment_name + "\n ")
reporter.write("**********************************************************\n")
reporter.write("\n ")
naming_reporter.error(
"The compliance check is ignored for experiment "
+ experiment_name
+ " as it is not in "
+ str([exp["experiment"] for exp in experiments])
+ ". "
+ "."
)
report_naming_issues.append(
"Compliance check ignored : experiment "
Expand Down Expand Up @@ -1216,12 +1216,12 @@ def _process_single_file(
return

if considered_variable not in all_request_variables:
file_reporter.write(" \n")
file_reporter.write("\n")
file_reporter.write(
"Experiment: " + experiment_name + " - File: " + file_name + "\n"
)
file_reporter.write(" \n")
file_reporter.write("NAMING Tests \n")
file_reporter.write("\n")
file_reporter.write("NAMING Tests\n")
message = (
f"'{considered_variable}' (field {ISMIP7_FILENAME_VAR_IDX} of the"
f" file name) is not a variable in the data request"
Expand Down Expand Up @@ -1299,7 +1299,7 @@ def _check_naming(
) -> NamingResult:
filename_years = None

reporter.write("NAMING Tests \n")
reporter.write("NAMING Tests\n")

if not isscalar and not {"x", "y"}.issubset(dim):
reporter.error(
Expand Down Expand Up @@ -1642,7 +1642,7 @@ def _check_numerical(
region: str,
isscalar: bool,
) -> None:
reporter.write("NUMERICAL Tests \n")
reporter.write("NUMERICAL Tests\n")

var_units = ds[ivar].attrs.get("units")
expected_units = ismip_meta[var_index]["units"]
Expand All @@ -1667,7 +1667,6 @@ def _check_numerical(
+ var_units
+ " and should be "
+ expected_units
+ " "
)

if not isscalar and region not in ("AIS", "GrIS"):
Expand Down Expand Up @@ -1719,7 +1718,7 @@ def _check_spatial(
grid_extent: list,
possible_resolution: list,
) -> None:
reporter.write("SPATIAL Tests \n")
reporter.write("SPATIAL Tests\n")
coords = ds.coords.to_dataset()
Xbottomleft = int(min(coords["x"]).values.item())
Ybottomleft = int(min(coords["y"]).values.item())
Expand Down Expand Up @@ -1786,7 +1785,7 @@ def _check_time(
2015, 2016, 2299, 2300 spans the right years with a 365-day first interval
and is 282 time steps short of what was asked for.
"""
reporter.write("TIME Tests \n")
reporter.write("TIME Tests\n")
if not ({"t"}.issubset(dim) or {"time"}.issubset(dim)):
if {"x", "y"}.issubset(dim):
# Static spatial variable (x,y) — no time axis is expected.
Expand Down Expand Up @@ -1953,7 +1952,7 @@ def _check_attributes(
var_type: str,
region: str,
) -> None:
reporter.write("ATTRIBUTE Tests \n")
reporter.write("ATTRIBUTE Tests\n")

# Sub-test 1: global attributes
required_global = ["group", "model", "contact_name", "contact_email"]
Expand Down Expand Up @@ -2125,9 +2124,9 @@ def _run_variable_checks(
time_reporter = reporter.category("time")
attr_reporter = reporter.category("attr", qualifier="attributes")

reporter.write(" \n")
reporter.write("\n")
reporter.write("Experiment: " + experiment_name + " - File: " + file_name + "\n")
reporter.write(" \n")
reporter.write("\n")

header_ds = ds.to_dict(data=False)
dim = set(list(header_ds["coords"].keys()))
Expand Down Expand Up @@ -2159,12 +2158,12 @@ def _run_variable_checks(
ivar = considered_variable
var_index = index
reporter.write("** Tested Variable: " + ivar + "\n")
reporter.write(" \n")
reporter.write("\n")

_check_numerical(num_reporter, ds, ivar, ismip_meta, var_index, region, isscalar)

if not isscalar and region not in ("AIS", "GrIS"):
spatial_reporter.write("SPATIAL Tests \n")
spatial_reporter.write("SPATIAL Tests\n")
spatial_reporter.note(
"Not checked: the expected grid extent and resolutions depend on"
" the region, which the file name does not identify."
Expand Down Expand Up @@ -2242,22 +2241,22 @@ def _write_log_header(
log_file.write(
"************************************************************************************\n"
)
log_file.write(f"isschecker version: {version} \n")
log_file.write(f"isschecker version: {version}\n")
log_file.write("verification criteria: " + criteria_file + "\n")
log_file.write("date: " + today.strftime("%Y/%m/%d") + "\n")
log_file.write("source: https://github.com/ismip/ISM_SimulationChecker \n")
log_file.write(" \n")
log_file.write("source: https://github.com/ismip/ISM_SimulationChecker\n")
log_file.write("\n")
log_file.write(
"------------------------------------------------------------------------------------\n"
)
log_file.write("Verified directory: " + source_path + " \n")
log_file.write("Verified directory: " + source_path + "\n")
log_file.write(
"------------------------------------------------------------------------------------\n"
)
log_file.write(" \n")
log_file.write(" \n")
log_file.write(" \n")
log_file.write(" \n")
log_file.write("\n")
log_file.write("\n")
log_file.write("\n")
log_file.write("\n")
log_file.write(
"====================================================================================\n"
)
Expand All @@ -2267,8 +2266,8 @@ def _write_log_header(
log_file.write(
"====================================================================================\n"
)
log_file.write("Hint: Use Cltr+F to look for specific problems. \n")
log_file.write(" \n")
log_file.write("Hint: Use Cltr+F to look for specific problems.\n")
log_file.write("\n")


# The reporting categories, in the order the synthesis block lists them, with
Expand Down Expand Up @@ -2320,7 +2319,7 @@ def _insert_synthesis(source_path: str, summary: dict) -> None:
# block is separated from the next.
iline += 1
if report_naming_issues:
contents.insert(iline, "Naming tests errors report: \n")
contents.insert(iline, "Naming tests errors report:\n")
iline += 1
for issue in report_naming_issues:
contents.insert(iline, " - " + issue.rstrip("\n") + "\n")
Expand Down
4 changes: 2 additions & 2 deletions isschecker/data/ISMIP7_variable_request.csv
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Ice front melt flux,"x,y,t",FL,lifmassbf,,kg m-2 s-1,yes,Ice mass change resulti
Land ice area fraction,"x,y,t",ST,sftgif,land_ice_area_fraction,1,yes,"Fraction of grid cell covered by land ice (ice sheet, ice shelf, ice cap, glacier)",0,1,0,1,error
Grounded ice sheet area fraction,"x,y,t",ST,sftgrf,grounded_ice_sheet_area_fraction,1,yes,"Fraction of grid cell covered by grounded ice sheet, where grounded indicates that the quantity correspond to the ice sheet that flows over bedrock",0,1,0,1,error
Floating ice sheet area fraction,"x,y,t",ST,sftflf,floating_ice_shelf_area_fraction,1,yes,Fraction of grid cell covered by ice sheet flowing over seawater,0,1,0,1,error
Thermal forcing at the ice base under floating ice shelves,"x,y,t",ST,tfbase,,K,no,Thermal forcing interpolated to the ice draft under floating ice shelves (fill value for purely grounded ice or not ice),-1,30,-1,30,error
Thermal forcing at the ice base under floating ice shelves,"x,y,t",ST,thdrflf,,K,no,Thermal forcing (thermal driving) interpolated to the ice draft under floating ice shelves (fill value for purely grounded ice or not ice),-1,30,-1,30,error
Anomaly in geopotential height from reference geoid,"x,y,t",ST,deltag,geopotential_height_anomaly,m,no,The change in geoid height should be relative to the reference geoid,-4000,4000,-4000,4000,error
Reference geoid,"x,y",ST,refgeoid,geoid_height_above_reference_ellipsoid,m,no,This field is calculated with respect to the WGS84 reference ellipsoid,-500,500,-500,500,error
Ice temperature,"x,y,z,t",ST,litemp,land_ice_temperature,K,no,"3D temperature snapshots at (1900 if in historical), initial state, 2014, 2100, 2200, and 2300. Output on the model native vertical coordinate. Only for models that have 3D temperature calculation",183,274,183,274,error
Expand All @@ -40,4 +40,4 @@ Total BMB flux beneath grounded ice,t,FL,tendlibmassbfgr,tendency_of_land_ice_ma
Total BMB flux beneath floating ice,t,FL,tendlibmassbffl,tendency_of_land_ice_mass_due_to_basal_mass_balance,kg s-1,yes,spatial integration (computed beneath floating ice only),0,1.00E+25,0,1.00E+25,error
Total calving flux,t,FL,tendlicalvf,tendency_of_land_ice_mass_due_to_calving,kg s-1,yes,spatial integration,0,1.00E+25,0,1.00E+25,error
Total ice front melting flux,t,FL,tendlifmassbf,,kg s-1,yes,"spatial integration, should get standard name: tendency_of_land_ice_mass_due_to_ice_front_melting",0,1.00E+25,0,1.00E+25,error
Total grounding line flux,t,FL,tendligroundf,,kg s-1,yes,"spatial integration, should get a standard name",0,1.00E+25,0,1.00E+25,error
Total grounding line flux,t,FL,tendligroundf,,kg s-1,yes,"spatial integration, should get a standard name",0,1.00E+25,0,1.00E+25,error
Loading
Loading