From 02a9f6991b78fa2ddcdc35367ae0fc839dbdc96a Mon Sep 17 00:00:00 2001 From: Pedro Maciel Date: Sun, 28 Apr 2024 18:06:09 +0000 Subject: [PATCH] EASE polar grids --- etc/mir/netcdf.yaml | 2 ++ src/mir/netcdf/Endowed.cc | 8 ++++---- src/mir/netcdf/Type.cc | 3 +++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/etc/mir/netcdf.yaml b/etc/mir/netcdf.yaml index 2fffada7a..295fe855f 100644 --- a/etc/mir/netcdf.yaml +++ b/etc/mir/netcdf.yaml @@ -1,5 +1,7 @@ --- # yamllint disable rule:line-length +: + paramId: 151 air_pressure_at_sea_level: paramId: 151 diff --git a/src/mir/netcdf/Endowed.cc b/src/mir/netcdf/Endowed.cc index b8b22aced..1b35eef80 100644 --- a/src/mir/netcdf/Endowed.cc +++ b/src/mir/netcdf/Endowed.cc @@ -60,10 +60,10 @@ void Endowed::getAttributes(int nc, int i, int nattr) { NC_CALL(nc_inq_attname(nc, i, j, name), path()); NC_CALL(nc_inq_att(nc, i, name, &type, &len), path()); - Type& kind = Type::lookup(type); - Value* attribute = kind.attributeValue(nc, i, name, len, path()); - - add(new InputAttribute(*this, name, attribute)); + Type& kind = Type::lookup(type); + if (Value* attribute = kind.attributeValue(nc, i, name, len, path()); attribute != nullptr) { + add(new InputAttribute(*this, name, attribute)); + } } } diff --git a/src/mir/netcdf/Type.cc b/src/mir/netcdf/Type.cc index 5006232da..bd10e2da1 100644 --- a/src/mir/netcdf/Type.cc +++ b/src/mir/netcdf/Type.cc @@ -375,6 +375,9 @@ Value* TypeT::attributeValue(int nc, int id, const char* name, si template <> Value* TypeT::attributeValue(int nc, int id, const char* name, size_t len, const std::string& path) { + if (len != 1) { + return nullptr; + } short value; ASSERT(len == 1); NC_CALL(nc_get_att_short(nc, id, name, &value), path);