Browse Source

Update michlib

interpolate
Michael Uleysky 2 years ago
parent
commit
07e0b9a9fa
  1. 16
      include/HYCOM.h
  2. 15
      include/NEMO.h
  3. 2
      michlib

16
include/HYCOM.h

@ -80,7 +80,6 @@ class HYCOMData
{ {
auto var = nodepth ? f.V<DataType>(name, {lonname, p->xb, p->xe - p->xb + 1}, {latname, p->yb, p->ye - p->yb + 1}, {"time", i, 1}) auto var = nodepth ? f.V<DataType>(name, {lonname, p->xb, p->xe - p->xb + 1}, {latname, p->yb, p->ye - p->yb + 1}, {"time", i, 1})
: f.V<DataType>(name, {lonname, p->xb, p->xe - p->xb + 1}, {latname, p->yb, p->ye - p->yb + 1}, {"time", i, 1}, {"depth", p->layer, 1}); : f.V<DataType>(name, {lonname, p->xb, p->xe - p->xb + 1}, {latname, p->yb, p->ye - p->yb + 1}, {"time", i, 1}, {"depth", p->layer, 1});
if(!var) return Data(); if(!var) return Data();
if(var.DimLen(0) != data.Nx() || var.DimLen(1) != data.Ny()) return Data(); if(var.DimLen(0) != data.Nx() || var.DimLen(1) != data.Ny()) return Data();
@ -220,7 +219,7 @@ class HYCOMData
return "Can't find longitude/latitude"; return "Can't find longitude/latitude";
} }
auto rdepths = nc[0].V<double>("depth"); auto rdepths = nc[0].VR("depth");
if(!rdepths) if(!rdepths)
{ {
nc.clear(); nc.clear();
@ -229,9 +228,8 @@ class HYCOMData
depths.resize(rdepths.DimLen(0)); depths.resize(rdepths.DimLen(0));
for(size_t i = 0; i < depths.size(); i++) depths[i] = rdepths(i); for(size_t i = 0; i < depths.size(); i++) depths[i] = rdepths(i);
auto timeD = nc[0].V<double>("time"); auto time = nc[0].VR("time");
auto timeF = nc[0].V<float>("time"); if(!time)
if(!(timeD || timeF))
{ {
nc.clear(); nc.clear();
return "Can't read times"; return "Can't read times";
@ -260,11 +258,11 @@ class HYCOMData
} }
} }
timeD ? times.resize(timeD.DimLen(0)) : times.resize(timeF.DimLen(0)); times.resize(time.DimLen(0));
for(size_t i = 0; i < times.size(); i++) times[i] = refdate + static_cast<time_t>(timeD ? timeD(i) : timeF(i)) * 3600; for(size_t i = 0; i < times.size(); i++) times[i] = refdate + static_cast<time_t>(time(i)) * 3600;
auto lons = nc[0].V<double>("lon"); auto lons = nc[0].VR(lonname);
auto lats = nc[0].V<double>("lat"); auto lats = nc[0].VR(latname);
if(!(lons && lats)) if(!(lons && lats))
{ {
nc.clear(); nc.clear();

15
include/NEMO.h

@ -268,7 +268,7 @@ class NEMOData
return "Can't find longitude/latitude"; return "Can't find longitude/latitude";
} }
auto rdepths = nc[0].V<float>("depth"); auto rdepths = nc[0].VR("depth");
if(!rdepths) if(!rdepths)
{ {
nc.clear(); nc.clear();
@ -277,9 +277,8 @@ class NEMOData
depths.resize(rdepths.DimLen(0)); depths.resize(rdepths.DimLen(0));
for(size_t i = 0; i < depths.size(); i++) depths[i] = rdepths(i); for(size_t i = 0; i < depths.size(); i++) depths[i] = rdepths(i);
auto timeD = nc[0].V<double>("time"); auto time = nc[0].VR("time");
auto timeF = nc[0].V<float>("time"); if(!time)
if(!(timeD || timeF))
{ {
nc.clear(); nc.clear();
return "Can't read times"; return "Can't read times";
@ -308,11 +307,11 @@ class NEMOData
} }
} }
timeD ? times.resize(timeD.DimLen(0)) : times.resize(timeF.DimLen(0)); times.resize(time.DimLen(0));
for(size_t i = 0; i < times.size(); i++) times[i] = refdate + static_cast<time_t>(timeD ? timeD(i) : timeF(i)) * 3600; for(size_t i = 0; i < times.size(); i++) times[i] = refdate + static_cast<time_t>(time(i)) * 3600;
auto lons = nc[0].V<float>("longitude"); auto lons = nc[0].VR(lonname);
auto lats = nc[0].V<float>("latitude"); auto lats = nc[0].VR(latname);
if(!(lons && lats)) if(!(lons && lats))
{ {
nc.clear(); nc.clear();

2
michlib

@ -1 +1 @@
Subproject commit bfa475d14453f4b2c917c97343cfe114ecb1410a Subproject commit f03851992cf6a4f00c50be94aaac1d3bf77ae742
Loading…
Cancel
Save