Skip to content

Commit

Permalink
Per #1693, updated the vx_grid library to be able to read laea grids,…
Browse files Browse the repository at this point in the history
… as currently implemented. Since they rely on the vx_geodesy library, I also updated all the Makefile.am files by adding -lvx_geodesy immediately after each -lvx_grid entry.
  • Loading branch information
JohnHalleyGotway committed May 13, 2021
1 parent 69570c8 commit c1a55f8
Show file tree
Hide file tree
Showing 50 changed files with 146 additions and 36 deletions.
1 change: 1 addition & 0 deletions met/internal_tests/basic/vx_util/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ test_ascii_header_LDADD = -lvx_stat_out \
-lvx_nc_util \
-lvx_regrid \
-lvx_grid \
-lvx_geodesy \
-lvx_config \
-lvx_gsl_prob \
-lvx_cal \
Expand Down
4 changes: 3 additions & 1 deletion met/internal_tests/libcode/vx_data2d/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ test_table_read_LDADD = -lvx_config \
-lvx_gsl_prob \
-lvx_log \
-lvx_data2d \
-lvx_grid \
-lvx_grid \
-lvx_geodesy \
-lvx_util \
-lvx_cal \
-lvx_math \
Expand All @@ -35,6 +36,7 @@ dump_default_table_LDADD = -lvx_config \
-lvx_log \
-lvx_data2d \
-lvx_grid \
-lvx_geodesy \
-lvx_util \
-lvx_cal \
-lvx_math \
Expand Down
1 change: 1 addition & 0 deletions met/internal_tests/libcode/vx_data2d_factory/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ test_factory_LDADD = -lvx_stat_out \
-lvx_nc_util \
-lvx_regrid \
-lvx_grid \
-lvx_geodesy \
-lvx_config \
-lvx_gsl_prob \
-lvx_cal \
Expand Down
1 change: 1 addition & 0 deletions met/internal_tests/libcode/vx_data2d_grib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ test_read_grib1_LDFLAGS = -L. ${MET_LDFLAGS}
test_read_grib1_LDADD = -lvx_data2d_grib \
-lvx_data2d \
-lvx_grid \
-lvx_geodesy \
-lvx_config \
-lvx_gsl_prob \
-lvx_util \
Expand Down
1 change: 1 addition & 0 deletions met/internal_tests/libcode/vx_data2d_nc_met/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ test_read_nc_met_LDADD = -lvx_data2d_nc_met \
-lvx_nc_util \
-lvx_data2d \
-lvx_grid \
-lvx_geodesy \
-lvx_config \
-lvx_gsl_prob \
-lvx_util \
Expand Down
1 change: 1 addition & 0 deletions met/internal_tests/libcode/vx_data2d_nccf/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ test_read_nccf_LDADD = -lvx_data2d_nccf \
-lvx_nc_util \
-lvx_data2d \
-lvx_grid \
-lvx_geodesy \
-lvx_config \
-lvx_gsl_prob \
-lvx_util \
Expand Down
2 changes: 2 additions & 0 deletions met/internal_tests/libcode/vx_grid/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ test_grid_area_SOURCES = test_grid_area.cc
test_grid_area_CPPFLAGS = ${MET_CPPFLAGS}
test_grid_area_LDFLAGS = -L. ${MET_LDFLAGS}
test_grid_area_LDADD = -lvx_grid \
-lvx_geodesy \
-lvx_geodesy \
-lvx_nav \
-lvx_util \
-lvx_math \
Expand Down
1 change: 1 addition & 0 deletions met/internal_tests/libcode/vx_nc_util/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ test_pressure_levels_LDADD = -lvx_stat_out \
-lvx_nc_util \
-lvx_regrid \
-lvx_grid \
-lvx_geodesy \
-lvx_config \
-lvx_gsl_prob \
-lvx_cal \
Expand Down
3 changes: 2 additions & 1 deletion met/internal_tests/libcode/vx_series_data/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ test_series_data_LDADD = -lvx_config \
-lvx_nc_util \
-lvx_log \
-lvx_data2d \
-lvx_grid \
-lvx_grid \
-lvx_geodesy \
-lvx_util \
-lvx_cal \
-lvx_math \
Expand Down
2 changes: 2 additions & 0 deletions met/internal_tests/libcode/vx_tc_util/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ test_read_LDADD = -lvx_stat_out \
-lvx_nc_util \
-lvx_regrid \
-lvx_grid \
-lvx_geodesy \
-lvx_config \
-lvx_gsl_prob \
-lvx_cal \
Expand Down Expand Up @@ -72,6 +73,7 @@ test_read_prob_LDADD = -lvx_stat_out \
-lvx_nc_util \
-lvx_regrid \
-lvx_grid \
-lvx_geodesy \
-lvx_config \
-lvx_gsl_prob \
-lvx_cal \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ test_velocity_LDADD = \
-lvx_nc_util \
-lvx_regrid \
-lvx_grid \
-lvx_geodesy \
-lvx_config \
-lvx_gsl_prob \
-lvx_cal \
Expand Down
19 changes: 19 additions & 0 deletions met/src/libcode/vx_grid/find_grid_by_name.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ static bool parse_mercator_grid(const StringArray &, Grid &);

