Skip to content

Commit 9fcf2ce

Browse files
committed
ENH: better layout in products rst overview
1 parent 855befb commit 9fcf2ce

File tree

4 files changed

+26
-32
lines changed

4 files changed

+26
-32
lines changed

ci/parse_pyrad_products.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ def dict_to_restructured_text(yaml_data):
6565
rst_output.append('""""""""""""""""""""""""""""""')
6666
rst_output.append("description")
6767
rst_output.append(
68-
" " + prodinfo["description"] + f'\n `[Source] <{prodinfo["link"]}>`_'
68+
" | "
69+
+ prodinfo["description"].replace("###", "\n |")
70+
+ f'\n `[Source] <{prodinfo["link"]}>`_'
6971
)
7072
params = parameters_to_dict(prodinfo["parameters"])
7173
if len(params):
@@ -96,7 +98,7 @@ def process_file(filepath):
9698
# clear buffer
9799
try:
98100
all_products[function][product]["description"] = " ".join(
99-
descr.replace("\n", "").split()
101+
descr.split()
100102
)
101103
except (KeyError, UnboundLocalError, TypeError):
102104
pass
@@ -124,25 +126,23 @@ def process_file(filepath):
124126
try:
125127
if product in all_products[function]:
126128
all_products[function][product]["description"] = " ".join(
127-
descr.replace("\n", "").split()
129+
descr.split()
128130
)
129131
except TypeError:
130132
pass
131133

132134
product = match[0].replace("'", "").split(":")[0].strip()
133-
descr = line.split(":")[1].strip()
135+
descr = line.split(":")[1].strip() + "###"
134136
all_products[function][product] = {}
135137
all_products[function][product]["parameters"] = ""
136138
continue
137139
if "User defined parameters" in line:
138-
all_products[function][product]["description"] = " ".join(
139-
descr.replace("\n", "").split()
140-
)
140+
all_products[function][product]["description"] = " ".join(descr.split())
141141
reading_params = True
142142
reading_title = False
143143
continue
144144
if reading_title:
145-
descr += line
145+
descr += line + "###"
146146
if reading_params and product:
147147
all_products[function][product]["parameters"] += " " + line
148148
if ('prdcfg["type"]' in line or "prdcfg['type']" in line) and "==" in line:
@@ -153,9 +153,7 @@ def process_file(filepath):
153153
)
154154

155155
if reading_title:
156-
all_products[function][product]["description"] = " ".join(
157-
descr.replace("\n", "").split()
158-
)
156+
all_products[function][product]["description"] = " ".join(descr.split())
159157

160158
return all_products
161159

src/pyrad_proc/pyrad/prod/process_grid_products.py

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def generate_grid_products(dataset, prdcfg):
161161
'CROSS_SECTION': Plots a cross-section of gridded data
162162
User defined parameters:
163163
voltype: str
164-
name of the pyrad variable to use, it must be available in the dataset in the dataset
164+
name of the pyrad variable to use, it must be available in the dataset
165165
coord1, coord2: dict
166166
The two lat-lon coordinates marking the limits. They have
167167
the keywords 'lat' and 'lon' [degree]. The altitude limits
@@ -170,7 +170,7 @@ def generate_grid_products(dataset, prdcfg):
170170
'HISTOGRAM': Computes a histogram of the radar volum data
171171
User defined parameters:
172172
voltype: str
173-
name of the pyrad variable to use, it must be available in the dataset in the dataset
173+
name of the pyrad variable to use, it must be available in the dataset
174174
step: float or None
175175
the data quantization step. If none it will be obtained
176176
from the Py-ART configuration file
@@ -185,7 +185,7 @@ def generate_grid_products(dataset, prdcfg):
185185
constant latitude.
186186
User defined parameters:
187187
voltype: str
188-
name of the pyrad variable to use, it must be available in the dataset in the dataset
188+
name of the pyrad variable to use, it must be available in the dataset
189189
lon, lat: floats
190190
The starting point of the cross-section. The ending point
191191
is defined by the parameters in 'xsecImageConfig' in the
@@ -194,7 +194,7 @@ def generate_grid_products(dataset, prdcfg):
194194
constant longitude.
195195
User defined parameters:
196196
voltype: str
197-
name of the pyrad variable to use, it must be available in the dataset in the dataset
197+
name of the pyrad variable to use, it must be available in the dataset
198198
lon, lat: floats
199199
The starting point of the cross-section. The ending point
200200
is defined by the parameters in 'xsecImageConfig' in the
@@ -210,7 +210,7 @@ def generate_grid_products(dataset, prdcfg):
210210
'SAVEVOL': Saves on field of a gridded data object in a netcdf file.
211211
User defined parameters:
212212
voltype: str
213-
name of the pyrad variable to use, it must be available in the dataset in the dataset
213+
name of the pyrad variable to use, it must be available in the dataset
214214
file_type: str
215215
The type of file used to save the data. Can be 'nc' or
216216
'h5'. Default 'nc'
@@ -232,30 +232,30 @@ def generate_grid_products(dataset, prdcfg):
232232
a file.
233233
User defined parameters:
234234
voltype: str
235-
name of the pyrad variable to use, it must be available in the dataset in the dataset
235+
name of the pyrad variable to use, it must be available in the dataset
236236
stat: str
237237
The statistic used. Can be mean, median, min, max
238238
'SURFACE_RAW': Plots a surface image of gridded data without
239239
projecting it into a map
240240
User defined parameters:
241241
voltype: str
242-
name of the pyrad variable to use, it must be available in the dataset in the dataset
242+
name of the pyrad variable to use, it must be available in the dataset
243243
level: int
244244
The altitude level to plot. The rest of the parameters are
245245
defined by the parameters in 'ppiImageConfig' and
246246
'ppiMapImageConfig' in the 'loc' configuration file
247247
'SURFACE_IMAGE': Plots a surface image of gridded data.
248248
User defined parameters:
249249
voltype: str
250-
name of the pyrad variable to use, it must be available in the dataset in the dataset
250+
name of the pyrad variable to use, it must be available in the dataset
251251
level: int
252252
The altitude level to plot. The rest of the parameters are
253253
defined by the parameters in 'ppiImageConfig' and
254254
'ppiMapImageConfig' in the 'loc' configuration file
255255
'SURFACE_CONTOUR': Plots a surface image of contour gridded data.
256256
User defined parameters:
257257
voltype: str
258-
name of the pyrad variable to use, it must be available in the dataset in the dataset
258+
name of the pyrad variable to use, it must be available in the dataset
259259
level: int
260260
The altitude level to plot. The rest of the parameters are
261261
defined by the parameters in 'ppiImageConfig' and
@@ -274,7 +274,7 @@ def generate_grid_products(dataset, prdcfg):
274274
Plots a surface image of gridded data with a contour overplotted.
275275
User defined parameters:
276276
voltype: str
277-
name of the pyrad variable to use, it must be available in the dataset in the dataset
277+
name of the pyrad variable to use, it must be available in the dataset
278278
level: int
279279
The altitude level to plot. The rest of the parameters are
280280
defined by the parameters in 'ppiImageConfig' and
@@ -293,7 +293,7 @@ def generate_grid_products(dataset, prdcfg):
293293
Plots on the same surface two images, one on top of the other.
294294
User defined parameters:
295295
voltype: str
296-
name of the pyrad variable to use, it must be available in the dataset in the dataset
296+
name of the pyrad variable to use, it must be available in the dataset
297297
level: int
298298
The altitude level to plot. The rest of the parameters are
299299
defined by the parameters in 'ppiImageConfig' and
@@ -309,7 +309,7 @@ def generate_grid_products(dataset, prdcfg):
309309
The pyDDA package is required
310310
User defined parameters:
311311
voltype: str
312-
name of the pyrad variable to use, it must be available in the dataset in the dataset
312+
name of the pyrad variable to use, it must be available in the dataset
313313
level: int
314314
The altitude level to plot. The rest of the parameters are
315315
defined by the parameters in 'ppiImageConfig' and
@@ -347,7 +347,7 @@ def generate_grid_products(dataset, prdcfg):
347347
The pyDDA package is required
348348
User defined parameters:
349349
voltype: str
350-
name of the pyrad variable to use, it must be available in the dataset in the dataset
350+
name of the pyrad variable to use, it must be available in the dataset
351351
level: int
352352
The longitude level to plot. The rest of the parameters are
353353
defined by the parameters in 'xsecImageConfig' in the 'loc'
@@ -385,7 +385,7 @@ def generate_grid_products(dataset, prdcfg):
385385
The pyDDA package is required
386386
User defined parameters:
387387
voltype: str
388-
name of the pyrad variable to use, it must be available in the dataset in the dataset
388+
name of the pyrad variable to use, it must be available in the dataset
389389
level: int
390390
The latitude level to plot. The rest of the parameters are
391391
defined by the parameters in 'xsecImageConfig' in the 'loc'
@@ -1153,7 +1153,6 @@ def generate_grid_products(dataset, prdcfg):
11531153
return fname
11541154

