Skip to content

Commit e816df6

Browse files
committed
merge with dev
2 parents 2f84d73 + 00cd79a commit e816df6

File tree

13 files changed

+294
-121
lines changed

13 files changed

+294
-121
lines changed

doc/source/overview/loc.rst

Lines changed: 75 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,25 +77,93 @@ it is not necessarily defined in this file. The fields are described in the tabl
7777
- Maximum elevation [°] to consider.
7878
* - ppiImageConfig
7979
- STRUCT
80-
- Structure defining the PPI image generating (PPI_IMAGE or PSEUDOPPI_IMAGE products).
80+
- Structure defining the PPI image generating (PPI_IMAGE or PSEUDOPPI_IMAGE products). It can contain the following keys:
81+
82+
- dpi: INT: dpi of the output image
83+
- xsize: FLOAT: width of the image in inches
84+
- ysize: FLOAT: height of the image in inches
85+
- ymin: FLOAT: minimum displayed y-coordinate (northwards, in radar centric coordinates)
86+
- ymax: FLOAT: minimum displayed y-coordinate (northwards, in radar centric coordinates)
87+
- xmin: FLOAT: minimum displayed x-coordinate (eastwards, in radar centric coordinates)
88+
- xmax: FLOAT: minimum displayed x-coordinate (northwards, in radar centric coordinates)
89+
- rngRing: INT: if defined will plot range rings every x kilometers from the radar (x is the specified value)
8190
* - rhiImageConfig
8291
- STRUCT
83-
- Structure defining the RHI image generating (RHI_IMAGE or PSEUDORHI_IMAGE products).
92+
- Structure defining the RHI image generating (RHI_IMAGE or PSEUDORHI_IMAGE products). It can contain the following keys:
93+
94+
- dpi: INT: dpi of the output image
95+
- xsize: FLOAT: width of the image in inches
96+
- ysize: FLOAT: height of the image in inches
97+
- ymin: FLOAT: minimum displayed y-coordinate (altitude)
98+
- ymax: FLOAT: minimum displayed y-coordinate (altitude)
99+
- xmin: FLOAT: minimum displayed x-coordinate (distance at ground along RHI)
100+
- xmax: FLOAT: minimum displayed x-coordinate (distance at ground along RHI)
84101
* - ppiMapImageConfig
85102
- STRUCT
86-
- Structure defining the PPI image overlaid on a map (PPI_MAP product).
103+
- Structure defining the PPI image overlaid on a map (PPI_MAP product). It can contain the following keys:
104+
105+
- dpi: INT: dpi of the output image
106+
- xsize: FLOAT: width of the image in inches
107+
- ysize: FLOAT: height of the image in inches
108+
- min_lon: FLOAT: minimum displayed longitude
109+
- max_lon: FLOAT: maximum displayed longitude
110+
- min_lat: FLOAT: minimum displayed latitude
111+
- max_lat: FLOAT: maximum displayed latitude
112+
- resolution: INT: resolution of additional cartopy geodata, only "10m", "50m" or "110m" is supported
113+
- alpha: FLOAT: transparency value (between 0 and 1) of the displayed radar data, alpha smaller than 1 is required when plotting over a relief or OTM map
114+
- background_zoom: INT: Zoom level of the additional cartopy raster geodata, the higher the value, the higher the resolution (typically between 8 and 12). Default is 8.
115+
- maps: list of STRING: list of additional geodata to plot. The following are supported: relief (hillshade), OTM (opentopomaps), provinces, urban_areas, roads, railroads, coastlines, lakes, lakes_europe, rivers, rivers_europe.
116+
- rngRing: INT: if defined will plot range rings every x kilometers from the radar (x is the specified value)
87117
* - gridMapImageConfig
88118
- STRUCT
89-
- Structure defining the display of gridded data overlaid on a map (SURFACE_IMAGE product).
119+
- Structure defining the display of gridded data overlaid on a map (SURFACE_IMAGE product). It can contain the following keys:
120+
121+
- dpi: INT: dpi of the output image
122+
- xsize: FLOAT: width of the image in inches
123+
- ysize: FLOAT: height of the image in inches
124+
- min_lon: FLOAT: minimum displayed longitude
125+
- max_lon: FLOAT: maximum displayed longitude
126+
- min_lat: FLOAT: minimum displayed latitude
127+
- max_lat: FLOAT: maximum displayed latitude
128+
- resolution: INT: resolution of additional cartopy geodata, only "10m", "50m" or "110m" is supported
129+
- alpha: FLOAT: transparency value (between 0 and 1) of the displayed radar data, alpha smaller than 1 is required when plotting over a relief or OTM map
130+
- background_zoom: INT: Zoom level of the additional cartopy raster geodata, the higher the value, the higher the resolution (typically between 8 and 12). Default is 8.
131+
- maps: list of STRING: list of additional geodata to plot. The following are supported: relief (hillshade), OTM (opentopomaps), provinces, urban_areas, roads, railroads, coastlines, lakes, lakes_europe, rivers, rivers_europe.
90132
* - xsecImageConfig
91133
- STRUCT
92-
- Structure defining the cross-section images generated from gridded data (CROSS_SECTION, LATITUDE_SLICE and LONGITUDE_SLICE products).
134+
- Structure defining the cross-section images generated from gridded data (CROSS_SECTION, LATITUDE_SLICE and LONGITUDE_SLICE products). It can contain the following keys:
135+
136+
- dpi: INT: dpi of the output image
137+
- xsize: FLOAT: width of the image in inches
138+
- ysize: FLOAT: height of the image in inches
139+
- ymin: FLOAT: minimum displayed y-coordinate (altitude)
140+
- ymax: FLOAT: minimum displayed y-coordinate (altitude)
141+
- xmin: FLOAT: minimum displayed x-coordinate (distance at ground along cross-section)
142+
- xmax: FLOAT: minimum displayed x-coordinate (distance at ground along cross-section)
93143
* - spectraImageConfig
94144
- STRUCT
95-
- Structure defining the Doppler spectral plots.
145+
- Structure defining the Doppler spectral plots (radar observable as a function of altitude and velocity). It can contain the following keys:
146+
147+
- dpi: INT: dpi of the output image
148+
- xsize: FLOAT: width of the image in inches
149+
- ysize: FLOAT: height of the image in inches
150+
- ymin: FLOAT: minimum displayed y-coordinate (altitude)
151+
- ymax: FLOAT: minimum displayed y-coordinate (altitude)
152+
- velmin: FLOAT: minimum displayed velocity
153+
- velmax: FLOAT: minimum displayed velocity
96154
* - sunhitsImageConfig
97155
- STRUCT
98-
- Structure defining the sun hits image.
156+
- Structure defining the sun hits image. It shows the sun observables as a function of azimuth and elevation. It can contain the following keys:
157+
158+
- dpi: INT: dpi of the output image
159+
- xsize: FLOAT: width of the image in inches
160+
- ysize: FLOAT: height of the image in inches
161+
- azmin: FLOAT: minimum displayed azimuth angle
162+
- azmax: FLOAT: minimum displayed azimuth angle
163+
- elmin: FLOAT: minimum displayed elevation angle
164+
- elmax: FLOAT: minimum displayed elevation angle
165+
- azres: FLOAT: azimuth step to use in the plot
166+
- elres: FLOAT: elevation step to use in the plot
99167
* - azPatternFile
100168
- STRING
101169
- Name of the azimuth pattern file of the antenna. This file and path must be ``<configpath>/antenna/<azPatternFile>``.

