forked from ossimlabs/ossim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created hdf5 directory directly under src, and improved the HDF5 impl…
…ementation. File parsing is working. Initial commit of modified coarse grid model is untested.
- Loading branch information
oscarkramer
committed
Aug 9, 2016
1 parent
f8910e6
commit 7eb18f8
Showing
23 changed files
with
2,771 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#--- | ||
# File: FindHDF5.cmake | ||
# | ||
# Find the native HDF5 includes and libraries. | ||
# | ||
# This module defines: | ||
# | ||
# HDF5_INCLUDE_DIR, where to find geos.h, etc. | ||
# HDF5_LIBRARIES, libraries to link against to use HDF5. | ||
# HDF5_FOUND, True if found, false if one of the above are not found. | ||
# | ||
# NOTE: | ||
# | ||
# This script is specialized for ossim. HDF5 rpm created to fix conflict with | ||
# system installed hdf5 packages that do NOT have compression(szip) support. | ||
# | ||
# $Id$ | ||
#--- | ||
|
||
# Find include path: | ||
find_path( HDF5_INCLUDE_DIR hdf5.h | ||
PATHS | ||
$ENV{HDF5_DIR}/include | ||
/usr/include | ||
/usr/local/include | ||
/usr/local/ossim/include ) | ||
|
||
# Find HDF5 library: | ||
find_library( HDF5_LIB NAMES hdf5 | ||
PATHS | ||
$ENV{HDF5_DIR}/lib64 | ||
$ENV{HDF5_DIR}/lib | ||
/usr/lib64 | ||
/usr/lib | ||
/usr/local/lib | ||
/usr/local/ossim/lib ) | ||
|
||
# Find HDF5 CPP library: | ||
find_library( HDF5_CPP_LIB NAMES hdf5_cpp | ||
PATHS | ||
$ENV{HDF5_DIR}/lib64 | ||
$ENV{HDF5_DIR}/lib | ||
/usr/lib64 | ||
/usr/lib | ||
/usr/local/lib | ||
/usr/local/ossim/lib ) | ||
|
||
# Set the HDF5_LIBRARIES: | ||
if( HDF5_LIB AND HDF5_CPP_LIB ) | ||
set( HDF5_LIBRARIES ${HDF5_LIB} ${HDF5_CPP_LIB} CACHE STRING INTERNAL ) | ||
endif(HDF5_LIB AND HDF5_CPP_LIB ) | ||
|
||
#--- | ||
# This function sets HDF5_FOUND if variables are valid. | ||
#--- | ||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args( HDF5 DEFAULT_MSG | ||
HDF5_LIBRARIES | ||
HDF5_INCLUDE_DIR ) | ||
|
||
if( HDF5_FOUND ) | ||
if( NOT HDF5_FIND_QUIETLY ) | ||
message( STATUS "Found HDF5..." ) | ||
endif( NOT HDF5_FIND_QUIETLY ) | ||
else( HDF5_FOUND ) | ||
if( NOT HDF5_FIND_QUIETLY ) | ||
message( WARNING "Could not find HDF5" ) | ||
endif( NOT HDF5_FIND_QUIETLY ) | ||
endif( HDF5_FOUND ) | ||
|
||
if( NOT HDF5_FIND_QUIETLY ) | ||
message( STATUS "HDF5_INCLUDE_DIR=${HDF5_INCLUDE_DIR}" ) | ||
message( STATUS "HDF5_LIBRARIES=${HDF5_LIBRARIES}" ) | ||
endif( NOT HDF5_FIND_QUIETLY ) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/***************************************************************************** | ||
* * | ||
* O S S I M * | ||
* Open Source, Geospatial Image Processing Project * | ||
* License: MIT, see LICENSE at the top-level directory * | ||
* * | ||
******************************************************************************/ | ||
|
||
#ifndef ossimHdf5_HEADER | ||
#define ossimHdf5_HEADER 1 | ||
|
||
#include <ossim/base/ossimConstants.h> | ||
#include <ossim/base/ossimReferenced.h> | ||
#include <ossim/base/ossimFilename.h> | ||
#include <ossim/plugin/ossimPluginConstants.h> | ||
#include <ostream> | ||
#include <iosfwd> | ||
#include <string> | ||
#include <vector> | ||
#include <H5Cpp.h> | ||
|
||
/** | ||
* Low-level OSSIM interface to HDF5 libraries. Catches HDF5 exceptions on common operations. | ||
* Note, all methods return by value as that is the way HDF5 returns objects. This seems very | ||
* inefficient, particularly for large datasets. Hopefully they are shallow copies. | ||
*/ | ||
class OSSIMDLLEXPORT ossimHdf5 : public ossimReferenced | ||
{ | ||
public: | ||
ossimHdf5(); | ||
~ossimHdf5(); | ||
|
||
/** Opens specified HDF5 file. */ | ||
bool open(const ossimFilename& hdf5File); | ||
|
||
bool isOpen() const { return (m_h5File != NULL); } | ||
|
||
/** Closes the file and deletes all pointers. | ||
* @return True if close successful. */ | ||
bool close(); | ||
|
||
/** Assigns the root group. | ||
* @return True if result valid */ | ||
bool getRoot(H5::Group& root) const; | ||
|
||
/** Assigns list of groups under specified group. | ||
* @param recursive If true, recursively visits all subgroups | ||
* @return True if result valid */ | ||
bool getChildGroups(const H5::Group& group, | ||
std::vector<H5::Group>& groupList, | ||
bool recursive=false) const; | ||
|
||
/** Assigns list of datasets under current active group. | ||
* @param recursive If true, recursively visits all datasets for this group and subgroups | ||
* @return True if result valid */ | ||
bool getDatasets(const H5::Group& group, | ||
std::vector<H5::DataSet>& datasetList, | ||
bool recursive=false) const; | ||
|
||
/** Assigns list of all multi-dimensional datasets under current active group. | ||
* @param recursive If true, recursively visits all datasets for this group and subgroups | ||
* @return True if result valid */ | ||
bool getNdimDatasets(const H5::Group& group, | ||
std::vector<H5::DataSet>& datasetList, | ||
bool recursive=false) const; | ||
|
||
/** Assigns map of attributes (key, value) for the specified object. | ||
* @param objPath Either relative or absolute path in file to object. | ||
* @return True if result valid */ | ||
bool getAttributes(const H5::H5Object& obj, std::vector<H5::Attribute>& attrList) const; | ||
|
||
/** Finds a dataset by name. The first object with specified name (can be relative path -- a | ||
* naive string comparison is performed) under the specified group is returned. | ||
* @param group If null, implies root group. | ||
* @param recursive If true, recursively visits all subgroups. | ||
* @return result Set to valid dataset object if found (caller assumes ownership), else NULL. */ | ||
H5::DataSet* findDatasetByName(const char* dataset_name, | ||
const H5::Group* group=0, | ||
bool recursive=false); | ||
|
||
private: | ||
ossimFilename m_filename; | ||
H5::H5File* m_h5File; | ||
}; | ||
|
||
#endif /* #ifndef ossimHdf5_HEADER */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
//***************************************************************************** | ||
// FILE: ossimHdf5GridModel.h | ||
// | ||
// License: LGPL | ||
// | ||
// See LICENSE.txt file in the top level directory for more details. | ||
// | ||
// AUTHOR: David Burken | ||
// | ||
// Copied from Mingjie Su's ossimHdfGridModel. | ||
// | ||
// DESCRIPTION: | ||
// Contains declaration of class ossimHdfGridModel. This is an | ||
// implementation of an interpolation sensor model. | ||
// | ||
//***************************************************************************** | ||
// $Id$ | ||
|
||
#ifndef ossimHdf5GridModel_HEADER | ||
#define ossimHdf5GridModel_HEADER 1 | ||
#include <ossim/base/ossimPolygon.h> | ||
#include <ossim/projection/ossimCoarseGridModel.h> | ||
#include <ossim/plugin/ossimPluginConstants.h> | ||
#include <ossim/hdf5/ossimHdf5.h> | ||
#include <string> | ||
|
||
|
||
/****************************************************************************** | ||
* | ||
* CLASS: ossimHdf5GridModel | ||
* | ||
*****************************************************************************/ | ||
class OSSIM_PLUGINS_DLL ossimHdf5GridModel : public ossimCoarseGridModel | ||
{ | ||
public: | ||
|
||
/** @brief default constructor. */ | ||
ossimHdf5GridModel(); | ||
|
||
/** @brief virtual destructor */ | ||
virtual ~ossimHdf5GridModel(); | ||
|
||
/** Initializes from an open HDF5 file */ | ||
bool initialize(ossimRefPtr<ossimHdf5>& hdf5); | ||
|
||
protected: | ||
|
||
bool initCoarseGrid(ossimHdf5* hdf5, const char* datasetName, ossimDblGrid& coarseGrid); | ||
|
||
bool m_crossesDateline; | ||
|
||
//--- | ||
// This polygon differs from base "theBoundGndPolygon" in that if the | ||
// scene crosses the dateline the longitude values are stored between | ||
// 0 and 360 degress as opposed to -180 to 180. | ||
//--- | ||
ossimPolygon m_boundGndPolygon; | ||
|
||
TYPE_DATA | ||
}; | ||
|
||
#endif /* Matches: #ifndef ossimHdf5GridModel_HEADER */ |
Oops, something went wrong.