Skip to content
Permalink
Browse files
MDAL 0.9.2
  • Loading branch information
vcloarec authored and github-actions committed Jan 14, 2022
1 parent 114c17e commit 47c4d53fdae5de8cbc5418cfb7ad960e14a3a099
Showing with 19 additions and 5 deletions.
  1. +1 −0 external/mdal/frmts/mdal_cf.cpp
  2. +1 −1 external/mdal/frmts/mdal_flo2d.cpp
  3. +16 −3 external/mdal/frmts/mdal_netcdf.cpp
  4. +1 −1 external/mdal/mdal.cpp
@@ -527,6 +527,7 @@ void MDAL::DriverCF::setProjection( MDAL::Mesh *mesh )
}
else
{
wkt = MDAL::replace( wkt, "\n", "" );
mesh->setSourceCrsFromWKT( wkt );
}
}
@@ -996,7 +996,7 @@ MDAL::DriverFlo2D::DriverFlo2D()
: Driver(
"FLO2D",
"Flo2D",
"*.nc;;*.DAT",
"*.nc;;*.DAT;;*.OUT",
Capability::ReadMesh | Capability::ReadDatasets | Capability::WriteDatasetsOnFaces )
{

@@ -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];
@@ -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
{
@@ -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()

0 comments on commit 47c4d53

Please sign in to comment.