Skip to content

Commit

Permalink
Per #1477, porting fixes over to the develop branch.
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnHalleyGotway committed Sep 2, 2020
1 parent 8f8dbfb commit 3ed81ed
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
2 changes: 2 additions & 0 deletions met/docs/Users_Guide/appendixB.rst
Expand Up @@ -20,6 +20,8 @@ The following map projections are currently supported in MET:

* Rotated Lat/Lon Projection

* Gaussian Projection

Grids
_____

Expand Down
48 changes: 48 additions & 0 deletions met/src/libcode/vx_data2d_python/grid_from_python_dict.cc
Expand Up @@ -29,6 +29,7 @@ static const char st_string [] = "Polar Stereographic";
static const char merc_string [] = "Mercator";
static const char latlon_string [] = "LatLon";
static const char rotated_latlon_string [] = "Rotated LatLon";
static const char gaussian_string [] = "Gaussian";


////////////////////////////////////////////////////////////////////////
Expand All @@ -39,6 +40,7 @@ static void get_st_grid (const Python3_Dict & dict, Grid & g);
static void get_merc_grid (const Python3_Dict & dict, Grid & g);
static void get_latlon_grid (const Python3_Dict & dict, Grid & g);
static void get_rotated_latlon_grid (const Python3_Dict & dict, Grid & g);
static void get_gaussian_grid (const Python3_Dict & dict, Grid & g);

static void set_string(const char * & dest, const ConcatString & src);

Expand Down Expand Up @@ -71,6 +73,7 @@ else if ( proj_type == st_string ) get_st_grid (dict, g
else if ( proj_type == merc_string ) get_merc_grid (dict, g);
else if ( proj_type == latlon_string ) get_latlon_grid (dict, g);
else if ( proj_type == rotated_latlon_string ) get_rotated_latlon_grid (dict, g);
else if ( proj_type == gaussian_string ) get_gaussian_grid (dict, g);
else {

mlog << Error << "\ngrid_from_python_dict() -> "
Expand Down Expand Up @@ -406,6 +409,51 @@ return;
}


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

//
// name (string)
//
// lon_zero (double)
//
// nx, ny (int)
//

void get_gaussian_grid (const Python3_Dict & dict, Grid & g)

{

GaussianData data;
ConcatString s;

s = dict.lookup_string("name");

set_string(data.name, s);

data.lon_zero = rescale_lon(dict.lookup_double("lon_zero"));

data.nx = dict.lookup_int("nx");
data.ny = dict.lookup_int("ny");

if ( ! west_longitude_positive ) {

toggle_sign(data.lon_zero);

}

//
// done
//

g.set(data);

if ( data.name ) { delete [] data.name; data.name = (const char *) 0; }

return;

}


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

//
Expand Down

0 comments on commit 3ed81ed

Please sign in to comment.