From 5be351dbe7feb4c8cfd28da883a6904ab7fc57b3 Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Fri, 29 Sep 2023 16:48:26 +0200 Subject: global product index --- plotter/vertical_from_grib.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'plotter/vertical_from_grib.py') diff --git a/plotter/vertical_from_grib.py b/plotter/vertical_from_grib.py index 8aa851a..929782e 100755 --- a/plotter/vertical_from_grib.py +++ b/plotter/vertical_from_grib.py @@ -29,8 +29,12 @@ def run(source, plots, output='.'): misc.create_output_dir(output) data = xr.load_dataset(source, engine='cfgrib') + index = [] + for plot in plots: - _plot(data, output, **plot) + index.append(_plot(data, output, **plot)) + + return index def _plot(data, output, lat, lon, name, analysis=None): for_temp = data.sel(latitude=lat, longitude = lon, method='nearest') @@ -84,5 +88,7 @@ def _plot(data, output, lat, lon, name, analysis=None): with open(os.path.join(output, f'skewt_{name}.index.json'), 'w') as f: f.write(json.dumps(index, indent=4)) + return {'name': name, 'indexfile': f'skewt_{name}.index.json'} + if __name__ == '__main__': run(**config) -- cgit v1.2.3