#!/usr/bin/env python3 # -*- coding: utf-8 -*- # I need from glob import glob # Pytroll/SatPy needs from satpy import Scene from satpy.writers import compute_writer_results sat = 'NOAA20' reader = 'viirs_compact' area = 'switzerland' # Available composites: See files ../satpy/etc/composites/visir.yaml and viirs.yaml # ********************************************************************************* # ['ash', 'cloudtop_daytime', 'dust', 'false_color', 'fire_temperature', # 'fire_temperature_39refl', 'fire_temperature_awips', 'fire_temperature_eumetsat', # 'fog', 'ir108_3d', 'ir_cloud_day', 'natural_color', 'natural_color_sun_lowres', # 'natural_with_night_fog', 'night_fog', 'ocean_color', 'overview', 'snow_age', # 'snow_lowres', 'true_color', 'true_color_lowres', 'true_color_lowres_crefl', # 'true_color_lowres_land', 'true_color_lowres_marine_tropical', 'true_color_raw'] composites = ['natural_color'] cachedir = './cache' outdir = './images' my_grid = {'major_lonlat': (10,10), 'minor_lonlat': (2, 2), 'outline': (255, 255, 255), 'outline_opacity': 127,'minor_outline': (0, 200, 200),'minor_outline_opacity': 127, 'width': 15.5, 'minor_width': 10.0, 'minor_is_tick': False, 'write_text': False} for generate in [True, False]: for OVRcache in [True, False]: for fill_value in [0, 255, None]: ext = area+'-generate'+str(generate)+'-cache'+str(OVRcache)+'-fill_value'+str(fill_value) my_cache = {'file': cachedir + '/' + ext + '-', 'regenerate': False} my_overlays = {} my_overlays['grid'] = my_grid if OVRcache: # Add key cache my_overlays['cache'] = my_cache scn = Scene(filenames=glob('./data/SVMC_j01*5'), reader=reader) scn.load(composites, generate=generate) new_scn = scn.resample(area, resampler='nearest', reduce_data=False) if generate: for composite in composites: new_scn.save_dataset(composite, outdir+'/'+sat+'-'+composite+'-'+ext+'.png', overlay = {'coast_dir': '.', 'overlays' : my_overlays}, fill_value=fill_value) else: save_objects = [] for composite in composites: save_objects.append(new_scn.save_dataset(composite, base_dir='.', filename = outdir+'/'+sat+'-{name}-'+ext+'.png', overlay = {'coast_dir': '.', 'overlays' : my_overlays}, compute=False, fill_value=fill_value)) compute_writer_results(save_objects)