Commit 933efab1 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Replaced gridsearch_create_nn() by gridsearch_create().

parent 8b4d4d29
......@@ -273,12 +273,12 @@ void fillmiss_one_step(field_type *field1, field_type *field2, int maxfill)
}
int grid_search_nbr(struct gridsearch *gs, size_t num_neighbors, size_t *restrict nbr_add, double *restrict nbr_dist, double plon, double plat);
double nbr_compute_weights(size_t num_neighbors, const int *restrict src_grid_mask, bool *restrict nbr_mask, const size_t *restrict nbr_add, double *restrict nbr_dist);
size_t nbr_normalize_weights(size_t num_neighbors, double dist_tot, const bool *restrict nbr_mask, size_t *restrict nbr_add, double *restrict nbr_dist);
int grid_search_nbr(struct gridsearch *gs, size_t numNeighbors, size_t *restrict nbr_add, double *restrict nbr_dist, double plon, double plat);
double nbr_compute_weights(size_t numNeighbors, const int *restrict src_grid_mask, bool *restrict nbr_mask, const size_t *restrict nbr_add, double *restrict nbr_dist);
size_t nbr_normalize_weights(size_t numNeighbors, double dist_tot, const bool *restrict nbr_mask, size_t *restrict nbr_add, double *restrict nbr_dist);
static
void setmisstodis(field_type *field1, field_type *field2, int num_neighbors)
void setmisstodis(field_type *field1, field_type *field2, int numNeighbors)
{
int gridID = field1->grid;
int gridID0 = gridID;
......@@ -335,9 +335,9 @@ void setmisstodis(field_type *field1, field_type *field2, int num_neighbors)
if ( nv != nvals ) cdoAbort("Internal problem, number of valid values differ!");
NEW_2D(bool, nbr_mask, ompNumThreads, num_neighbors); // mask at nearest neighbors
NEW_2D(size_t, nbr_add, ompNumThreads, num_neighbors); // source address at nearest neighbors
NEW_2D(double, nbr_dist, ompNumThreads, num_neighbors); // angular distance four nearest neighbors
NEW_2D(bool, nbr_mask, ompNumThreads, numNeighbors); // mask at nearest neighbors
NEW_2D(size_t, nbr_add, ompNumThreads, numNeighbors); // source address at nearest neighbors
NEW_2D(double, nbr_dist, ompNumThreads, numNeighbors); // angular distance four nearest neighbors
clock_t start, finish;
start = clock();
......@@ -348,11 +348,7 @@ void setmisstodis(field_type *field1, field_type *field2, int num_neighbors)
{
bool xIsCyclic = false;
size_t dims[2] = {nvals, 0};
if ( num_neighbors == 1 )
gs = gridsearch_create_nn(xIsCyclic, dims, nvals, lons, lats);
else
gs = gridsearch_create(xIsCyclic, dims, nvals, lons, lats);
gs = gridsearch_create(xIsCyclic, dims, nvals, lons, lats);
gridsearch_extrapolate(gs);
}
......@@ -368,7 +364,7 @@ void setmisstodis(field_type *field1, field_type *field2, int num_neighbors)
#ifdef HAVE_OPENMP4
#pragma omp parallel for default(none) reduction(+:findex) shared(nbr_mask, nbr_add, nbr_dist) \
shared(mindex, vindex, array1, array2, xvals, yvals, gs, nmiss, num_neighbors)
shared(mindex, vindex, array1, array2, xvals, yvals, gs, nmiss, numNeighbors)
#endif
for ( unsigned i = 0; i < nmiss; ++i )
{
......@@ -377,13 +373,13 @@ void setmisstodis(field_type *field1, field_type *field2, int num_neighbors)
int ompthID = cdo_omp_get_thread_num();
grid_search_nbr(gs, num_neighbors, nbr_add[ompthID], nbr_dist[ompthID], xvals[mindex[i]], yvals[mindex[i]]);
grid_search_nbr(gs, numNeighbors, nbr_add[ompthID], nbr_dist[ompthID], xvals[mindex[i]], yvals[mindex[i]]);
/* Compute weights based on inverse distance if mask is false, eliminate those points */
double dist_tot = nbr_compute_weights(num_neighbors, NULL, nbr_mask[ompthID], nbr_add[ompthID], nbr_dist[ompthID]);
double dist_tot = nbr_compute_weights(numNeighbors, NULL, nbr_mask[ompthID], nbr_add[ompthID], nbr_dist[ompthID]);
/* Normalize weights and store the link */
size_t nadds = nbr_normalize_weights(num_neighbors, dist_tot, nbr_mask[ompthID], nbr_add[ompthID], nbr_dist[ompthID]);
size_t nadds = nbr_normalize_weights(numNeighbors, dist_tot, nbr_mask[ompthID], nbr_add[ompthID], nbr_dist[ompthID]);
if ( nadds )
{
double result = 0;
......
......@@ -49,7 +49,7 @@ enum {REMAPCON, REMAPCON2, REMAPBIL, REMAPBIC, REMAPDIS, REMAPNN, REMAPLAF, REMA
enum {HEAP_SORT, MERGE_SORT};
static
void get_maptype(int operfunc, RemapType *mapType, SubmapType *submapType, int *num_neighbors, int *remap_order)
void get_maptype(int operfunc, RemapType *mapType, SubmapType *submapType, int *numNeighbors, int *remap_order)
{
switch ( operfunc )
{
......@@ -88,12 +88,12 @@ void get_maptype(int operfunc, RemapType *mapType, SubmapType *submapType, int *
case REMAPDIS:
case GENDIS:
*mapType = RemapType::DISTWGT;
if ( *num_neighbors == 0 ) *num_neighbors = 4;
if ( *numNeighbors == 0 ) *numNeighbors = 4;
break;
case REMAPNN:
case GENNN:
*mapType = RemapType::DISTWGT;
*num_neighbors = 1;
*numNeighbors = 1;
break;
default:
cdoAbort("Unknown mapping method");
......@@ -102,7 +102,7 @@ void get_maptype(int operfunc, RemapType *mapType, SubmapType *submapType, int *
}
static
int maptype2operfunc(RemapType mapType, SubmapType submapType, int num_neighbors, int remap_order)
int maptype2operfunc(RemapType mapType, SubmapType submapType, int numNeighbors, int remap_order)
{
int operfunc = -1;
......@@ -110,7 +110,7 @@ int maptype2operfunc(RemapType mapType, SubmapType submapType, int num_neighbors
else if ( mapType == RemapType::CONSERV_YAC ) operfunc = (submapType == SubmapType::LAF) ? REMAPLAF : REMAPYCON;
else if ( mapType == RemapType::BILINEAR ) operfunc = REMAPBIL;
else if ( mapType == RemapType::BICUBIC ) operfunc = REMAPBIC;
else if ( mapType == RemapType::DISTWGT ) operfunc = (num_neighbors == 1) ? REMAPNN : REMAPDIS;
else if ( mapType == RemapType::DISTWGT ) operfunc = (numNeighbors == 1) ? REMAPNN : REMAPDIS;
else cdoAbort("Unsupported mapping method (mapType = %d)", mapType);
return operfunc;
......@@ -763,7 +763,7 @@ void *Remap(void *argument)
NormOpt normOpt(NormOpt::NONE);
RemapType mapType(RemapType::UNDEF);
SubmapType submapType(SubmapType::NONE);
int num_neighbors = 0;
int numNeighbors = 0;
char varname[CDI_MAX_NAME];
double missval;
char *remap_file = NULL;
......@@ -821,7 +821,7 @@ void *Remap(void *argument)
{
int inum = parameter2int(operatorArgv()[1]);
if ( inum < 1 ) cdoAbort("Number of nearest neighbors out of range (>0)!");
num_neighbors = inum;
numNeighbors = inum;
}
else
{
......@@ -863,7 +863,7 @@ void *Remap(void *argument)
if ( lremapxxx )
{
read_remap_scrip(remap_file, gridID1, gridID2, &mapType, &submapType, &num_neighbors,
read_remap_scrip(remap_file, gridID1, gridID2, &mapType, &submapType, &numNeighbors,
&remap_order, &remaps[0].src_grid, &remaps[0].tgt_grid, &remaps[0].vars);
if ( remaps[0].vars.links_per_value == 0 ) links_per_value(&remaps[0].vars);
......@@ -905,13 +905,13 @@ void *Remap(void *argument)
if ( remaps[0].tgt_grid.size != gridsize2 )
cdoAbort("Size of target grid and weights from %s differ!", remap_file);
operfunc = maptype2operfunc(mapType, submapType, num_neighbors, remap_order);
operfunc = maptype2operfunc(mapType, submapType, numNeighbors, remap_order);
if ( remap_test ) reorder_links(&remaps[0].vars);
}
else
{
get_maptype(operfunc, &mapType, &submapType, &num_neighbors, &remap_order);
get_maptype(operfunc, &mapType, &submapType, &numNeighbors, &remap_order);
}
if ( !remap_genweights && mapType != RemapType::CONSERV ) remap_genweights = true;
......@@ -1090,7 +1090,7 @@ void *Remap(void *argument)
if ( mapType == RemapType::CONSERV ) scrip_remap_conserv_weights(&remaps[r].src_grid, &remaps[r].tgt_grid, &remaps[r].vars);
else if ( mapType == RemapType::BILINEAR ) scrip_remap_bilinear_weights(&remaps[r].src_grid, &remaps[r].tgt_grid, &remaps[r].vars);
else if ( mapType == RemapType::BICUBIC ) scrip_remap_bicubic_weights(&remaps[r].src_grid, &remaps[r].tgt_grid, &remaps[r].vars);
else if ( mapType == RemapType::DISTWGT ) remap_distwgt_weights(num_neighbors, &remaps[r].src_grid, &remaps[r].tgt_grid, &remaps[r].vars);
else if ( mapType == RemapType::DISTWGT ) remap_distwgt_weights(numNeighbors, &remaps[r].src_grid, &remaps[r].tgt_grid, &remaps[r].vars);
else if ( mapType == RemapType::CONSERV_YAC ) remap_conserv_weights(&remaps[r].src_grid, &remaps[r].tgt_grid, &remaps[r].vars);
if ( mapType == RemapType::CONSERV && remaps[r].vars.num_links != remaps[r].vars.max_links )
......@@ -1139,7 +1139,7 @@ void *Remap(void *argument)
{
if ( mapType == RemapType::BILINEAR ) scrip_remap_bilinear(&remaps[r].src_grid, &remaps[r].tgt_grid, array1, array2, missval);
else if ( mapType == RemapType::BICUBIC ) scrip_remap_bicubic(&remaps[r].src_grid, &remaps[r].tgt_grid, array1, array2, missval);
else if ( mapType == RemapType::DISTWGT ) remap_distwgt(num_neighbors, &remaps[r].src_grid, &remaps[r].tgt_grid, array1, array2, missval);
else if ( mapType == RemapType::DISTWGT ) remap_distwgt(numNeighbors, &remaps[r].src_grid, &remaps[r].tgt_grid, array1, array2, missval);
else if ( mapType == RemapType::CONSERV_YAC ) remap_conserv(&remaps[r].src_grid, &remaps[r].tgt_grid, array1, array2, missval);
}
......@@ -1211,7 +1211,7 @@ void *Remap(void *argument)
WRITE_REMAP:
if ( lwrite_remap )
write_remap_scrip(cdoStreamName(1)->args, mapType, submapType, num_neighbors, remap_order,
write_remap_scrip(cdoStreamName(1)->args, mapType, submapType, numNeighbors, remap_order,
remaps[r].src_grid, remaps[r].tgt_grid, remaps[r].vars);
pstreamClose(streamID1);
......
......@@ -286,7 +286,7 @@ void read_coordinates(const char *filename, long n, double *lon, double *lat, in
streamClose(streamID);
}
int grid_search_nbr(struct gridsearch *gs, size_t num_neighbors, size_t *restrict nbr_add, double *restrict nbr_dist, double plon, double plat);
int grid_search_nbr(struct gridsearch *gs, size_t numNeighbors, size_t *restrict nbr_add, double *restrict nbr_dist, double plon, double plat);
int find_coordinate_to_ignore(double *cell_corners_xyz);
double calculate_the_polygon_area(double cell_corners[], int number_corners);
......
......@@ -46,7 +46,7 @@ typedef struct {
double intlin(double x, double y1, double x1, double y2, double x2);
double smooth_knn_compute_weights(size_t num_neighbors, const bool *restrict src_grid_mask, struct gsknn *knn, double search_radius, double weight0, double weightR)
double smooth_knn_compute_weights(size_t numNeighbors, const bool *restrict src_grid_mask, struct gsknn *knn, double search_radius, double weight0, double weightR)
{
bool *restrict nbr_mask = knn->mask;
const size_t *restrict nbr_add = knn->add;
......@@ -55,7 +55,7 @@ double smooth_knn_compute_weights(size_t num_neighbors, const bool *restrict src
// Compute weights based on inverse distance if mask is false, eliminate those points
double dist_tot = 0.; // sum of neighbor distances (for normalizing)
for ( size_t n = 0; n < num_neighbors; ++n )
for ( size_t n = 0; n < numNeighbors; ++n )
{
nbr_mask[n] = false;
if ( nbr_add[n] < SIZE_MAX && src_grid_mask[nbr_add[n]] )
......@@ -70,7 +70,7 @@ double smooth_knn_compute_weights(size_t num_neighbors, const bool *restrict src
}
size_t smooth_knn_normalize_weights(size_t num_neighbors, double dist_tot, struct gsknn *knn)
size_t smooth_knn_normalize_weights(size_t numNeighbors, double dist_tot, struct gsknn *knn)
{
const bool *restrict nbr_mask = knn->mask;
size_t *restrict nbr_add = knn->add;
......@@ -79,7 +79,7 @@ size_t smooth_knn_normalize_weights(size_t num_neighbors, double dist_tot, struc
// Normalize weights and store the link
size_t nadds = 0;
for ( size_t n = 0; n < num_neighbors; ++n )
for ( size_t n = 0; n < numNeighbors; ++n )
{
if ( nbr_mask[n] )
{
......@@ -97,8 +97,8 @@ void smooth(int gridID, double missval, const double *restrict array1, double *r
{
int gridID0 = gridID;
size_t gridsize = gridInqSize(gridID);
size_t num_neighbors = spoint.maxpoints;
if ( num_neighbors > gridsize ) num_neighbors = gridsize;
size_t numNeighbors = spoint.maxpoints;
if ( numNeighbors > gridsize ) numNeighbors = gridsize;
bool *mask = (bool*) Malloc(gridsize*sizeof(bool));
for ( size_t i = 0; i < gridsize; ++i )
......@@ -124,20 +124,15 @@ void smooth(int gridID, double missval, const double *restrict array1, double *r
struct gsknn **knn = (struct gsknn**) Malloc(ompNumThreads*sizeof(struct gsknn*));
for ( int i = 0; i < ompNumThreads; i++ )
knn[i] = gridsearch_knn_new(num_neighbors);
knn[i] = gridsearch_knn_new(numNeighbors);
clock_t start, finish;
start = clock();
struct gridsearch *gs = NULL;
bool xIsCyclic = false;
size_t dims[2] = {gridsize, 0};
if ( num_neighbors == 1 )
gs = gridsearch_create_nn(xIsCyclic, dims, gridsize, xvals, yvals);
else
gs = gridsearch_create(xIsCyclic, dims, gridsize, xvals, yvals);
struct gridsearch *gs = gridsearch_create(xIsCyclic, dims, gridsize, xvals, yvals);
gs->search_radius = spoint.radius;
......
......@@ -338,31 +338,6 @@ struct gridsearch *gridsearch_create(bool xIsCyclic, size_t dims[2], size_t n, c
gs->plons = lons;
gs->plats = lats;
if ( gs->method_nn == GridsearchMethod::kdtree ) gs->search_container = gs_create_kdtree(n, lons, lats, gs);
else if ( gs->method_nn == GridsearchMethod::nanoflann ) gs->search_container = gs_create_nanoflann(n, lons, lats, gs);
gs->search_radius = cdo_default_search_radius();
return gs;
}
struct gridsearch *gridsearch_create_nn(bool xIsCyclic, size_t dims[2], size_t n, const double *restrict lons, const double *restrict lats)
{
struct gridsearch *gs = (struct gridsearch *) Calloc(1, sizeof(struct gridsearch));
gs->is_cyclic = xIsCyclic;
gs->is_curve = n!=1 && n==dims[0]*dims[1];
gs->dims[0] = dims[0];
gs->dims[1] = dims[1];
gs->method_nn = gridsearch_method_nn;
gs->n = n;
if ( n == 0 ) return gs;
gs->plons = lons;
gs->plats = lats;
if ( gs->method_nn == GridsearchMethod::kdtree ) gs->search_container = gs_create_kdtree(n, lons, lats, gs);
else if ( gs->method_nn == GridsearchMethod::nanoflann ) gs->search_container = gs_create_nanoflann(n, lons, lats, gs);
else if ( gs->method_nn == GridsearchMethod::full ) gs->search_container = gs_create_full(n, lons, lats);
......@@ -694,9 +669,9 @@ size_t gridsearch_qnearest(struct gridsearch *gs, double lon, double lat, double
#define TINY 1.e-14
static
void knn_store_distance(size_t nadd, double distance, size_t num_neighbors, size_t *restrict nbr_add, double *restrict nbr_dist)
void knn_store_distance(size_t nadd, double distance, size_t numNeighbors, size_t *restrict nbr_add, double *restrict nbr_dist)
{
if ( num_neighbors == 1 )
if ( numNeighbors == 1 )
{
if ( distance < nbr_dist[0] || (distance <= nbr_dist[0] && nadd < nbr_add[0]) )
{
......@@ -706,11 +681,11 @@ void knn_store_distance(size_t nadd, double distance, size_t num_neighbors, size
}
else
{
for ( size_t nchk = 0; nchk < num_neighbors; ++nchk )
for ( size_t nchk = 0; nchk < numNeighbors; ++nchk )
{
if ( distance < nbr_dist[nchk] || (distance <= nbr_dist[nchk] && nadd < nbr_add[nchk]) )
{
for ( size_t n = num_neighbors-1; n > nchk; --n )
for ( size_t n = numNeighbors-1; n > nchk; --n )
{
nbr_add[n] = nbr_add[n-1];
nbr_dist[n] = nbr_dist[n-1];
......@@ -724,10 +699,10 @@ void knn_store_distance(size_t nadd, double distance, size_t num_neighbors, size
}
static
void knn_check_distance(size_t num_neighbors, const size_t *restrict nbr_add, double *restrict nbr_dist)
void knn_check_distance(size_t numNeighbors, const size_t *restrict nbr_add, double *restrict nbr_dist)
{
// If distance is zero, set to small number
for ( size_t nchk = 0; nchk < num_neighbors; ++nchk )
for ( size_t nchk = 0; nchk < numNeighbors; ++nchk )
if ( nbr_add[nchk] != GS_NOT_FOUND && nbr_dist[nchk] <= 0. ) nbr_dist[nchk] = TINY;
}
......@@ -784,8 +759,8 @@ size_t gridsearch_knn(struct gridsearch *gs, struct gsknn *knn, double plon, dou
/*
Output variables:
int nbr_add[num_neighbors] ! address of each of the closest points
double nbr_dist[num_neighbors] ! distance to each of the closest points
int nbr_add[numNeighbors] ! address of each of the closest points
double nbr_dist[numNeighbors] ! distance to each of the closest points
Input variables:
......@@ -798,11 +773,11 @@ size_t gridsearch_knn(struct gridsearch *gs, struct gsknn *knn, double plon, dou
// Initialize distance and address arrays
gridsearch_knn_init(knn);
size_t num_neighbors = knn->size;
size_t numNeighbors = knn->size;
size_t *restrict nbr_add = knn->add;
double *restrict nbr_dist = knn->dist;
size_t ndist = num_neighbors;
size_t ndist = numNeighbors;
// check some more points if distance is the same use the smaller index (nadd)
if ( ndist > 8 ) ndist += 8;
else ndist *= 2;
......@@ -819,7 +794,7 @@ size_t gridsearch_knn(struct gridsearch *gs, struct gsknn *knn, double plon, dou
size_t nadds = 0;
if ( num_neighbors == 1 )
if ( numNeighbors == 1 )
{
size_t add = gridsearch_nearest(gs, plon, plat, &range);
if ( add != GS_NOT_FOUND )
......@@ -839,14 +814,14 @@ size_t gridsearch_knn(struct gridsearch *gs, struct gsknn *knn, double plon, dou
}
ndist = nadds;
size_t max_neighbors = (ndist < num_neighbors) ? ndist : num_neighbors;
size_t max_neighbors = (ndist < numNeighbors) ? ndist : numNeighbors;
for ( size_t i = 0; i < ndist; ++i )
knn_store_distance(adds[i], dist[i], max_neighbors, nbr_add, nbr_dist);
knn_check_distance(max_neighbors, nbr_add, nbr_dist);
if ( ndist > num_neighbors ) ndist = num_neighbors;
if ( ndist > numNeighbors ) ndist = numNeighbors;
knn->ndist = ndist;
......
......@@ -48,7 +48,6 @@ size_t gridsearch_knn(struct gridsearch *gs, struct gsknn *knn, double plon, dou
struct gridsearch *gridsearch_create_reg2d(bool xIsCyclic, size_t dims[2], const double *restrict lons, const double *restrict lats);
struct gridsearch *gridsearch_create(bool xIsCyclic, size_t dims[2], size_t n, const double *restrict lons, const double *restrict lats);
struct gridsearch *gridsearch_create_nn(bool xIsCyclic, size_t dims[2], size_t n, const double *restrict lons, const double *restrict lats);
void gridsearch_delete(struct gridsearch *gs);
size_t gridsearch_nearest(struct gridsearch *gs, double lon, double lat, double *range);
size_t gridsearch_qnearest(struct gridsearch *gs, double lon, double lat, double *prange, size_t nnn, size_t *adds, double *dist);
......
......@@ -166,13 +166,13 @@ void remap_sum(double *restrict dst_array, double missval, size_t dst_size, size
void scrip_remap_bilinear_weights(remapgrid_t *src_grid, remapgrid_t *tgt_grid, remapvars_t *rv);
void scrip_remap_bicubic_weights(remapgrid_t *src_grid, remapgrid_t *tgt_grid, remapvars_t *rv);
void remap_distwgt_weights(size_t num_neighbors, remapgrid_t *src_grid, remapgrid_t *tgt_grid, remapvars_t *rv);
void remap_distwgt_weights(size_t numNeighbors, remapgrid_t *src_grid, remapgrid_t *tgt_grid, remapvars_t *rv);
void scrip_remap_conserv_weights(remapgrid_t *src_grid, remapgrid_t *tgt_grid, remapvars_t *rv);
void remap_conserv_weights(remapgrid_t *src_grid, remapgrid_t *tgt_grid, remapvars_t *rv);
void scrip_remap_bilinear(remapgrid_t *src_grid, remapgrid_t *tgt_grid, const double *restrict src_array, double *restrict tgt_array, double missval);
void scrip_remap_bicubic(remapgrid_t *src_grid, remapgrid_t *tgt_grid, const double *restrict src_array, double *restrict tgt_array, double missval);
void remap_distwgt(size_t num_neighbors, remapgrid_t *src_grid, remapgrid_t *tgt_grid, const double *restrict src_array, double *restrict tgt_array, double missval);
void remap_distwgt(size_t numNeighbors, remapgrid_t *src_grid, remapgrid_t *tgt_grid, const double *restrict src_array, double *restrict tgt_array, double missval);
void remap_conserv(remapgrid_t *src_grid, remapgrid_t *tgt_grid, const double *restrict src_array, double *restrict tgt_array, double missval);
......@@ -188,9 +188,9 @@ void reorder_links(remapvars_t *rv);
void sort_add(size_t num_links, size_t num_wts, size_t *restrict add1, size_t *restrict add2, double *restrict weights);
void sort_iter(size_t num_links, size_t num_wts, size_t *restrict add1, size_t *restrict add2, double *restrict weights, int parent);
void write_remap_scrip(const char *interp_file, RemapType mapType, SubmapType submapType, int num_neighbors,
void write_remap_scrip(const char *interp_file, RemapType mapType, SubmapType submapType, int numNeighbors,
int remap_order, remapgrid_t src_grid, remapgrid_t tgt_grid, remapvars_t rv);
void read_remap_scrip(const char *interp_file, int gridID1, int gridID2, RemapType *mapType, SubmapType *submapType, int *num_neighbors,
void read_remap_scrip(const char *interp_file, int gridID1, int gridID2, RemapType *mapType, SubmapType *submapType, int *numNeighbors,
int *remap_order, remapgrid_t *src_grid, remapgrid_t *tgt_grid, remapvars_t *rv);
void calc_lat_bins(remapgrid_t* src_grid, remapgrid_t* tgt_grid, RemapType mapType);
......
......@@ -289,7 +289,7 @@ void scrip_remap_bicubic(remapgrid_t *src_grid, remapgrid_t *tgt_grid, const dou
size_t dims[2] = {src_grid->size, 0};
struct gridsearch *gs = NULL;
if ( remap_grid_type != REMAP_GRID_TYPE_REG2D )
gs = gridsearch_create_nn(xIsCyclic, dims, src_grid->size, src_grid->cell_center_lon, src_grid->cell_center_lat);
gs = gridsearch_create(xIsCyclic, dims, src_grid->size, src_grid->cell_center_lon, src_grid->cell_center_lat);
#endif
size_t tgt_grid_size = tgt_grid->size;
......
......@@ -372,7 +372,7 @@ void scrip_remap_bilinear(remapgrid_t *src_grid, remapgrid_t *tgt_grid, const do
size_t dims[2] = {src_grid->size, 0};
struct gridsearch *gs = NULL;
if ( remap_grid_type != REMAP_GRID_TYPE_REG2D )
gs = gridsearch_create_nn(xIsCyclic, dims, src_grid->size, src_grid->cell_center_lon, src_grid->cell_center_lat);
gs = gridsearch_create(xIsCyclic, dims, src_grid->size, src_grid->cell_center_lon, src_grid->cell_center_lat);
#endif
size_t tgt_grid_size = tgt_grid->size;
......
This diff is collapsed.
......@@ -67,7 +67,7 @@ void read_links(int nc_file_id, int nc_add_id, size_t num_links, size_t *cell_ad
#endif
void write_remap_scrip(const char *interp_file, RemapType mapType, SubmapType submapType, int num_neighbors,
void write_remap_scrip(const char *interp_file, RemapType mapType, SubmapType submapType, int numNeighbors,
int remap_order, remapgrid_t src_grid, remapgrid_t tgt_grid, remapvars_t rv)
{
// Writes remap data to a NetCDF file using SCRIP conventions
......@@ -171,7 +171,7 @@ void write_remap_scrip(const char *interp_file, RemapType mapType, SubmapType su
strcpy(map_method, "Bicubic remapping");
break;
case RemapType::DISTWGT:
if ( num_neighbors == 1 )
if ( numNeighbors == 1 )
strcpy(map_method, "Nearest neighbor");
else
strcpy(map_method, "Distance weighted avg of nearest neighbors");
......@@ -449,7 +449,7 @@ void write_remap_scrip(const char *interp_file, RemapType mapType, SubmapType su
/*****************************************************************************/
void read_remap_scrip(const char *interp_file, int gridID1, int gridID2, RemapType *mapType, SubmapType *submapType, int *num_neighbors,
void read_remap_scrip(const char *interp_file, int gridID1, int gridID2, RemapType *mapType, SubmapType *submapType, int *numNeighbors,
int *remap_order, remapgrid_t *src_grid, remapgrid_t *tgt_grid, remapvars_t *rv)
{
// The routine reads a NetCDF file to extract remapping info in SCRIP format
......@@ -569,12 +569,12 @@ void read_remap_scrip(const char *interp_file, int gridID1, int gridID2, RemapTy
else if ( cmpstr(map_method, "Distance") == 0 )
{
rv->mapType = RemapType::DISTWGT;
*num_neighbors = 4;
*numNeighbors = 4;
}
else if ( cmpstr(map_method, "Nearest") == 0 )
{
rv->mapType = RemapType::DISTWGT;
*num_neighbors = 1;
*numNeighbors = 1;
}
else if ( cmpstr(map_method, "Largest") == 0 )
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment