Skip to content

Commit

Permalink
ENH: better layout in products rst overview
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfidan committed Feb 12, 2025
1 parent 855befb commit 9fcf2ce
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 32 deletions.
20 changes: 9 additions & 11 deletions ci/parse_pyrad_products.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ def dict_to_restructured_text(yaml_data):
rst_output.append('""""""""""""""""""""""""""""""')
rst_output.append("description")
rst_output.append(
" " + prodinfo["description"] + f'\n `[Source] <{prodinfo["link"]}>`_'
" | "
+ prodinfo["description"].replace("###", "\n |")
+ f'\n `[Source] <{prodinfo["link"]}>`_'
)
params = parameters_to_dict(prodinfo["parameters"])
if len(params):
Expand Down Expand Up @@ -96,7 +98,7 @@ def process_file(filepath):
# clear buffer
try:
all_products[function][product]["description"] = " ".join(
descr.replace("\n", "").split()
descr.split()
)
except (KeyError, UnboundLocalError, TypeError):
pass
Expand Down Expand Up @@ -124,25 +126,23 @@ def process_file(filepath):
try:
if product in all_products[function]:
all_products[function][product]["description"] = " ".join(
descr.replace("\n", "").split()
descr.split()
)
except TypeError:
pass

product = match[0].replace("'", "").split(":")[0].strip()
descr = line.split(":")[1].strip()
descr = line.split(":")[1].strip() + "###"
all_products[function][product] = {}
all_products[function][product]["parameters"] = ""
continue
if "User defined parameters" in line:
all_products[function][product]["description"] = " ".join(
descr.replace("\n", "").split()
)
all_products[function][product]["description"] = " ".join(descr.split())
reading_params = True
reading_title = False
continue
if reading_title:
descr += line
descr += line + "###"
if reading_params and product:
all_products[function][product]["parameters"] += " " + line
if ('prdcfg["type"]' in line or "prdcfg['type']" in line) and "==" in line:
Expand All @@ -153,9 +153,7 @@ def process_file(filepath):
)

if reading_title:
all_products[function][product]["description"] = " ".join(
descr.replace("\n", "").split()
)
all_products[function][product]["description"] = " ".join(descr.split())

return all_products

Expand Down
31 changes: 14 additions & 17 deletions src/pyrad_proc/pyrad/prod/process_grid_products.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def generate_grid_products(dataset, prdcfg):
'CROSS_SECTION': Plots a cross-section of gridded data
User defined parameters:
voltype: str
name of the pyrad variable to use, it must be available in the dataset in the dataset
name of the pyrad variable to use, it must be available in the dataset
coord1, coord2: dict
The two lat-lon coordinates marking the limits. They have
the keywords 'lat' and 'lon' [degree]. The altitude limits
Expand All @@ -170,7 +170,7 @@ def generate_grid_products(dataset, prdcfg):
'HISTOGRAM': Computes a histogram of the radar volum data
User defined parameters:
voltype: str
name of the pyrad variable to use, it must be available in the dataset in the dataset
name of the pyrad variable to use, it must be available in the dataset
step: float or None
the data quantization step. If none it will be obtained
from the Py-ART configuration file
Expand All @@ -185,7 +185,7 @@ def generate_grid_products(dataset, prdcfg):
constant latitude.
User defined parameters:
voltype: str
name of the pyrad variable to use, it must be available in the dataset in the dataset
name of the pyrad variable to use, it must be available in the dataset
lon, lat: floats
The starting point of the cross-section. The ending point
is defined by the parameters in 'xsecImageConfig' in the
Expand All @@ -194,7 +194,7 @@ def generate_grid_products(dataset, prdcfg):
constant longitude.
User defined parameters:
voltype: str
name of the pyrad variable to use, it must be available in the dataset in the dataset
name of the pyrad variable to use, it must be available in the dataset
lon, lat: floats
The starting point of the cross-section. The ending point
is defined by the parameters in 'xsecImageConfig' in the
Expand All @@ -210,7 +210,7 @@ def generate_grid_products(dataset, prdcfg):
'SAVEVOL': Saves on field of a gridded data object in a netcdf file.
User defined parameters:
voltype: str
name of the pyrad variable to use, it must be available in the dataset in the dataset
name of the pyrad variable to use, it must be available in the dataset
file_type: str
The type of file used to save the data. Can be 'nc' or
'h5'. Default 'nc'
Expand All @@ -232,30 +232,30 @@ def generate_grid_products(dataset, prdcfg):
a file.
User defined parameters:
voltype: str
name of the pyrad variable to use, it must be available in the dataset in the dataset
name of the pyrad variable to use, it must be available in the dataset
stat: str
The statistic used. Can be mean, median, min, max
'SURFACE_RAW': Plots a surface image of gridded data without
projecting it into a map
User defined parameters:
voltype: str
name of the pyrad variable to use, it must be available in the dataset in the dataset
name of the pyrad variable to use, it must be available in the dataset
level: int
The altitude level to plot. The rest of the parameters are
defined by the parameters in 'ppiImageConfig' and
'ppiMapImageConfig' in the 'loc' configuration file
'SURFACE_IMAGE': Plots a surface image of gridded data.
User defined parameters:
voltype: str
name of the pyrad variable to use, it must be available in the dataset in the dataset
name of the pyrad variable to use, it must be available in the dataset
level: int
The altitude level to plot. The rest of the parameters are
defined by the parameters in 'ppiImageConfig' and
'ppiMapImageConfig' in the 'loc' configuration file
'SURFACE_CONTOUR': Plots a surface image of contour gridded data.
User defined parameters:
voltype: str
name of the pyrad variable to use, it must be available in the dataset in the dataset
name of the pyrad variable to use, it must be available in the dataset
level: int
The altitude level to plot. The rest of the parameters are
defined by the parameters in 'ppiImageConfig' and
Expand All @@ -274,7 +274,7 @@ def generate_grid_products(dataset, prdcfg):
Plots a surface image of gridded data with a contour overplotted.
User defined parameters:
voltype: str
name of the pyrad variable to use, it must be available in the dataset in the dataset
name of the pyrad variable to use, it must be available in the dataset
level: int
The altitude level to plot. The rest of the parameters are
defined by the parameters in 'ppiImageConfig' and
Expand All @@ -293,7 +293,7 @@ def generate_grid_products(dataset, prdcfg):
Plots on the same surface two images, one on top of the other.
User defined parameters:
voltype: str
name of the pyrad variable to use, it must be available in the dataset in the dataset
name of the pyrad variable to use, it must be available in the dataset
level: int
The altitude level to plot. The rest of the parameters are
defined by the parameters in 'ppiImageConfig' and
Expand All @@ -309,7 +309,7 @@ def generate_grid_products(dataset, prdcfg):
The pyDDA package is required
User defined parameters:
voltype: str
name of the pyrad variable to use, it must be available in the dataset in the dataset
name of the pyrad variable to use, it must be available in the dataset
level: int
The altitude level to plot. The rest of the parameters are
defined by the parameters in 'ppiImageConfig' and
Expand Down Expand Up @@ -347,7 +347,7 @@ def generate_grid_products(dataset, prdcfg):
The pyDDA package is required
User defined parameters:
voltype: str
name of the pyrad variable to use, it must be available in the dataset in the dataset
name of the pyrad variable to use, it must be available in the dataset
level: int
The longitude level to plot. The rest of the parameters are
defined by the parameters in 'xsecImageConfig' in the 'loc'
Expand Down Expand Up @@ -385,7 +385,7 @@ def generate_grid_products(dataset, prdcfg):
The pyDDA package is required
User defined parameters:
voltype: str
name of the pyrad variable to use, it must be available in the dataset in the dataset
name of the pyrad variable to use, it must be available in the dataset
level: int
The latitude level to plot. The rest of the parameters are
defined by the parameters in 'xsecImageConfig' in the 'loc'
Expand Down Expand Up @@ -1153,7 +1153,6 @@ def generate_grid_products(dataset, prdcfg):
return fname

