forked from venetoarpa/arpav-cline-backend
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add legend information to coverages (#231)
* Adding bootstrap configs for collection and new historical variables * Start adding config for historical TDd * Added method to retrieve cov conf's main_netcdf_dataset_name * Use cov_conf.get_main_netcdf_variable_name() when needing to retrieve the name of the netcdf main variable * Added bootstrap conf param for observation-related year periods * Added bootstrap conf param for historical datasets * Added function to resolve thredds dataset names when a pattern is used to configure them * Improved help text on admin fields * Provide bootstrap configs for climatological datasets * Enabled support for fnmatch patterns in dataset paths * Add path operation for retrieving a single coverage identifier's details * Ensure wms-related properties are correctly rendered * Rename conf param value from 'collection' to 'archive' * Rename conf param value from 'observation_variable' to 'historical_variable' * Implement path operation to retrieve historical variable combinations * Fixed failing tests * Implement internal_value on conf param values * Added a legend for coverage configurations * Increased 95th percentile response time in load tests that run in CI * Upped limit for load tests in CI
- Loading branch information
1 parent
d53a5a8
commit 2b02a47
Showing
56 changed files
with
1,092 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import logging | ||
from pathlib import Path | ||
from typing import Optional | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def parse_palette(palette: str, palettes_dir: Path) -> Optional[list[str]]: | ||
palette_name = palette.partition("/")[-1].lower() | ||
name, to_invert = palette_name.rpartition("-inv")[:2] | ||
is_inverted = to_invert != "" | ||
colors = [] | ||
for file_path in [f for f in palettes_dir.iterdir() if f.is_file()]: | ||
if file_path.stem.lower() == name: | ||
try: | ||
colors = [ | ||
line.strip() | ||
for line in file_path.read_text().splitlines() | ||
if line.startswith("#") | ||
] | ||
except OSError: | ||
logger.warning(f"Error reading file {file_path}") | ||
break | ||
else: | ||
logger.warning(f"Could not find a palette named {name!r} at {palettes_dir!r}") | ||
if is_inverted: | ||
colors.reverse() | ||
return colors if len(colors) > 0 else None | ||
|
||
|
||
def apply_palette( | ||
colors: list[str], minimum: float, maximum: float | ||
) -> list[tuple[float, str]]: | ||
minmax_range = maximum - minimum | ||
step_increment = minmax_range / (len(colors) - 1) | ||
result = [] | ||
for i, current_color in enumerate(colors): | ||
current_value = minimum + i * step_increment | ||
result.append((current_value, current_color)) | ||
return result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from itertools import islice | ||
|
||
|
||
def batched(iterable, n): | ||
"""Custom implementation of `itertools.batched()`. | ||
This is a custom implementation of `itertools.batched()`, which is only available | ||
on Python 3.12+. This is copied verbatim from the python docs at: | ||
https://docs.python.org/3/library/itertools.html#itertools.batched | ||
""" | ||
# batched('ABCDEFG', 3) --> ABC DEF G | ||
if n < 1: | ||
raise ValueError("n must be at least one") | ||
it = iter(iterable) | ||
while batch := tuple(islice(it, n)): | ||
yield batch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Palettes | ||
|
||
This directory contains a copy of the palette files used by ncWMS. These were obtained by copying them from | ||
the edal-java source code repository, available at: | ||
|
||
https://github.com/Reading-eScience-Centre/edal-java | ||
|
||
In the edal-java repo, these palette files are found under: | ||
|
||
`graphics/src/main/resources/palettes` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Apache-Style Software License for ColorBrewer software and ColorBrewer Color Schemes | ||
|
||
Copyright (c) 2002 Cynthia Brewer, Mark Harrower, and The Pennsylvania State University. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and limitations under the License. | ||
|
||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
1. Redistributions as source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
2. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: | ||
This product includes color specifications and designs developed by Cynthia Brewer (http://colorbrewer.org/). | ||
Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. | ||
4. The name "ColorBrewer" must not be used to endorse or promote products derived from this software without prior written permission. | ||
For written permission, please contact Cynthia Brewer at [email protected]. | ||
5. Products derived from this software may not be called "ColorBrewer", nor may "ColorBrewer" appear in their name, without prior written permission of Cynthia Brewer. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#FF543005 | ||
#FF8c510a | ||
#FFbf812d | ||
#FFdfc27d | ||
#FFf6e8c3 | ||
#FFf5f5f5 | ||
#FFc7eae5 | ||
#FF80cdc1 | ||
#FF35978f | ||
#FF01665e | ||
#FF003c30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
% redblue | ||
#FF0000FF | ||
#FFFFFFFF | ||
#FFFF0000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#FF053061 | ||
#FF2166ac | ||
#FF4393c3 | ||
#FF92c5de | ||
#FFd1e5f0 | ||
#FFf7f7f7 | ||
#FFfddbc7 | ||
#FFf4a582 | ||
#FFd6604d | ||
#FFb2182b | ||
#FF67001f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#FF40004b | ||
#FF762a83 | ||
#FF9970ab | ||
#FFc2a5cf | ||
#FFe7d4e8 | ||
#FFf7f7f7 | ||
#FFd9f0d3 | ||
#FFa6dba0 | ||
#FF5aae61 | ||
#FF1b7837 | ||
#FF00441b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#FF8e0152 | ||
#FFc51b7d | ||
#FFde77ae | ||
#FFf1b6da | ||
#FFfde0ef | ||
#FFf7f7f7 | ||
#FFe6f5d0 | ||
#FFb8e186 | ||
#FF7fbc41 | ||
#FF4d9221 | ||
#FF276419 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#FF7f3b08 | ||
#FFb35806 | ||
#FFe08214 | ||
#FFfdb863 | ||
#FFfee0b6 | ||
#FFf7f7f7 | ||
#FFd8daeb | ||
#FFb2abd2 | ||
#FF8073ac | ||
#FF542788 | ||
#FF2d004b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#FF67001f | ||
#FFb2182b | ||
#FFd6604d | ||
#FFf4a582 | ||
#FFfddbc7 | ||
#FFf7f7f7 | ||
#FFd1e5f0 | ||
#FF92c5de | ||
#FF4393c3 | ||
#FF2166ac | ||
#FF053061 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#FF67001f | ||
#FFb2182b | ||
#FFd6604d | ||
#FFf4a582 | ||
#FFfddbc7 | ||
#FFffffff | ||
#FFe0e0e0 | ||
#FFbababa | ||
#FF878787 | ||
#FF4d4d4d | ||
#FF1a1a1a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#FFa50026 | ||
#FFd73027 | ||
#FFf46d43 | ||
#FFfdae61 | ||
#FFfee090 | ||
#FFffffbf | ||
#FFe0f3f8 | ||
#FFabd9e9 | ||
#FF74add1 | ||
#FF4575b4 | ||
#FF313695 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#FFa50026 | ||
#FFd73027 | ||
#FFf46d43 | ||
#FFfdae61 | ||
#FFfee08b | ||
#FFffffbf | ||
#FFd9ef8b | ||
#FFa6d96a | ||
#FF66bd63 | ||
#FF1a9850 | ||
#FF006837 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#FF9e0142 | ||
#FFd53e4f | ||
#FFf46d43 | ||
#FFfdae61 | ||
#FFfee08b | ||
#FFffffbf | ||
#FFe6f598 | ||
#FFabdda4 | ||
#FF66c2a5 | ||
#FF3288bd | ||
#FF5e4fa2 |
Oops, something went wrong.