Skip to content

Commit

Permalink
update to MDAL 0.5.1: fcritical fix for SWW/Telemac files
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterPetrik committed Feb 20, 2020
1 parent fd32338 commit 572ff9b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
8 changes: 8 additions & 0 deletions external/mdal/frmts/mdal_netcdf.cpp
Expand Up @@ -305,6 +305,14 @@ double NetCDFFile::getFillValue( int varid ) const
return getAttrDouble( varid, "_FillValue" );
}

bool NetCDFFile::hasAttrDouble( int varid, const std::string &attr_name ) const
{
double res;
if ( nc_get_att_double( mNcid, varid, attr_name.c_str(), &res ) )
return false;
return true;
}

double NetCDFFile::getAttrDouble( int varid, const std::string &attr_name ) const
{
double res;
Expand Down
1 change: 1 addition & 0 deletions external/mdal/frmts/mdal_netcdf.hpp
Expand Up @@ -59,6 +59,7 @@ class NetCDFFile

bool hasAttrInt( const std::string &name, const std::string &attr_name ) const;
int getAttrInt( const std::string &name, const std::string &attr_name ) const;
bool hasAttrDouble( int varid, const std::string &attr_name ) const;
double getAttrDouble( int varid, const std::string &attr_name ) const;
/**
* Get string attribute
Expand Down
8 changes: 6 additions & 2 deletions external/mdal/frmts/mdal_sww.cpp
Expand Up @@ -122,8 +122,12 @@ MDAL::Vertices MDAL::DriverSWW::readVertices( const NetCDFFile &ncFile ) const
std::vector<double> pz = readZCoords( ncFile );

// we may need to apply a shift to the X,Y coordinates
double xLLcorner = ncFile.getAttrDouble( NC_GLOBAL, "xllcorner" );
double yLLcorner = ncFile.getAttrDouble( NC_GLOBAL, "yllcorner" );
double xLLcorner = 0.0;
if ( ncFile.hasAttrDouble( NC_GLOBAL, "xllcorner" ) )
xLLcorner = ncFile.getAttrDouble( NC_GLOBAL, "xllcorner" );
double yLLcorner = 0.0;
if ( ncFile.hasAttrDouble( NC_GLOBAL, "yllcorner" ) )
yLLcorner = ncFile.getAttrDouble( NC_GLOBAL, "yllcorner" );

MDAL::Vertices vertices( nPoints );
Vertex *vertexPtr = vertices.data();
Expand Down
2 changes: 1 addition & 1 deletion external/mdal/mdal.cpp
Expand Up @@ -22,7 +22,7 @@ static MDAL_Status sLastStatus;

const char *MDAL_Version()
{
return "0.5.0";
return "0.5.1";
}

MDAL_Status MDAL_LastStatus()
Expand Down

0 comments on commit 572ff9b

Please sign in to comment.