Skip to content

Commit

Permalink
Add dimensions for L3 files
Browse files Browse the repository at this point in the history
  • Loading branch information
tukiains authored and siiptuo committed Mar 21, 2024
1 parent 8306822 commit cde6920
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 35 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ classifiers = [
]
dependencies = [
"cftime",
"cloudnetpy[extras]>=1.58.0",
"cloudnetpy[extras]>=1.60.3",
"doppy >= 0.1.0",
"influxdb-client",
"requests",
Expand Down
57 changes: 23 additions & 34 deletions src/data_processing/subcmds/process_model_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,45 +123,32 @@ def create_and_upload_images(
logging.info("Skipping plotting for hidden site")
return
temp_file = NamedTemporaryFile(suffix=".png")
visualizations = []
product_s3key = self.get_l3_product_key(product, model_or_instrument_id)
fields = utils.get_fields_for_l3_plot(product, model_or_instrument_id)
l3_product = utils.full_product_to_l3_product(product)
visualizations = []

# Statistic plot
generate_L3_day_plots(
self.temp_file.name,
l3_product,
model_or_instrument_id,
var_list=fields,
image_name=temp_file.name,
fig_type="statistic",
stats=("area",),
title=False,
)
visualizations.append(
self._upload_img(temp_file.name, product_s3key, uuid, product, "area", None)
)
# Statistic error plot
generate_L3_day_plots(
self.temp_file.name,
l3_product,
model_or_instrument_id,
var_list=fields,
image_name=temp_file.name,
fig_type="statistic",
stats=("error",),
title=False,
)
visualizations.append(
self._upload_img(
temp_file.name, product_s3key, uuid, product, "error", None
for stat in ("area", "error"):
dimensions = generate_L3_day_plots(
self.temp_file.name,
l3_product,
model_or_instrument_id,
var_list=fields,
image_name=temp_file.name,
fig_type="statistic",
stats=(stat,),
title=False,
)
)
# Single plots
# Check this potential error here
if len(dimensions) > 1:
raise ValueError(f"More than one dimension in the plot: {dimensions}")
visualizations.append(
self._upload_img(
temp_file.name, product_s3key, uuid, product, stat, dimensions[0]
)
)

for field in fields:
generate_L3_day_plots(
dimensions = generate_L3_day_plots(
self.temp_file.name,
l3_product,
model_or_instrument_id,
Expand All @@ -170,9 +157,11 @@ def create_and_upload_images(
fig_type="single",
title=False,
)
if len(dimensions) > 1:
raise ValueError(f"More than one dimension in the plot: {dimensions}")
visualizations.append(
self._upload_img(
temp_file.name, product_s3key, uuid, product, field, None
temp_file.name, product_s3key, uuid, product, field, dimensions[0]
)
)
self.md_api.put_images(visualizations, uuid)
Expand Down

0 comments on commit cde6920

Please sign in to comment.