doc/source/userguide/usage.rst

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ Configuration files
88
Pyrad uses 3 different configuration files which are typically stored in the folder::
99
*pyrad/config/processing/*
1010

11-
The first file specifies the input data, output data and configuration files packages, the second
12-
specifies radar related parameters (radar name, scan name and frequency, etc.) and the general
13-
configuration of the various image output, the last file specifies the datasets and products to be
11+
The first file specifies the input data, output data and configuration files packages, the second
12+
specifies radar related parameters (radar name, scan name and frequency, etc.) and the general
13+
configuration of the various image output, the last file specifies the datasets and products to be
1414
produced.
1515

16-
The easiest way to start is to copy one of the available config files and modify it according to your
17-
needs.
16+
The easiest way to start is to copy one of the available config files and modify it according to your
17+
needs.
1818

1919
Examples of pyrad config files are available in the repository https://github.com/MeteoSwiss/pyrad-examples/.
2020

@@ -27,7 +27,7 @@ To run the programs first you need to activate the conda pyrad environment::
2727
conda activate pyrad
2828

2929
A number of script are available as executables. You can use them by simply typing::
30-
30+
3131
[name_of_the_program] [arguments]
3232

3333
At the moment there are three main programs:
@@ -36,9 +36,14 @@ main_process_data.py
3636
will process (and optionally post-process) data from a starting point in time to an ending point in time.
3737

3838
main_process_data_period.py
39-
will process (and optionally post-process) data over several days starting the processing at a given starting and ending time (default 00:00:00 for start and 23:59:59 for
39+
will process (and optionally post-process) data over several days starting the processing at a given starting and ending time (default 00:00:00 for start and 23:59:59 for
4040
the end).
4141

4242
main_process_gecsx.py
43-
will run the GECSX algorithm (visibility and clutter estimation from a DEM map)
43+
will run the GECSX algorithm (visibility and clutter estimation from a DEM map)
44+
45+
Caching data
46+
---------------------------
4447

48+
To avoid repeating multiple http requests, such as when retrieving radiosounding or geodata, pyrad caches some files. By default the cache directory is *$HOME/pyrad_cache*. It can be overriden
49+
by defining the environment variable $PYRAD_CACHE.

src/pyrad_proc/pyrad/flow/flow_control.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import os
2222
from datetime import datetime
2323
from datetime import timedelta
24+
from datetime import timezone
2425
import gc
2526
import subprocess
2627
import queue
@@ -308,7 +309,7 @@ def main(
308309
bokeh_plot,
309310
filename=(
310311
profile_path
311-
+ datetime.utcnow().strftime("%Y%m%d%H%M%S")
312+
+ datetime.now(timezone.utc).strftime("%Y%m%d%H%M%S")
312313
+ "_profile.png"
313314
),
314315
)
@@ -376,7 +377,7 @@ def main_rt(
376377

377378
# The processing will be allowed to run for a limited period
378379
if proc_finish is not None:
379-
startime_proc = datetime.utcnow()
380+
startime_proc = datetime.now(timezone.utc)
380381
# for offline testing
381382
# startime_proc = startime_proc.replace(
382383
# year=endtime.year, month=endtime.month, day=endtime.day)
@@ -455,7 +456,7 @@ def main_rt(
455456
except queue.Empty:
456457
pass
457458

458-
nowtime = datetime.utcnow()
459+
nowtime = datetime.now(timezone.utc)
459460
# for offline testing
460461
# nowtime = nowtime.replace(
461462
# year=endtime.year, month=endtime.month, day=endtime.day)
@@ -548,7 +549,7 @@ def main_rt(
548549

549550
gc.collect()
550551

551-
nowtime_new = datetime.utcnow()
552+
nowtime_new = datetime.now(timezone.utc)
552553
# for offline testing
553554
# nowtime_new = nowtime_new.replace(
554555
# year=endtime.year, month=endtime.month, day=endtime.day)
@@ -742,7 +743,7 @@ def main_cosmo_rt(
742743

743744
# The processing will be allowed to run for a limited period
744745
if proc_finish is not None:
745-
startime_proc = datetime.utcnow()
746+
startime_proc = datetime.now(timezone.utc)
746747
# for offline testing
747748
# startime_proc = startime_proc.replace(
748749
# year=endtime.year, month=endtime.month, day=endtime.day)
@@ -821,7 +822,7 @@ def main_cosmo_rt(
821822
except queue.Empty:
822823
pass
823824

824-
nowtime = datetime.utcnow()
825+
nowtime = datetime.now(timezone.utc)
825826
# for offline testing
826827
# nowtime = nowtime.replace(
827828
# year=endtime.year, month=endtime.month, day=endtime.day)
@@ -905,7 +906,7 @@ def main_cosmo_rt(
905906

906907
gc.collect()
907908

908-
nowtime_new = datetime.utcnow()
909+
nowtime_new = datetime.now(timezone.utc)
909910
# for offline testing
910911
# nowtime_new = nowtime_new.replace(
911912
# year=endtime.year, month=endtime.month, day=endtime.day)
@@ -978,10 +979,10 @@ def main_gecsx(cfgfile, starttime=None, endtime=None, infostr="", gather_plots=T
978979
datacfg = _create_datacfg_dict(cfg)
979980

980981
if starttime is None:
981-
starttime = datetime.now()
982+
starttime = datetime.now(timezone.utc)
982983
endtime = starttime
983984
if endtime is None:
984-
endtime = datetime.now()
985+
endtime = datetime.now(timezone.utc)
985986

986987
if infostr:
987988
print("- Info string : {}".format(infostr))

src/pyrad_proc/pyrad/graph/plots.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def plot_pos(
152152

153153
if save_fig:
154154
for fname in fname_list:
155-
fig.savefig(fname, dpi=dpi)
155+
fig.savefig(fname, dpi=dpi, bbox_inches="tight")
156156
plt.close(fig)
157157

158158
return fname_list
@@ -323,7 +323,7 @@ def plot_pos_map(
323323

324324
if save_fig:
325325
for fname in fname_list:
326-
fig.savefig(fname, dpi=dpi)
326+
fig.savefig(fname, dpi=dpi, bbox_inches="tight")
327327
plt.close(fig)
328328

329329
return fname_list
@@ -513,7 +513,7 @@ def plot_density(
513513
ax.grid()
514514

515515
for fname in fname_list:
516-
fig.savefig(fname, dpi=dpi)
516+
fig.savefig(fname, dpi=dpi, bbox_inches="tight")
517517
plt.close(fig)
518518

519519
return fname_list
@@ -633,7 +633,7 @@ def plot_scatter(
633633
fig.tight_layout()
634634

635635
for fname in fname_list:
636-
fig.savefig(fname, dpi=dpi)
636+
fig.savefig(fname, dpi=dpi, bbox_inches="tight")
637637
plt.close(fig)
638638

639639
return fname_list
@@ -728,7 +728,7 @@ def plot_centroids(
728728
fig.tight_layout()
729729

730730
for fname in fname_list:
731-
fig.savefig(fname, dpi=dpi)
731+
fig.savefig(fname, dpi=dpi, bbox_inches="tight")
732732
plt.close(fig)
733733

734734
return fname_list
@@ -784,7 +784,7 @@ def plot_quantiles(
784784
ax.grid()
785785

786786
for fname in fname_list:
787-
fig.savefig(fname, dpi=dpi)
787+
fig.savefig(fname, dpi=dpi, bbox_inches="tight")
788788
plt.close(fig)
789789

790790
return fname_list
@@ -845,7 +845,7 @@ def plot_histogram(
845845
fig.tight_layout()
846846

847847
for fname in fname_list:
848-
fig.savefig(fname, dpi=dpi)
848+
fig.savefig(fname, dpi=dpi, bbox_inches="tight")
849849
plt.close(fig)
850850

851851
return fname_list
@@ -927,7 +927,7 @@ def plot_histogram2(
927927

928928
if save_fig:
929929
for fname in fname_list:
930-
fig.savefig(fname, dpi=dpi)
930+
fig.savefig(fname, dpi=dpi, bbox_inches="tight")
931931
plt.close(fig)
932932

933933
return fname_list
@@ -1016,7 +1016,7 @@ def plot_antenna_pattern(
10161016
fig.tight_layout()
10171017

10181018
for fname in fname_list:
1019-
fig.savefig(fname, dpi=dpi)
1019+
fig.savefig(fname, dpi=dpi, bbox_inches="tight")
10201020
plt.close(fig)
10211021

10221022
return fname_list
@@ -1081,7 +1081,7 @@ def plot_selfconsistency(
10811081

10821082
if save_fig:
10831083
for fname in fname_list:
1084-
fig.savefig(fname, dpi=dpi)
1084+
fig.savefig(fname, dpi=dpi, bbox_inches="tight")
10851085
plt.close(fig)
10861086

10871087
return fname_list
@@ -1719,7 +1719,7 @@ def plot_scatter_comp(
17191719

17201720
if save_fig:
17211721
for fname in fname_list:
1722-
fig.savefig(fname, dpi=dpi)
1722+
fig.savefig(fname, dpi=dpi, bbox_inches="tight")
17231723
plt.close(fig)
17241724

17251725
return fname_list
@@ -1799,7 +1799,7 @@ def plot_sun_hits(field, field_name, fname_list, prdcfg):
17991799
fig.tight_layout()
18001800

18011801
for fname in fname_list:
1802-
fig.savefig(fname, dpi=dpi)
1802+
fig.savefig(fname, dpi=dpi, bbox_inches="tight")
18031803
plt.close(fig)
18041804

18051805
return fname_list
@@ -1916,7 +1916,7 @@ def _plot_sunscan(
19161916

19171917
if save_fig:
19181918
for fname in fname_list:
1919-
fig.savefig(fname, dpi=dpi)
1919+
fig.savefig(fname, dpi=dpi, bbox_inches="tight")
19201920
plt.close(fig)
19211921

19221922
return fname_list
@@ -2028,7 +2028,7 @@ def _plot_time_range(
20282028

20292029
if save_fig:
20302030
for fname in fname_list:
2031-
fig.savefig(fname, dpi=dpi)
2031+
fig.savefig(fname, dpi=dpi, bbox_inches="tight")
20322032
plt.close(fig)
20332033

20342034
return fname_list

0 commit comments

Comments
 (0)