static bool parse_gaussian_grid(const StringArray &, Grid &);

static bool parse_laea_grid(const StringArray &, Grid &);


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

Expand All @@ -58,6 +60,7 @@ if ( i.st ) { g.set( *(i.st) ); status = true; }
if ( i.ll ) { g.set( *(i.ll) ); status = true; }
if ( i.m ) { g.set( *(i.m) ); status = true; }
if ( i.g ) { g.set( *(i.g) ); status = true; }
if ( i.la ) { g.set( *(i.la) ); status = true; }

return ( status );

Expand Down Expand Up @@ -185,6 +188,22 @@ for (j=0; j<n_ncep_gaussian_grids; ++j) {

}

}

//
// try misc laea grids
//

for (j=0; j<n_misc_laea_grids; ++j) {

if ( strcmp(name, misc_laea_grids[j].name) == 0 ) {

i.set( misc_laea_grids[j] );

return ( true );

}

}

//
Expand Down
17 changes: 17 additions & 0 deletions met/src/libcode/vx_grid/find_grid_by_name.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,23 @@ static const GaussianData ncep_gaussian_grids [] = {
static const int n_ncep_gaussian_grids = sizeof(ncep_gaussian_grids)/sizeof(*ncep_gaussian_grids);


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


//
// Lambert Azimuthal Equal Area grids
//


static const LaeaData misc_laea_grids [] = {

{ "EUMETNET", "WGS_84", 31.7462, 10.4346, 67.0228, 39.5358, 31.9877, -29.421, 55.0, -10.0, 1900, 2200 },

};

static const int n_misc_laea_grids = sizeof(misc_laea_grids)/sizeof(*misc_laea_grids);


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


Expand Down
57 changes: 57 additions & 0 deletions met/src/libcode/vx_grid/grid_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ rll = (const RotatedLatLonData *) 0;
m = (const MercatorData *) 0;
g = (const GaussianData *) 0;
gi = (const GoesImagerData *) 0;
la = (const LaeaData *) 0;

clear();

Expand All @@ -317,6 +318,7 @@ if ( rll ) { delete rll; rll = (const RotatedLatLonData *) 0; };
if ( m ) { delete m; m = (const MercatorData *) 0; };
if ( g ) { delete g; g = (const GaussianData *) 0; };
if ( gi ) { delete gi; gi = (const GoesImagerData *) 0; };
if ( la ) { delete la; la = (const LaeaData *) 0; };

return;

Expand All @@ -337,6 +339,7 @@ if ( info.rll ) set( *(info.rll) );
if ( info.m ) set( *(info.m ) );
if ( info.g ) set( *(info.g ) );
if ( info.gi ) set( *(info.gi ) );
if ( info.la ) set( *(info.la ) );

return;

Expand All @@ -359,6 +362,7 @@ if ( rll ) ++count;
if ( m ) ++count;
if ( g ) ++count;
if ( gi ) ++count;
if ( la ) ++count;

return ( count == 1 );

Expand Down Expand Up @@ -387,6 +391,7 @@ else if ( rll ) gg.set( *rll );
else if ( m ) gg.set( *m );
else if ( g ) gg.set( *g );
else if ( gi ) gg.set( *gi );
else if ( la ) gg.set( *la );

return;

Expand Down Expand Up @@ -547,6 +552,28 @@ return;
}


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


void GridInfo::set(const LaeaData & data)

{

clear();

LaeaData * D = (LaeaData *) 0;

D = new LaeaData;

memcpy(D, &data, sizeof(data));

la = D; D = (LaeaData *) 0;

return;

}


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


Expand Down Expand Up @@ -1181,6 +1208,7 @@ else if ( i1.rll && i2.rll ) return ( is_eq(i1.rll, i2.rll) );
else if ( i1.m && i2.m ) return ( is_eq(i1.m, i2.m ) );
else if ( i1.g && i2.g ) return ( is_eq(i1.g, i2.g ) );
else if ( i1.gi && i2.gi ) return ( is_eq(i1.gi, i2.gi ) );
else if ( i1.la && i2.la ) return ( is_eq(i1.la, i2.la ) );

return ( false );

Expand Down Expand Up @@ -1382,6 +1410,35 @@ return ( status );

}


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


bool is_eq(const LaeaData * g1, const LaeaData * g2)

{

if ( !g1 || !g2 ) return ( false );

bool status = false;

if ( g1->lat_LL == g2->lat_LL &&
g1->lat_UL == g2->lat_UL &&
g1->lat_LR == g2->lat_LR &&
is_eq (rescale_lon(g1->lon_LL),
rescale_lon(g2->lon_LL), loose_tol) &&
is_eq (rescale_lon(g1->lon_UL),
rescale_lon(g2->lon_UL), loose_tol) &&
is_eq (rescale_lon(g1->lon_LR),
rescale_lon(g2->lon_LR), loose_tol) &&
g1->nx == g2->nx &&
g1->ny == g2->ny ) status = true;

return ( status );

}


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


Expand Down
1 change: 1 addition & 0 deletions met/src/libcode/vx_grid/grid_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ extern bool is_eq(const RotatedLatLonData *, const RotatedLatLonData *);
extern bool is_eq(const MercatorData *, const MercatorData *);
extern bool is_eq(const GaussianData *, const GaussianData *);
extern bool is_eq(const GoesImagerData *, const GoesImagerData *);
extern bool is_eq(const LaeaData *, const LaeaData *);


////////////////////////////////////////////////////////////////////////
Expand Down
33 changes: 0 additions & 33 deletions met/src/libcode/vx_grid/laea_grid_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,39 +41,6 @@ struct LaeaData {
};


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


//
// Laea grid definitions
//


static const LaeaData eumetnet_data = {


"Laea", // name

"WGS_84", // geoid

31.7462, // lat_LL // lower left
10.4346, // lon_LL

67.0228, // lat_UL // upper left
39.5358, // lon_UL

31.9877, // lat_LR // lower right
-29.421, // lon_LR

55.0, // lat_pole
-10.0, // lon_pole

1900, // nx
2200, // ny

};


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


Expand Down
2 changes: 1 addition & 1 deletion met/src/libcode/vx_grid/vx_grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "merc_grid.h"
#include "gaussian_grid.h"
#include "tcrmw_grid.h"

#include "laea_grid.h"
#include "find_grid_by_name.h"


Expand Down
1 change: 1 addition & 0 deletions met/src/tools/core/ensemble_stat/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ ensemble_stat_LDADD = -lvx_stat_out \
-lvx_nc_util \
-lvx_regrid \
-lvx_grid \
-lvx_geodesy \
-lvx_config \
-lvx_cal \
-lvx_util \
Expand Down
1 change: 1 addition & 0 deletions met/src/tools/core/grid_stat/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ grid_stat_LDADD = -lvx_stat_out \
-lvx_nc_util \
-lvx_regrid \
-lvx_grid \
-lvx_geodesy \
-lvx_config \
-lvx_cal \
-lvx_util \
Expand Down
1 change: 1 addition & 0 deletions met/src/tools/core/mode/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ mode_LDADD = -lvx_pxm \
-lvx_nc_util \
-lvx_regrid \
-lvx_grid \
-lvx_geodesy \
-lvx_config \
-lvx_cal \
-lvx_util \
Expand Down
1 change: 1 addition & 0 deletions met/src/tools/core/mode_analysis/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ mode_analysis_LDADD = -lvx_stat_out \
-lvx_nc_util \
-lvx_regrid \
-lvx_grid \
-lvx_geodesy \
-lvx_config \
-lvx_gsl_prob \
-lvx_cal \
Expand Down
1 change: 1 addition & 0 deletions met/src/tools/core/pcp_combine/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pcp_combine_LDADD = -lvx_data2d_factory \
-lvx_nc_util \
-lvx_regrid \
-lvx_grid \
-lvx_geodesy \
-lvx_config \
-lvx_cal \
-lvx_util \
Expand Down
1 change: 1 addition & 0 deletions met/src/tools/core/point_stat/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ point_stat_LDADD = -lvx_stat_out \
-lvx_nc_util \
-lvx_regrid \
-lvx_grid \
-lvx_geodesy \
-lvx_config \
-lvx_cal \
-lvx_util \
Expand Down
1 change: 1 addition & 0 deletions met/src/tools/core/series_analysis/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ series_analysis_LDADD = -lvx_stat_out \
-lvx_nc_util \
-lvx_regrid \
-lvx_grid \
-lvx_geodesy \
-lvx_config \
-lvx_cal \
-lvx_util \
Expand Down
Loading

0 comments on commit c1a55f8

Please sign in to comment.