|
|
|
@ -134,25 +134,35 @@ std::pair<const BaseParameters*, MString> LayeredData::Parameters(michlib_intern
|
|
|
|
|
real depth = args.contains("depth") ? args.at("depth").ToReal() : Depth(ppar->layer); |
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
auto dom = DetGeoDomain(lonb, lone); |
|
|
|
|
real lon1 = ToGeoDomain(reg.lonb, dom); |
|
|
|
|
real lon2 = ToGeoDomain(reg.lone, dom); |
|
|
|
|
real lat1 = reg.latb; |
|
|
|
|
real lat2 = reg.late; |
|
|
|
|
auto dom = DetGeoDomain(lonb, lone); |
|
|
|
|
real lon1 = ToGeoDomain(reg.lonb, dom); |
|
|
|
|
real lon2 = ToGeoDomain(reg.lone, dom); |
|
|
|
|
real lat1 = reg.latb; |
|
|
|
|
real lat2 = reg.late; |
|
|
|
|
bool global = lone - lonb + 1.5 * lonstep > 360.0; |
|
|
|
|
|
|
|
|
|
// Special case when the longitude lies in a small sector between the end and the start
|
|
|
|
|
if(lon1 < lonb) lon1 = lone; |
|
|
|
|
if(lon2 > lone) lon2 = lonb; |
|
|
|
|
|
|
|
|
|
ppar->yb = static_cast<size_t>(Floor((lat1 - latb) / latstep)); |
|
|
|
|
ppar->ye = static_cast<size_t>(Ceil((lat2 - latb) / latstep)); |
|
|
|
|
if(ppar->ye > dname.ny - 1) ppar->ye = dname.ny - 1; |
|
|
|
|
if(ppar->yb >= ppar->ye) return {nullptr, "Latb must be lesser then late"}; |
|
|
|
|
if(global) |
|
|
|
|
{ |
|
|
|
|
if(lon1 < lonb) lon1 = lone; |
|
|
|
|
if(lon2 > lone) lon2 = lonb; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
if(lon1 < lonb) lon1 = lonb; |
|
|
|
|
if(lon2 > lone) lon2 = lone; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ppar->xb = static_cast<size_t>(Floor((lon1 - lonb) / lonstep)); |
|
|
|
|
ppar->xe = static_cast<size_t>(Ceil((lon2 - lonb) / lonstep)); |
|
|
|
|
|
|
|
|
|
if(ppar->xb == ppar->xe) return {nullptr, "Lonb must be not equal late"}; |
|
|
|
|
if(!global && ppar->xb > ppar->xe) return {nullptr, "Lonb must be lesser then lone"}; |
|
|
|
|
|
|
|
|
|
ppar->yb = static_cast<size_t>(Floor((lat1 - latb) / latstep)); |
|
|
|
|
ppar->ye = static_cast<size_t>(Ceil((lat2 - latb) / latstep)); |
|
|
|
|
if(ppar->ye > dname.ny - 1) ppar->ye = dname.ny - 1; |
|
|
|
|
if(ppar->yb >= ppar->ye) return {nullptr, "Latb must be lesser then late"}; |
|
|
|
|
|
|
|
|
|
if(depth < 0.0 || depth > depths.back()) |
|
|
|
|
ppar->layer = (depth < 0.0) ? 0 : (depths.size() - 1); |
|
|
|
@ -186,7 +196,7 @@ bool LayeredData::Read(const MString& vname, std::map<MString, LayeredData::Data
|
|
|
|
|
auto p = dynamic_cast<const struct Parameters*>(ip); |
|
|
|
|
auto [name, id, tid] = VarNameLoc(vname, times[i]); |
|
|
|
|
if(!name.Exist()) // Conversion read
|
|
|
|
|
return TransformationRead(this, vname, cache, ip, i); |
|
|
|
|
return TransformationRead(this, vname, cache, ip, i); |
|
|
|
|
|
|
|
|
|
// Direct read
|
|
|
|
|
bool nodepth = false; |
|
|
|
|