|
|
|
@ -193,16 +193,15 @@ LayeredData::Data LayeredData::Read(const MString& vname, const BaseParameters*
|
|
|
|
|
auto temp = Read("temp", ip, i); |
|
|
|
|
auto sal = Read("sal", ip, i); |
|
|
|
|
if(!(temp && sal)) return Data(); |
|
|
|
|
auto out = temp; |
|
|
|
|
out.SetUnit("degrees_C"); |
|
|
|
|
for(size_t ind = 0; ind < out.N(); ind++) |
|
|
|
|
temp.SetUnit("degrees_C"); |
|
|
|
|
for(size_t ind = 0; ind < temp.N(); ind++) |
|
|
|
|
{ |
|
|
|
|
if(temp.IsFill(ind) || sal.IsFill(ind)) |
|
|
|
|
out.V(ind) = out.Fillval(); |
|
|
|
|
temp.V(ind) = temp.Fillval(); |
|
|
|
|
else |
|
|
|
|
out.V(ind) = Temp2PTemp(temp.V(ind), sal.V(ind), Depth(p->layer), out.Lon(ind), out.Lat(ind)); |
|
|
|
|
temp.V(ind) = Temp2PTemp(temp.V(ind), sal.V(ind), Depth(p->layer), temp.Lon(ind), temp.Lat(ind)); |
|
|
|
|
} |
|
|
|
|
return out; |
|
|
|
|
return temp; |
|
|
|
|
} |
|
|
|
|
// temp from ptemp and sal
|
|
|
|
|
if(vname == "temp") |
|
|
|
@ -210,16 +209,15 @@ LayeredData::Data LayeredData::Read(const MString& vname, const BaseParameters*
|
|
|
|
|
auto temp = Read("ptemp", ip, i); |
|
|
|
|
auto sal = Read("sal", ip, i); |
|
|
|
|
if(!(temp && sal)) return Data(); |
|
|
|
|
auto out = temp; |
|
|
|
|
out.SetUnit("degrees_C"); |
|
|
|
|
for(size_t ind = 0; ind < out.N(); ind++) |
|
|
|
|
temp.SetUnit("degrees_C"); |
|
|
|
|
for(size_t ind = 0; ind < temp.N(); ind++) |
|
|
|
|
{ |
|
|
|
|
if(temp.IsFill(ind) || sal.IsFill(ind)) |
|
|
|
|
out.V(ind) = out.Fillval(); |
|
|
|
|
temp.V(ind) = temp.Fillval(); |
|
|
|
|
else |
|
|
|
|
out.V(ind) = PTemp2Temp(temp.V(ind), sal.V(ind), Depth(p->layer), out.Lon(ind), out.Lat(ind)); |
|
|
|
|
temp.V(ind) = PTemp2Temp(temp.V(ind), sal.V(ind), Depth(p->layer), temp.Lon(ind), temp.Lat(ind)); |
|
|
|
|
} |
|
|
|
|
return out; |
|
|
|
|
return temp; |
|
|
|
|
} |
|
|
|
|
// pdens from temp and sal
|
|
|
|
|
if(vname == "pdens") |
|
|
|
@ -228,17 +226,16 @@ LayeredData::Data LayeredData::Read(const MString& vname, const BaseParameters*
|
|
|
|
|
auto temp = Read(tempispot ? "ptemp" : "temp", ip, i); |
|
|
|
|
auto sal = Read("sal", ip, i); |
|
|
|
|
if(!(temp && sal)) return Data(); |
|
|
|
|
auto out = temp; |
|
|
|
|
out.SetUnit("kg m-3"); |
|
|
|
|
for(size_t ind = 0; ind < out.N(); ind++) |
|
|
|
|
temp.SetUnit("kg m-3"); |
|
|
|
|
for(size_t ind = 0; ind < temp.N(); ind++) |
|
|
|
|
{ |
|
|
|
|
if(temp.IsFill(ind) || sal.IsFill(ind)) |
|
|
|
|
out.V(ind) = out.Fillval(); |
|
|
|
|
temp.V(ind) = temp.Fillval(); |
|
|
|
|
else |
|
|
|
|
out.V(ind) = tempispot ? PTemp2PDens(temp.V(ind), sal.V(ind), Depth(p->layer), out.Lon(ind), out.Lat(ind)) |
|
|
|
|
: Temp2PDens(temp.V(ind), sal.V(ind), Depth(p->layer), out.Lon(ind), out.Lat(ind)); |
|
|
|
|
temp.V(ind) = tempispot ? PTemp2PDens(temp.V(ind), sal.V(ind), Depth(p->layer), temp.Lon(ind), temp.Lat(ind)) |
|
|
|
|
: Temp2PDens(temp.V(ind), sal.V(ind), Depth(p->layer), temp.Lon(ind), temp.Lat(ind)); |
|
|
|
|
} |
|
|
|
|
return out; |
|
|
|
|
return temp; |
|
|
|
|
} |
|
|
|
|
// U and U2 from u and v
|
|
|
|
|
if(vname == "U" || vname == "U2") |
|
|
|
@ -247,16 +244,15 @@ LayeredData::Data LayeredData::Read(const MString& vname, const BaseParameters*
|
|
|
|
|
auto u = Read("u", ip, i); |
|
|
|
|
auto v = Read("v", ip, i); |
|
|
|
|
if(!(u && v)) return Data(); |
|
|
|
|
auto out = u; |
|
|
|
|
out.SetUnit(square ? ("(" + u.Unit() + ")2") : u.Unit()); |
|
|
|
|
for(size_t ind = 0; ind < out.N(); ind++) |
|
|
|
|
if(square && u.Unit().Exist()) u.SetUnit("(" + u.Unit() + ")2"); |
|
|
|
|
for(size_t ind = 0; ind < u.N(); ind++) |
|
|
|
|
{ |
|
|
|
|
if(u.IsFill(ind) || v.IsFill(ind)) |
|
|
|
|
out.V(ind) = out.Fillval(); |
|
|
|
|
u.V(ind) = u.Fillval(); |
|
|
|
|
else |
|
|
|
|
out.V(ind) = square ? (u(ind) * u(ind) + v(ind) * v(ind)) : michlib::Hypot(u(ind), v(ind)); |
|
|
|
|
u.V(ind) = square ? (u(ind) * u(ind) + v(ind) * v(ind)) : michlib::Hypot(u(ind), v(ind)); |
|
|
|
|
} |
|
|
|
|
return out; |
|
|
|
|
return u; |
|
|
|
|
} |
|
|
|
|
return Data(); |
|
|
|
|
} |
|
|
|
|