aboutsummaryrefslogtreecommitdiff
path: root/plotter
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2023-09-29 16:48:26 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2023-09-29 16:48:26 +0200
commit5be351dbe7feb4c8cfd28da883a6904ab7fc57b3 (patch)
tree761b45b9914679952a66bafc435a48537ce795d7 /plotter
parent09dbbe809ab6a3728e971a29e7704ffa0ecb93a7 (diff)
downloadmeteo_toolbox-5be351dbe7feb4c8cfd28da883a6904ab7fc57b3.tar.gz
global product index
Diffstat (limited to 'plotter')
-rwxr-xr-xplotter/horizontal.py8
-rwxr-xr-xplotter/vertical_from_grib.py8
2 files changed, 14 insertions, 2 deletions
diff --git a/plotter/horizontal.py b/plotter/horizontal.py
index a81b372..e83b683 100755
--- a/plotter/horizontal.py
+++ b/plotter/horizontal.py
@@ -37,8 +37,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, name, layers, area = None):
index = []
@@ -88,6 +92,8 @@ def _plot(data, output, name, layers, area = None):
with open(os.path.join(output, f'{name}.index.json'), 'w') as f:
f.write(json.dumps(index, indent=4))
+ return { 'name': name, 'indexfile': f'{name}.index.json' }
+
def _layer(data, layertype, **kwargs):
layertypes={
'raster': {
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)