11551155
if prdcfg["type"] == "DDA_MAP":
1156-
11571156
display_type = prdcfg.get("display_type", "quiver")
11581157
if display_type not in ["quiver", "barbs", "streamline"]:
11591158
warn("Invalid display_type, must be " + '"streamline", "quiver" or "barbs"')
@@ -1214,7 +1213,6 @@ def generate_grid_products(dataset, prdcfg):
12141213
print("----- save to " + " ".join(fname_list))
12151214

12161215
if prdcfg["type"] == "DDA_LONGITUDE_SLICE":
1217-
12181216
display_type = prdcfg.get("display_type", "quiver")
12191217
if display_type not in ["quiver", "barbs", "streamline"]:
12201218
warn("Invalid display_type, must be " + '"streamline", "quiver" or "barbs"')
@@ -1287,7 +1285,6 @@ def generate_grid_products(dataset, prdcfg):
12871285
print("----- save to " + " ".join(fname_list))
12881286

12891287
if prdcfg["type"] == "DDA_LATITUDE_SLICE":
1290-
12911288
display_type = prdcfg.get("display_type", "quiver")
12921289
if display_type not in ["quiver", "barbs", "streamline"]:
12931290
warn("Invalid display_type, must be " + '"streamline", "quiver" or "barbs"')

src/pyrad_proc/pyrad/prod/process_monitoring_products.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def generate_monitoring_products(dataset, prdcfg):
4848
are also plot on the same figure
4949
User defined parameters:
5050
voltype: str
51-
name of the pyrad variable to use, it must be available in the dataset in the dataset
51+
name of the pyrad variable to use, it must be available in the dataset
5252
anglenr: int
5353
The elevation angle number to plot
5454
quantiles: list of floats
@@ -62,7 +62,7 @@ def generate_monitoring_products(dataset, prdcfg):
6262
quantiles stored in a csv file.
6363
User defined parameters:
6464
voltype: str
65-
name of the pyrad variable to use, it must be available in the dataset in the dataset
65+
name of the pyrad variable to use, it must be available in the dataset
6666
quantiles: list of 3 floats
6767
the quantiles to compute. Default 25., 50., 75.
6868
ref_value: float

src/pyrad_proc/pyrad/prod/process_product.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,7 @@ def generate_sun_hits_products(dataset, prdcfg):
413413
User defined parameters:
414414
add_date_in_fname: Bool
415415
If true the year is added in the csv file name
416-
'WRITE_SUNSCAN': Writes the sunscan parameters in a csv file. The written data has the following
417-
columns
416+
'WRITE_SUNSCAN': Writes the sunscan parameters in a csv file. The written data has the following columns
418417
"sun_az": [deg] Azimuth sun position,
419418
"sun_el": [deg] Elevation sun position,
420419
"noise_pwr": [dBm] Noise power",

0 commit comments

Comments
 (0)