Skip to content

Commit

Permalink
Per #1055, ci-run-unit, update the Grid::serialize() member functions…
Browse files Browse the repository at this point in the history
… to let the caller specify the separator string, with a single space as the default. Write retriving a gridded data plane, also write out it's grid information.
  • Loading branch information
JohnHalleyGotway committed Feb 5, 2022
1 parent d8a705c commit ee74821
Show file tree
Hide file tree
Showing 17 changed files with 83 additions and 79 deletions.
18 changes: 11 additions & 7 deletions met/src/libcode/vx_data2d/data_class.cc
Original file line number Diff line number Diff line change
Expand Up @@ -361,21 +361,25 @@ if ( vinfo->grid_attr().nxy() > 0 ) {
}

//
// Print a data summary
// Print the grid information and data summary
//

if ( mlog.verbosity_level() >= 4 ) {

mlog << Debug(4) << "\n"
<< "Grid information:\n "
<< Dest_Grid->serialize("\n ") << "\n";

double min_v, max_v;
dp.data_range(min_v, max_v);
mlog << Debug(4) << "\n"
<< "Data plane information:\n"
<< " plane min: " << min_v << "\n"
<< " plane max: " << max_v << "\n"
<< " valid time: " << unix_to_yyyymmdd_hhmmss(dp.valid()) << "\n"
<< " lead time: " << sec_to_hhmmss(dp.lead()) << "\n"
<< " init time: " << unix_to_yyyymmdd_hhmmss(dp.init()) << "\n"
<< " accum time: " << sec_to_hhmmss(dp.accum()) << "\n\n";
<< " plane min: " << min_v << "\n"
<< " plane max: " << max_v << "\n"
<< " valid time: " << unix_to_yyyymmdd_hhmmss(dp.valid()) << "\n"
<< " lead time: " << sec_to_hhmmss(dp.lead()) << "\n"
<< " init time: " << unix_to_yyyymmdd_hhmmss(dp.init()) << "\n"
<< " accum time: " << sec_to_hhmmss(dp.accum()) << "\n\n";

}

Expand Down
8 changes: 4 additions & 4 deletions met/src/libcode/vx_grid/gaussian_grid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -370,19 +370,19 @@ return;
////////////////////////////////////////////////////////////////////////


ConcatString GaussianGrid::serialize() const
ConcatString GaussianGrid::serialize(const char *sep) const

{

ConcatString a;
char junk[256];

a << "Projection: Gaussian";
a << "Projection: Gaussian" << sep;

snprintf(junk, sizeof(junk), " Lon_Zero: %.4f", Lon_Zero); a << junk;

a << " Nx: " << Nx;
a << " Ny: " << Ny;
a << "Nx: " << Nx << sep;
a << "Ny: " << Ny;

//
// done
Expand Down
2 changes: 1 addition & 1 deletion met/src/libcode/vx_grid/gaussian_grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class GaussianGrid : public GridRep {

void dump(ostream &, int = 0) const;

ConcatString serialize() const;
ConcatString serialize(const char *sep=" ") const;

GridInfo info() const;

Expand Down
8 changes: 4 additions & 4 deletions met/src/libcode/vx_grid/goes_grid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -307,17 +307,17 @@ return;
////////////////////////////////////////////////////////////////////////


ConcatString GoesImagerGrid::serialize() const
ConcatString GoesImagerGrid::serialize(const char *sep) const

{

ConcatString a;
char junk[256];

a << "Projection: GoesImager";
a << "Projection: GoesImager" << sep;

a << " Nx: " << Nx;
a << " Ny: " << Ny;
a << "Nx: " << Nx << sep;
a << "Ny: " << Ny;

//snprintf(junk, sizeof(junk), " Lat_LL: %.3f", Lat_LL); a << junk;
//snprintf(junk, sizeof(junk), " Lon_LL: %.3f", Lon_LL); a << junk;
Expand Down
2 changes: 1 addition & 1 deletion met/src/libcode/vx_grid/goes_grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class GoesImagerGrid : public GridRep {

void dump(ostream &, int = 0) const;

ConcatString serialize() const;
ConcatString serialize(const char *sep=" ") const;

GridInfo info () const;

Expand Down
4 changes: 2 additions & 2 deletions met/src/libcode/vx_grid/grid_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -900,13 +900,13 @@ return ( rep->name() );
////////////////////////////////////////////////////////////////////////


ConcatString Grid::serialize() const
ConcatString Grid::serialize(const char *sep) const

{

ConcatString s;

if ( rep ) s = rep->serialize();
if ( rep ) s = rep->serialize(sep);

return ( s );

Expand Down
4 changes: 2 additions & 2 deletions met/src/libcode/vx_grid/grid_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class GridRep : public GridInterface {

virtual void dump(ostream &, int = 0) const = 0;

virtual ConcatString serialize() const = 0;
virtual ConcatString serialize(const char *sep=" ") const = 0;

virtual GridInfo info() const = 0;

Expand Down Expand Up @@ -240,7 +240,7 @@ class Grid : public GridInterface {

ConcatString name() const;

ConcatString serialize() const;
ConcatString serialize(const char *sep=" ") const;

GridInfo info() const;

Expand Down
18 changes: 9 additions & 9 deletions met/src/libcode/vx_grid/latlon_grid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -286,26 +286,26 @@ return;
////////////////////////////////////////////////////////////////////////


ConcatString LatLonGrid::serialize() const
ConcatString LatLonGrid::serialize(const char *sep) const

{

ConcatString a;
char junk[256];


a << "Projection: Lat/Lon";
a << "Projection: Lat/Lon" << sep;

a << " Nx: " << Nx;
a << " Ny: " << Ny;
a << "Nx: " << Nx << sep;
a << "Ny: " << Ny << sep;

snprintf(junk, sizeof(junk), " lat_ll: %.3f", lat_ll); a << junk;
snprintf(junk, sizeof(junk), " lon_ll: %.3f", lon_ll); a << junk;
snprintf(junk, sizeof(junk), "lat_ll: %.3f", lat_ll); a << junk << sep;
snprintf(junk, sizeof(junk), "lon_ll: %.3f", lon_ll); a << junk << sep;

snprintf(junk, sizeof(junk), " delta_lat: %.3f", delta_lat); a << junk;
snprintf(junk, sizeof(junk), " delta_lon: %.3f", delta_lon); a << junk;
snprintf(junk, sizeof(junk), "delta_lat: %.3f", delta_lat); a << junk << sep;
snprintf(junk, sizeof(junk), "delta_lon: %.3f", delta_lon); a << junk << sep;

snprintf(junk, sizeof(junk), " wrapLon: %s", bool_to_string(wrapLon)); a << junk;
snprintf(junk, sizeof(junk), "wrapLon: %s", bool_to_string(wrapLon)); a << junk;

//
// done
Expand Down
2 changes: 1 addition & 1 deletion met/src/libcode/vx_grid/latlon_grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class LatLonGrid : public GridRep {

void dump(ostream &, int = 0) const;

ConcatString serialize() const;
ConcatString serialize(const char *sep=" ") const;

GridInfo info() const;

Expand Down
22 changes: 11 additions & 11 deletions met/src/libcode/vx_grid/lc_grid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -551,29 +551,29 @@ return;
////////////////////////////////////////////////////////////////////////


ConcatString LambertGrid::serialize() const
ConcatString LambertGrid::serialize(const char *sep) const

{

ConcatString a;
char junk[256];

a << "Projection: Lambert Conformal";
a << "Projection: Lambert Conformal" << sep;

a << " Nx: " << Nx;
a << " Ny: " << Ny;
a << "Nx: " << Nx << sep;
a << "Ny: " << Ny << sep;

snprintf(junk, sizeof(junk), " Lat_LL: %.3f", Lat_LL); a << junk;
snprintf(junk, sizeof(junk), " Lon_LL: %.3f", Lon_LL); a << junk;
snprintf(junk, sizeof(junk), "Lat_LL: %.3f", Lat_LL); a << junk << sep;
snprintf(junk, sizeof(junk), "Lon_LL: %.3f", Lon_LL); a << junk << sep;

snprintf(junk, sizeof(junk), " Lon_orient: %.3f", Lon_orient); a << junk;
snprintf(junk, sizeof(junk), "Lon_orient: %.3f", Lon_orient); a << junk << sep;

snprintf(junk, sizeof(junk), " Alpha: %.3f", Alpha); a << junk;
snprintf(junk, sizeof(junk), "Alpha: %.3f", Alpha); a << junk << sep;

snprintf(junk, sizeof(junk), " Cone: %.3f", Cone); a << junk;
snprintf(junk, sizeof(junk), "Cone: %.3f", Cone); a << junk << sep;

snprintf(junk, sizeof(junk), " Bx: %.4f", Bx); a << junk;
snprintf(junk, sizeof(junk), " By: %.4f", By); a << junk;
snprintf(junk, sizeof(junk), "Bx: %.4f", Bx); a << junk << sep;
snprintf(junk, sizeof(junk), "By: %.4f", By); a << junk;

//
// done
Expand Down
2 changes: 1 addition & 1 deletion met/src/libcode/vx_grid/lc_grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class LambertGrid : public GridRep {

void dump(ostream &, int = 0) const;

ConcatString serialize() const;
ConcatString serialize(const char *sep=" ") const;

GridInfo info () const;

Expand Down
24 changes: 12 additions & 12 deletions met/src/libcode/vx_grid/merc_grid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -503,29 +503,29 @@ return;
////////////////////////////////////////////////////////////////////////


ConcatString MercatorGrid::serialize() const
ConcatString MercatorGrid::serialize(const char *sep) const

{

ConcatString a;
char junk[256];

a << "Projection: Mercator";
a << "Projection: Mercator" << sep;

a << " Nx: " << Nx;
a << " Ny: " << Ny;
a << "Nx: " << Nx << sep;
a << "Ny: " << Ny << sep;

snprintf(junk, sizeof(junk), " Lat_LL_radians: %.4f", Lat_LL_radians); a << junk;
snprintf(junk, sizeof(junk), " Lon_LL_radians: %.4f", Lon_LL_radians); a << junk;
snprintf(junk, sizeof(junk), "Lat_LL_radians: %.4f", Lat_LL_radians); a << junk << sep;
snprintf(junk, sizeof(junk), "Lon_LL_radians: %.4f", Lon_LL_radians); a << junk << sep;

snprintf(junk, sizeof(junk), " Lat_UR_radians: %.4f", Lat_UR_radians); a << junk;
snprintf(junk, sizeof(junk), " Lon_UR_radians: %.4f", Lon_UR_radians); a << junk;
snprintf(junk, sizeof(junk), "Lat_UR_radians: %.4f", Lat_UR_radians); a << junk << sep;
snprintf(junk, sizeof(junk), "Lon_UR_radians: %.4f", Lon_UR_radians); a << junk << sep;

snprintf(junk, sizeof(junk), " Mx: %.4f", Mx); a << junk;
snprintf(junk, sizeof(junk), " My: %.4f", My); a << junk;
snprintf(junk, sizeof(junk), "Mx: %.4f", Mx); a << junk << sep;
snprintf(junk, sizeof(junk), "My: %.4f", My); a << junk << sep;

snprintf(junk, sizeof(junk), " Bx: %.4f", Bx); a << junk;
snprintf(junk, sizeof(junk), " By: %.4f", By); a << junk;
snprintf(junk, sizeof(junk), "Bx: %.4f", Bx); a << junk << sep;
snprintf(junk, sizeof(junk), "By: %.4f", By); a << junk;

//
// done
Expand Down
2 changes: 1 addition & 1 deletion met/src/libcode/vx_grid/merc_grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class MercatorGrid : public GridRep {

void dump(ostream &, int = 0) const;

ConcatString serialize() const;
ConcatString serialize(const char *sep=" ") const;

GridInfo info() const;

Expand Down
24 changes: 12 additions & 12 deletions met/src/libcode/vx_grid/rot_latlon_grid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -300,31 +300,31 @@ return;
////////////////////////////////////////////////////////////////////////


ConcatString RotatedLatLonGrid::serialize() const
ConcatString RotatedLatLonGrid::serialize(const char *sep) const

{

ConcatString a;
char junk[256];


a << "Projection: Rotated Lat/Lon";
a << "Projection: Rotated Lat/Lon" << sep;

a << " Nx: " << Nx;
a << " Ny: " << Ny;
a << "Nx: " << Nx << sep;
a << "Ny: " << Ny << sep;

snprintf(junk, sizeof(junk), " rot_lat_ll: %.3f", RData.rot_lat_ll); a << junk;
snprintf(junk, sizeof(junk), " rot_lon_ll: %.3f", RData.rot_lon_ll); a << junk;
snprintf(junk, sizeof(junk), "rot_lat_ll: %.3f", RData.rot_lat_ll); a << junk << sep;
snprintf(junk, sizeof(junk), "rot_lon_ll: %.3f", RData.rot_lon_ll); a << junk << sep;

snprintf(junk, sizeof(junk), " delta_rot_lat: %.3f", RData.delta_rot_lat); a << junk;
snprintf(junk, sizeof(junk), " delta_rot_lon: %.3f", RData.delta_rot_lon); a << junk;
snprintf(junk, sizeof(junk), "delta_rot_lat: %.3f", RData.delta_rot_lat); a << junk << sep;
snprintf(junk, sizeof(junk), "delta_rot_lon: %.3f", RData.delta_rot_lon); a << junk << sep;

snprintf(junk, sizeof(junk), " wrapLon: %s", bool_to_string(wrapLon)); a << junk;
snprintf(junk, sizeof(junk), "wrapLon: %s", bool_to_string(wrapLon)); a << junk << sep;

snprintf(junk, sizeof(junk), " true_lat_south_pole: %.3f", RData.true_lat_south_pole); a << junk;
snprintf(junk, sizeof(junk), " true_lon_south_pole: %.3f", RData.true_lon_south_pole); a << junk;
snprintf(junk, sizeof(junk), "true_lat_south_pole: %.3f", RData.true_lat_south_pole); a << junk << sep;
snprintf(junk, sizeof(junk), "true_lon_south_pole: %.3f", RData.true_lon_south_pole); a << junk << sep;

snprintf(junk, sizeof(junk), " aux_rotation: %.3f", RData.aux_rotation); a << junk;
snprintf(junk, sizeof(junk), "aux_rotation: %.3f", RData.aux_rotation); a << junk;

//
// done
Expand Down
2 changes: 1 addition & 1 deletion met/src/libcode/vx_grid/rot_latlon_grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class RotatedLatLonGrid : public LatLonGrid {

void dump(ostream &, int = 0) const;

ConcatString serialize() const;
ConcatString serialize(const char *sep=" ") const;

GridInfo info() const;

Expand Down
18 changes: 9 additions & 9 deletions met/src/libcode/vx_grid/st_grid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -483,26 +483,26 @@ return;
////////////////////////////////////////////////////////////////////////


ConcatString StereographicGrid::serialize() const
ConcatString StereographicGrid::serialize(const char *sep) const

{

ConcatString a;
char junk[256];

a << "Projection: Stereographic";
a << "Projection: Stereographic" << sep;

a << " Nx: " << Nx;
a << " Ny: " << Ny;
a << "Nx: " << Nx << sep;
a << "Ny: " << Ny << sep;

a << " IsNorthHemisphere: " << ( IsNorthHemisphere ? "true" : "false");
a << "IsNorthHemisphere: " << ( IsNorthHemisphere ? "true" : "false") << sep;

snprintf(junk, sizeof(junk), " Lon_orient: %.3f", Lon_orient); a << junk;
snprintf(junk, sizeof(junk), "Lon_orient: %.3f", Lon_orient); a << junk << sep;

snprintf(junk, sizeof(junk), " Bx: %.3f", Bx); a << junk;
snprintf(junk, sizeof(junk), " By: %.3f", By); a << junk;
snprintf(junk, sizeof(junk), "Bx: %.3f", Bx); a << junk << sep;
snprintf(junk, sizeof(junk), "By: %.3f", By); a << junk << sep;

snprintf(junk, sizeof(junk), " Alpha: %.4f", Alpha); a << junk;
snprintf(junk, sizeof(junk), "Alpha: %.4f", Alpha); a << junk;

//
// done
Expand Down
2 changes: 1 addition & 1 deletion met/src/libcode/vx_grid/st_grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class StereographicGrid : public GridRep {

void dump(ostream &, int = 0) const;

ConcatString serialize() const;
ConcatString serialize(const char *sep=" ") const;

GridInfo info() const;

Expand Down

0 comments on commit ee74821

Please sign in to comment.