Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
MDAL 0.9.2 (#46829)
Co-authored-by: vcloarec <vcloarec@gmail.com>
  • Loading branch information
qgis-bot and vcloarec committed Jan 14, 2022
1 parent 114c17e commit b9b7fb9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
1 change: 1 addition & 0 deletions external/mdal/frmts/mdal_cf.cpp
Expand Up @@ -527,6 +527,7 @@ void MDAL::DriverCF::setProjection( MDAL::Mesh *mesh )
}
else
{
wkt = MDAL::replace( wkt, "\n", "" );
mesh->setSourceCrsFromWKT( wkt );
}
}
Expand Down
2 changes: 1 addition & 1 deletion external/mdal/frmts/mdal_flo2d.cpp
Expand Up @@ -996,7 +996,7 @@ MDAL::DriverFlo2D::DriverFlo2D()
: Driver(
"FLO2D",
"Flo2D",
"*.nc;;*.DAT",
"*.nc;;*.DAT;;*.OUT",
Capability::ReadMesh | Capability::ReadDatasets | Capability::WriteDatasetsOnFaces )
{

Expand Down
19 changes: 16 additions & 3 deletions external/mdal/frmts/mdal_netcdf.cpp
Expand Up @@ -180,12 +180,14 @@ std::vector<double> NetCDFFile::readDoubleArr( int arr_id,
std::vector<double> arr_val( count_dim );

nc_type typep;
if ( nc_inq_vartype( mNcid, arr_id, &typep ) != NC_NOERR ) throw MDAL::Error( MDAL_Status::Err_UnknownFormat, "Could not read double array" );
if ( nc_inq_vartype( mNcid, arr_id, &typep ) != NC_NOERR )
throw MDAL::Error( MDAL_Status::Err_UnknownFormat, "Could not read double array" );

if ( typep == NC_FLOAT )
{
std::vector<float> arr_val_f( count_dim );
if ( nc_get_vars_float( mNcid, arr_id, startp.data(), countp.data(), stridep.data(), arr_val_f.data() ) != NC_NOERR ) throw MDAL::Error( MDAL_Status::Err_UnknownFormat, "Could not read double array" );
if ( nc_get_vars_float( mNcid, arr_id, startp.data(), countp.data(), stridep.data(), arr_val_f.data() ) != NC_NOERR )
throw MDAL::Error( MDAL_Status::Err_UnknownFormat, "Could not read double array" );
for ( size_t i = 0; i < count_dim; ++i )
{
const float val = arr_val_f[i];
Expand All @@ -195,9 +197,20 @@ std::vector<double> NetCDFFile::readDoubleArr( int arr_id,
arr_val[i] = static_cast<double>( val );
}
}
else if ( typep == NC_INT )
{
std::vector<int> arr_val_int( count_dim );
if ( nc_get_vars_int( mNcid, arr_id, startp.data(), countp.data(), stridep.data(), arr_val_int.data() ) != NC_NOERR )
throw MDAL::Error( MDAL_Status::Err_UnknownFormat, "Could not read double array" );
for ( size_t i = 0; i < count_dim; ++i )
{
arr_val[i] = static_cast<double>( arr_val_int[i] );
}
}
else if ( typep == NC_DOUBLE )
{
if ( nc_get_vars_double( mNcid, arr_id, startp.data(), countp.data(), stridep.data(), arr_val.data() ) != NC_NOERR ) throw MDAL::Error( MDAL_Status::Err_UnknownFormat, "Could not read double array" );
if ( nc_get_vars_double( mNcid, arr_id, startp.data(), countp.data(), stridep.data(), arr_val.data() ) != NC_NOERR )
throw MDAL::Error( MDAL_Status::Err_UnknownFormat, "Could not read double array" );
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion external/mdal/mdal.cpp
Expand Up @@ -21,7 +21,7 @@ static const char *EMPTY_STR = "";

const char *MDAL_Version()
{
return "0.9.1";
return "0.9.2";
}

MDAL_Status MDAL_LastStatus()
Expand Down

0 comments on commit b9b7fb9

Please sign in to comment.