Skip to content

Commit

Permalink
Use nearest for llm with vis06
Browse files Browse the repository at this point in the history
Use nearest neighbour when combining with cloud mask
  • Loading branch information
gerritholl committed Jan 24, 2025
1 parent 310f6d8 commit 2e48efe
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
20 changes: 10 additions & 10 deletions satpy/tests/behave/features/image_comparison.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ Feature: Image Comparison

Scenario Outline: Compare generated image with reference image
Given I have a <composite> reference image file from <satellite> resampled to <area>
When I generate a new <composite> image file from <satellite> case <case> with <reader> for <area> with clipping <clip>
When I generate a new <composite> image file from <satellite> case <case> with <reader> for <area> resampling with <resampler> with clipping <clip>
Then the generated image should be the same as the reference image

Examples:
|satellite | case | composite | reader | area | clip |
|Meteosat-12 | scan_night | cloudtop | fci_l1c_nc | sve | True |
|Meteosat-12 | scan_night | night_microphysics | fci_l1c_nc | sve | True |
|Meteosat-12 | mali_day | essl_colorized_low_level_moisture | fci_l1c_nc | mali | False |
|Meteosat-12 | spain_day | colorized_low_level_moisture_with_vis06 | fci_l1c_nc,fci_l2_nc | spain | False |
|GOES17 | americas_night | airmass | abi_l1b | null | null |
|GOES16 | americas_night | airmass | abi_l1b | null | null |
|GOES16 | americas_night | ash | abi_l1b | null | null |
|GOES17 | americas_night | ash | abi_l1b | null | null |
|satellite | case | composite | reader | area | resampler | clip |
|Meteosat-12 | scan_night | cloudtop | fci_l1c_nc | sve | gradient_search | True |
|Meteosat-12 | scan_night | night_microphysics | fci_l1c_nc | sve | gradient_search | True |
|Meteosat-12 | mali_day | essl_colorized_low_level_moisture | fci_l1c_nc | mali | gradient_search | False |
|Meteosat-12 | spain_day | colorized_low_level_moisture_with_vis06 | fci_l1c_nc,fci_l2_nc | nearest | spain | False |
|GOES17 | americas_night | airmass | abi_l1b | null | null | null |
|GOES16 | americas_night | airmass | abi_l1b | null | null | null |
|GOES16 | americas_night | ash | abi_l1b | null | null | null |
|GOES17 | americas_night | ash | abi_l1b | null | null | null |
6 changes: 3 additions & 3 deletions satpy/tests/behave/features/steps/image_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def step_given_reference_image(context, composite, satellite, area):


@when("I generate a new {composite} image file from {satellite} case {case} "
"with {reader} for {area} with clipping {clip}")
def step_when_generate_image(context, composite, satellite, case, reader, area, clip):
"with {reader} for {area} resampling with {resampler} with clipping {clip}")
def step_when_generate_image(context, composite, satellite, case, reader, area, resampler,clip):
"""Generate test images."""
os.environ["OMP_NUM_THREADS"] = os.environ["MKL_NUM_THREADS"] = "2"
os.environ["PYTROLL_CHUNK_SIZE"] = "1024"
Expand All @@ -86,7 +86,7 @@ def step_when_generate_image(context, composite, satellite, case, reader, area,
if area == "null":
ls = scn
else:
ls = scn.resample(area, resampler="gradient_search")
ls = scn.resample(area, resampler=resampler)

# Save the generated image in the generated folder
generated_image_path = os.path.join(context.test_results_dir, "generated",
Expand Down
4 changes: 3 additions & 1 deletion utils/create_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,17 @@ def generate_images(props):

if "," in props.reader:
reader = props.reader.split(",")
resampler = "nearest" # use nearest when combining with cloud mask
else:
reader = props.reader
resampler = "gradient_search"
scn = Scene(reader=reader, filenames=filenames)

scn.load(props.composites)
if props.area == "native":
ls = scn.resample(resampler="native")
elif props.area is not None:
ls = scn.resample(props.area, resampler="gradient_search")
ls = scn.resample(props.area, resampler=resampler)
else:
ls = scn

Expand Down

0 comments on commit 2e48efe

Please sign in to comment.