Skip to content

Commit

Permalink
Use euro4 as backup if bb_area failes
Browse files Browse the repository at this point in the history
  • Loading branch information
Trygve Aspenes committed Nov 6, 2023
1 parent e2445d4 commit 8c0e45f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions mapgen/modules/satellite_satpy_quicklook.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,18 +226,22 @@ def _generate_satpy_geotiff(netcdf_paths, satpy_products_to_generate, start_time
print("Need to generate: ", satpy_products)
print(datetime.now(), "Before Scene")
swath_scene = Scene(filenames=netcdf_paths, reader='satpy_cf_nc')
print(datetime.now(), "Before load")
print(datetime.now(), "Before load, resolution:", resolution)
swath_scene.load(satpy_products, resolution=resolution)
print("Available composites names:", swath_scene.available_composite_names())
proj_dict = {'proj': 'omerc',
'ellps': 'WGS84'}

print(datetime.now(), "Before compute optimal bb area")
bb_area = swath_scene.coarsest_area().compute_optimal_bb_area(proj_dict=proj_dict)
print(bb_area)
print(bb_area.pixel_size_x)
print(bb_area.pixel_size_y)

try:
bb_area = swath_scene.coarsest_area().compute_optimal_bb_area(proj_dict=proj_dict)
print(bb_area)
print(bb_area.pixel_size_x)
print(bb_area.pixel_size_y)
except KeyError:
# Need a backup overview area if bb_area doesn't work
print("Can not compute bb area. Use euro4 as backup.")
bb_area = 'euro4'
print(datetime.now(), "Before resample")
resample_scene = swath_scene.resample(bb_area)
print(datetime.now(), "Before save")
Expand Down

0 comments on commit 8c0e45f

Please sign in to comment.