Skip to content
Snippets Groups Projects
Commit ad11d573 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

remap_scrip_io: add global attribute num_neighbors

parent 1e264d38
No related branches found
No related tags found
1 merge request!82M214003/develop
......@@ -290,6 +290,9 @@ remap_write_data_scrip(const char *weightsfile, const RemapSwitches &remapSwitch
auto mapMethod = set_map_method_cstr(remapSwitches, needGridarea);
put_att_text(ncId, NC_GLOBAL, "map_method", mapMethod);
if (remapSwitches.mapType == RemapMethod::DISTWGT && remapSwitches.numNeighbors > 1 && remapSwitches.numNeighbors != 4)
nce(nc_put_att_int(ncId, NC_GLOBAL, "num_neighbors", NC_INT, 1L, &remapSwitches.numNeighbors));
// Remap order
if (remapSwitches.mapType == RemapMethod::CONSERV_SCRIP && remapSwitches.submapType == SubmapType::NONE)
nce(nc_put_att_int(ncId, NC_GLOBAL, "remap_order", NC_INT, 1L, &remapSwitches.remapOrder));
......@@ -527,13 +530,22 @@ get_maptype(int ncId)
if (status == NC_NOERR) remapSwitches.remapOrder = iatt;
}
else if (cdo_cmpstrLenRhs(mapMethod, "Bilinear"))
remapSwitches.mapType = RemapMethod::BILINEAR;
{
remapSwitches.mapType = RemapMethod::BILINEAR;
}
else if (cdo_cmpstrLenRhs(mapMethod, "Bicubic"))
remapSwitches.mapType = RemapMethod::BICUBIC;
{
remapSwitches.mapType = RemapMethod::BICUBIC;
}
else if (cdo_cmpstrLenRhs(mapMethod, "Distance"))
{
int numNeighbors = 4;
int iatt;
int status = nc_get_att_int(ncId, NC_GLOBAL, "num_neighbors", &iatt);
if (status == NC_NOERR && iatt > 0) numNeighbors = iatt;
remapSwitches.mapType = RemapMethod::DISTWGT;
remapSwitches.numNeighbors = 4;
remapSwitches.numNeighbors = numNeighbors;
}
else if (cdo_cmpstrLenRhs(mapMethod, "Nearest"))
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment