Skip to content

Commit

Permalink
Per #1626, add met_regrid_nearest() utility function since I'm callin…
Browse files Browse the repository at this point in the history
…g it twice.
  • Loading branch information
JohnHalleyGotway committed Jan 22, 2021
1 parent a42068c commit 4e3e622
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
18 changes: 18 additions & 0 deletions met/src/libcode/vx_regrid/vx_regrid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,24 @@ return ( out );
////////////////////////////////////////////////////////////////////////


DataPlane met_regrid_nearest (const DataPlane & from_data, const Grid & from_grid, const Grid & to_grid)

{

RegridInfo ri;
ri.enable = true;
ri.method = InterpMthd_Nearest;
ri.width = 1;
ri.shape = GridTemplateFactory::GridTemplate_Square;

return ( met_regrid_generic(from_data, from_grid, to_grid, ri) );

}


////////////////////////////////////////////////////////////////////////


DataPlane met_regrid_generic (const DataPlane & from_data, const Grid & from_grid, const Grid & to_grid, const RegridInfo & info)

{
Expand Down
2 changes: 1 addition & 1 deletion met/src/libcode/vx_regrid/vx_regrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extern DataPlane met_regrid (const DataPlane & in, const Grid & from_grid, const

////////////////////////////////////////////////////////////////////////


extern DataPlane met_regrid_nearest (const DataPlane & in, const Grid & from_grid, const Grid & to_grid);
extern DataPlane met_regrid_generic (const DataPlane & in, const Grid & from_grid, const Grid & to_grid, const RegridInfo & info);
extern DataPlane met_regrid_budget (const DataPlane & in, const Grid & from_grid, const Grid & to_grid, const RegridInfo & info);
extern DataPlane met_regrid_area_weighted (const DataPlane & in, const Grid & from_grid, const Grid & to_grid, const RegridInfo & info);
Expand Down
10 changes: 2 additions & 8 deletions met/src/libcode/vx_statistics/apply_mask.cc
Original file line number Diff line number Diff line change
Expand Up @@ -269,18 +269,12 @@ void parse_poly_mask(const ConcatString &mask_poly_str, const Grid &grid,
// Regrid, if necessary, using nearest neighbor.
if(!(mask_grid == grid)) {

RegridInfo ri;
ri.enable = true;
ri.method = InterpMthd_Nearest;
ri.width = 1;
ri.shape = GridTemplateFactory::GridTemplate_Square;

mlog << Debug(2)
<< "Regridding mask grid to the verification grid using nearest "
<< "neighbor interpolation:\n"
<< mask_grid.serialize() << "!=\n" << grid.serialize() << "\n";

mask_dp = met_regrid(mask_dp, mask_grid, grid, ri);
mask_dp = met_regrid_nearest(mask_dp, mask_grid, grid);
}
}

Expand Down Expand Up @@ -334,7 +328,7 @@ void process_poly_mask(const ConcatString &file_name, const Grid &grid,

////////////////////////////////////////////////////////////////////////
//
// Parse the poly mask information. If it's a gridded data file,
// Parse the poly mask information. If it's a gridded data file,
// return the masking grid, mask plane, and the name of the mask.
// If not, return the polyline object.
//
Expand Down

0 comments on commit 4e3e622

Please sign in to comment.