|
|
@ -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(); |
|
|
|