if prdcfg["type"] == "DDA_MAP":

display_type = prdcfg.get("display_type", "quiver")
if display_type not in ["quiver", "barbs", "streamline"]:
warn("Invalid display_type, must be " + '"streamline", "quiver" or "barbs"')
Expand Down Expand Up @@ -1214,7 +1213,6 @@ def generate_grid_products(dataset, prdcfg):
print("----- save to " + " ".join(fname_list))

if prdcfg["type"] == "DDA_LONGITUDE_SLICE":

display_type = prdcfg.get("display_type", "quiver")
if display_type not in ["quiver", "barbs", "streamline"]:
warn("Invalid display_type, must be " + '"streamline", "quiver" or "barbs"')
Expand Down Expand Up @@ -1287,7 +1285,6 @@ def generate_grid_products(dataset, prdcfg):
print("----- save to " + " ".join(fname_list))

if prdcfg["type"] == "DDA_LATITUDE_SLICE":

display_type = prdcfg.get("display_type", "quiver")
if display_type not in ["quiver", "barbs", "streamline"]:
warn("Invalid display_type, must be " + '"streamline", "quiver" or "barbs"')
Expand Down
4 changes: 2 additions & 2 deletions src/pyrad_proc/pyrad/prod/process_monitoring_products.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def generate_monitoring_products(dataset, prdcfg):
are also plot on the same figure
User defined parameters:
voltype: str
name of the pyrad variable to use, it must be available in the dataset in the dataset
name of the pyrad variable to use, it must be available in the dataset
anglenr: int
The elevation angle number to plot
quantiles: list of floats
Expand All @@ -62,7 +62,7 @@ def generate_monitoring_products(dataset, prdcfg):
quantiles stored in a csv file.
User defined parameters:
voltype: str
name of the pyrad variable to use, it must be available in the dataset in the dataset
name of the pyrad variable to use, it must be available in the dataset
quantiles: list of 3 floats
the quantiles to compute. Default 25., 50., 75.
ref_value: float
Expand Down
3 changes: 1 addition & 2 deletions src/pyrad_proc/pyrad/prod/process_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,7 @@ def generate_sun_hits_products(dataset, prdcfg):
User defined parameters:
add_date_in_fname: Bool
If true the year is added in the csv file name
'WRITE_SUNSCAN': Writes the sunscan parameters in a csv file. The written data has the following
columns
'WRITE_SUNSCAN': Writes the sunscan parameters in a csv file. The written data has the following columns
"sun_az": [deg] Azimuth sun position,
"sun_el": [deg] Elevation sun position,
"noise_pwr": [dBm] Noise power",
Expand Down

0 comments on commit 9fcf2ce

Please sign in to comment.