Skip to content

Commit

Permalink
update MDAL to 0.4.95 : add proper reference time for TUFLOWFV format
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterPetrik committed Jan 17, 2020
1 parent 830e080 commit 19deb05
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
9 changes: 9 additions & 0 deletions external/mdal/frmts/mdal_cf.cpp
Expand Up @@ -254,6 +254,9 @@ MDAL::DateTime MDAL::DriverCF::parseTime( std::vector<RelativeTimestamp> &times
std::string timeUnitInformation = mNcFile->getAttrStr( timeArrName, "units" );
std::string calendar = mNcFile->getAttrStr( timeArrName, "calendar" );
MDAL::DateTime referenceTime = parseCFReferenceTime( timeUnitInformation, calendar );
if ( !referenceTime.isValid() )
referenceTime = defaultReferenceTime();

MDAL::RelativeTimestamp::Unit unit = parseCFTimeUnit( timeUnitInformation );

times = std::vector<RelativeTimestamp>( nTimesteps );
Expand Down Expand Up @@ -317,6 +320,12 @@ bool MDAL::DriverCF::canReadMesh( const std::string &uri )
return true;
}

MDAL::DateTime MDAL::DriverCF::defaultReferenceTime() const
{
// return invalid reference time
return DateTime();
}

void MDAL::DriverCF::setProjection( MDAL::Mesh *mesh )
{
std::string coordinate_system_variable = getCoordinateSystemVariableName();
Expand Down
7 changes: 6 additions & 1 deletion external/mdal/frmts/mdal_cf.hpp
Expand Up @@ -136,9 +136,14 @@ namespace MDAL
const MDAL::CFDatasetGroupInfo &dsi,
double fill_val_x, double fill_val_y );

//! Returns the default reference time
virtual DateTime defaultReferenceTime() const;

void setProjection( MDAL::Mesh *m );
cfdataset_info_map parseDatasetGroupInfo();
DateTime parseTime( std::vector<RelativeTimestamp> &times ); //Return the reference time

//! Populates the times array and returns the reference time
DateTime parseTime( std::vector<RelativeTimestamp> &times );
void addDatasetGroups( Mesh *mesh,
const std::vector<RelativeTimestamp> &times,
const cfdataset_info_map &dsinfo_map, const DateTime &referenceTime );
Expand Down
5 changes: 5 additions & 0 deletions external/mdal/frmts/mdal_tuflowfv.cpp
Expand Up @@ -389,6 +389,11 @@ void MDAL::DriverTuflowFV::populateFaces( MDAL::Faces &faces )
}
}

MDAL::DateTime MDAL::DriverTuflowFV::defaultReferenceTime() const
{
return DateTime( 1990, 1, 1 );
}

void MDAL::DriverTuflowFV::calculateMaximumLevelCount()
{
if ( mMaximumLevelsCount < 0 )
Expand Down
1 change: 1 addition & 0 deletions external/mdal/frmts/mdal_tuflowfv.hpp
Expand Up @@ -140,6 +140,7 @@ namespace MDAL
void addBedElevationDatasetOnFaces();
void populateVertices( MDAL::Vertices &vertices );
void populateFaces( MDAL::Faces &faces );
virtual DateTime defaultReferenceTime() const override;

void calculateMaximumLevelCount();
int mMaximumLevelsCount = -1;
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.4.94";
return "0.4.95";
}

MDAL_Status MDAL_LastStatus()
Expand Down

0 comments on commit 19deb05

Please sign in to comment.