Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edrfixes - units #399

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions adagucserverEC/CUniqueRequests/CUniqueRequests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,15 @@ void CURUniqueRequests::createStructure(CDataSource::DataObject *dataObject, CDr
layerStructure->add(CXMLParser::XMLElement("standard_name", standardName.c_str()));
layerStructure->add(CXMLParser::XMLElement("units", dataObject->getUnits().c_str()));

CT::string longName = dataObject->variableName.c_str();
CDF::Attribute *attr_long_name = dataObject->cdfVariable->getAttributeNE("long_name");
if (attr_long_name != NULL) {
longName = attr_long_name->toString();
}
if (longName.length() > 0) {
layerStructure->add(CXMLParser::XMLElement("long_name", longName.c_str()));
}

CT::string ckey;
ckey.print("%d%d%s", dX, dY, dataSource->nativeProj4.c_str());
CImageDataWriter::ProjCacheInfo projCacheInfo = CImageDataWriter::GetProjInfo(ckey, drawImage, dataSource, imageWarper, dataSource->srvParams, dX, dY);
Expand Down
5 changes: 3 additions & 2 deletions python/python_fastapi_server/routers/edr_covjson.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ def covjson_from_resp(dats, vertical_name, custom_name, collection_name):
symbol = CovJsonSymbol(
value=param_metadata["parameter_unit"], type=SYMBOL_TYPE_URL
)
unit = CovJsonUnit(symbol=symbol)
unit_label = {"en": param_metadata["parameter_unit"]}
unit = CovJsonUnit(symbol=symbol, label=unit_label)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test test_collections in test_ogc_api_edr.py calls /edr/collections, but the response does not contain the new "en": ... label. Is this test still correct?

observed_property = CovJsonObservedProperty(
id=param_metadata["observed_property_id"],
label={"en": param_metadata["observed_property_label"]},
Expand All @@ -85,7 +86,7 @@ def covjson_from_resp(dats, vertical_name, custom_name, collection_name):
param = CovJsonParameter(
id=dat["name"],
observedProperty=observed_property,
# description={"en":param_metadata["wms_layer_title"]}, # TODO in follow up
# description={"en": param_metadata["wms_layer_title"]},
unit=unit,
label={"en:": param_metadata["parameter_label"]},
)
Expand Down
2 changes: 1 addition & 1 deletion python/python_fastapi_server/routers/edr_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ def get_param_metadata(param_id: str, edr_collection_name) -> dict:
parameter_unit = param_el["unit"]
observed_property_label = param_el["observed_property_label"]
if "standard_name" in param_el and param_el["standard_name"] is not None:
observed_property_id = VOCAB_ENDPOINT_URL + param_el["standard_name"]
observed_property_id = VOCAB_ENDPOINT_URL + param_el["standard_name"] + "/"

return {
"wms_layer_name": wms_layer_name,
Expand Down
7 changes: 6 additions & 1 deletion python/python_fastapi_server/routers/netcdf_to_covjson.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)

NERC_URI = "https://vocab.nerc.ac.uk/standard_name"


class GeoReferenceInfo(BaseModel):
"""GeoReference object"""
Expand Down Expand Up @@ -191,7 +193,10 @@ def netcdf_to_covjson(
parameters[translated_variablename] = Parameter(
# TODO: KDP-1622 Fix the difference in the ObservedProperty between DescribeCoverage from the
# Adaguc Config and the NetCDF values
observedProperty=ObservedProperty(label={"en": parameter_name}),
observedProperty=ObservedProperty(
label={"en": parameter_name},
id=f"{NERC_URI}/{parameter_name}/",
),
description={"en": parameter_description},
unit=Unit(
symbol=Symbol(
Expand Down
2 changes: 1 addition & 1 deletion python/python_fastapi_server/test_ogc_api_edr.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def test_collections(client: TestClient):
}
},
"observedProperty": {
"id": "https://vocab.nerc.ac.uk/standard_name/air_temperature",
"id": "https://vocab.nerc.ac.uk/standard_name/air_temperature/",
"label": "Air temperature",
},
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"name":"RAD_NL25_PCP_CM","standard_name":"image1.image_data","units":"mm/hr","point":{"SRS":"EPSG:4326","coords":"6.163147,51.837904"},"dims":"time","data":{"2021-06-22T20:00:00Z":"5.225240"}}]
[{"name":"RAD_NL25_PCP_CM","standard_name":"image1.image_data","units":"mm/hr","long_name":"image1.image_data","point":{"SRS":"EPSG:4326","coords":"6.163147,51.837904"},"dims":"time","data":{"2021-06-22T20:00:00Z":"5.225240"}}]

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"name":"air_temperature_pl","standard_name":"air_temperature","units":"C","point":{"SRS":"EPSG:4326","coords":"4.586712,52.159352"},"dims":["reference_time","pressure_level_in_hpa","time"],"data":{"2024-07-11T05:00:00Z":{"500":{"2024-07-11T06:00:00Z":"-15.693634","2024-07-11T07:00:00Z":"-15.945038"},"700":{"2024-07-11T06:00:00Z":"1.987701","2024-07-11T07:00:00Z":"1.963531"},"850":{"2024-07-11T06:00:00Z":"5.069244","2024-07-11T07:00:00Z":"4.952545"},"925":{"2024-07-11T06:00:00Z":"10.240143","2024-07-11T07:00:00Z":"9.853424"}}}}]
[{"name":"air_temperature_pl","standard_name":"air_temperature","units":"C","long_name":"Air temperature at pressure level","point":{"SRS":"EPSG:4326","coords":"4.586712,52.159352"},"dims":["reference_time","pressure_level_in_hpa","time"],"data":{"2024-07-11T05:00:00Z":{"500":{"2024-07-11T06:00:00Z":"-15.693634","2024-07-11T07:00:00Z":"-15.945038"},"700":{"2024-07-11T06:00:00Z":"1.987701","2024-07-11T07:00:00Z":"1.963531"},"850":{"2024-07-11T06:00:00Z":"5.069244","2024-07-11T07:00:00Z":"4.952545"},"925":{"2024-07-11T06:00:00Z":"10.240143","2024-07-11T07:00:00Z":"9.853424"}}}}]

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"name":"wind_speed_hagl_ms_member_3","standard_name":"wind_speed","units":"m/s","point":{"SRS":"EPSG:4326","coords":"4.586712,52.159352"},"dims":["reference_time","time"],"data":{"2024-06-05T03:00:00Z":{"2024-06-05T04:00:00Z":"7.749744","2024-06-05T05:00:00Z":"6.916642","2024-06-05T06:00:00Z":"5.414292","2024-06-05T07:00:00Z":"6.053716","2024-06-05T08:00:00Z":"6.163811","2024-06-05T09:00:00Z":"6.675175","2024-06-05T10:00:00Z":"7.050253","2024-06-05T11:00:00Z":"6.253777","2024-06-05T12:00:00Z":"6.239470","2024-06-05T13:00:00Z":"7.575111","2024-06-05T14:00:00Z":"7.456793","2024-06-05T15:00:00Z":"6.966013","2024-06-05T16:00:00Z":"6.674116","2024-06-05T17:00:00Z":"6.166113","2024-06-05T18:00:00Z":"6.434509","2024-06-05T19:00:00Z":"6.991957","2024-06-05T20:00:00Z":"7.418019","2024-06-05T21:00:00Z":"4.747274","2024-06-05T22:00:00Z":"4.340872","2024-06-05T23:00:00Z":"4.977072","2024-06-06T00:00:00Z":"5.741987","2024-06-06T01:00:00Z":"5.465500","2024-06-06T02:00:00Z":"5.184365","2024-06-06T03:00:00Z":"4.906918","2024-06-06T04:00:00Z":"5.167669","2024-06-06T05:00:00Z":"6.462762","2024-06-06T06:00:00Z":"5.966711","2024-06-06T07:00:00Z":"4.047339","2024-06-06T08:00:00Z":"4.409118","2024-06-06T09:00:00Z":"7.585665","2024-06-06T10:00:00Z":"4.649502","2024-06-06T11:00:00Z":"4.579948","2024-06-06T12:00:00Z":"3.769767","2024-06-06T13:00:00Z":"5.283970","2024-06-06T14:00:00Z":"5.212128","2024-06-06T15:00:00Z":"4.117908","2024-06-06T16:00:00Z":"3.640064","2024-06-06T17:00:00Z":"3.626424","2024-06-06T18:00:00Z":"4.028893","2024-06-06T19:00:00Z":"3.608681","2024-06-06T20:00:00Z":"2.840783","2024-06-06T21:00:00Z":"2.966220","2024-06-06T22:00:00Z":"4.149934","2024-06-06T23:00:00Z":"4.223146","2024-06-07T00:00:00Z":"4.072773","2024-06-07T01:00:00Z":"5.188828","2024-06-07T02:00:00Z":"5.438668","2024-06-07T03:00:00Z":"6.557220","2024-06-07T04:00:00Z":"7.047672","2024-06-07T05:00:00Z":"6.900069","2024-06-07T06:00:00Z":"7.173945","2024-06-07T07:00:00Z":"7.400405","2024-06-07T08:00:00Z":"7.805073","2024-06-07T09:00:00Z":"8.246214","2024-06-07T10:00:00Z":"8.895448","2024-06-07T11:00:00Z":"8.447080","2024-06-07T12:00:00Z":"9.029824","2024-06-07T13:00:00Z":"9.792758","2024-06-07T14:00:00Z":"10.539583","2024-06-07T15:00:00Z":"10.546448"}}}]
[{"name":"wind_speed_hagl_ms_member_3","standard_name":"wind_speed","units":"m/s","long_name":"Wind speed at height above ground level","point":{"SRS":"EPSG:4326","coords":"4.586712,52.159352"},"dims":["reference_time","time"],"data":{"2024-06-05T03:00:00Z":{"2024-06-05T04:00:00Z":"7.749744","2024-06-05T05:00:00Z":"6.916642","2024-06-05T06:00:00Z":"5.414292","2024-06-05T07:00:00Z":"6.053716","2024-06-05T08:00:00Z":"6.163811","2024-06-05T09:00:00Z":"6.675175","2024-06-05T10:00:00Z":"7.050253","2024-06-05T11:00:00Z":"6.253777","2024-06-05T12:00:00Z":"6.239470","2024-06-05T13:00:00Z":"7.575111","2024-06-05T14:00:00Z":"7.456793","2024-06-05T15:00:00Z":"6.966013","2024-06-05T16:00:00Z":"6.674116","2024-06-05T17:00:00Z":"6.166113","2024-06-05T18:00:00Z":"6.434509","2024-06-05T19:00:00Z":"6.991957","2024-06-05T20:00:00Z":"7.418019","2024-06-05T21:00:00Z":"4.747274","2024-06-05T22:00:00Z":"4.340872","2024-06-05T23:00:00Z":"4.977072","2024-06-06T00:00:00Z":"5.741987","2024-06-06T01:00:00Z":"5.465500","2024-06-06T02:00:00Z":"5.184365","2024-06-06T03:00:00Z":"4.906918","2024-06-06T04:00:00Z":"5.167669","2024-06-06T05:00:00Z":"6.462762","2024-06-06T06:00:00Z":"5.966711","2024-06-06T07:00:00Z":"4.047339","2024-06-06T08:00:00Z":"4.409118","2024-06-06T09:00:00Z":"7.585665","2024-06-06T10:00:00Z":"4.649502","2024-06-06T11:00:00Z":"4.579948","2024-06-06T12:00:00Z":"3.769767","2024-06-06T13:00:00Z":"5.283970","2024-06-06T14:00:00Z":"5.212128","2024-06-06T15:00:00Z":"4.117908","2024-06-06T16:00:00Z":"3.640064","2024-06-06T17:00:00Z":"3.626424","2024-06-06T18:00:00Z":"4.028893","2024-06-06T19:00:00Z":"3.608681","2024-06-06T20:00:00Z":"2.840783","2024-06-06T21:00:00Z":"2.966220","2024-06-06T22:00:00Z":"4.149934","2024-06-06T23:00:00Z":"4.223146","2024-06-07T00:00:00Z":"4.072773","2024-06-07T01:00:00Z":"5.188828","2024-06-07T02:00:00Z":"5.438668","2024-06-07T03:00:00Z":"6.557220","2024-06-07T04:00:00Z":"7.047672","2024-06-07T05:00:00Z":"6.900069","2024-06-07T06:00:00Z":"7.173945","2024-06-07T07:00:00Z":"7.400405","2024-06-07T08:00:00Z":"7.805073","2024-06-07T09:00:00Z":"8.246214","2024-06-07T10:00:00Z":"8.895448","2024-06-07T11:00:00Z":"8.447080","2024-06-07T12:00:00Z":"9.029824","2024-06-07T13:00:00Z":"9.792758","2024-06-07T14:00:00Z":"10.539583","2024-06-07T15:00:00Z":"10.546448"}}}]

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"name":"RAD_NL25_ETH_NA_GRID","standard_name":"image1.image_data","units":"HEIGHT_[KM]","point":{"SRS":"EPSG:4326","coords":"5.680000,50.890000"},"dims":"time","data":{"2020-04-30T13:15:00Z":"4.606290"}}]
[{"name":"RAD_NL25_ETH_NA_GRID","standard_name":"image1.image_data","units":"HEIGHT_[KM]","long_name":"image1.image_data","point":{"SRS":"EPSG:4326","coords":"5.680000,50.890000"},"dims":"time","data":{"2020-04-30T13:15:00Z":"4.606290"}}]
Loading