FireSTARR
Loading...
Searching...
No Matches
fs::data::GridData< T, V, D > Class Template Referenceabstract

A Grid that defines the data structure used for storing values. More...

#include <Grid.h>

Inheritance diagram for fs::data::GridData< T, V, D >:
Collaboration diagram for fs::data::GridData< T, V, D >:

Public Member Functions

 GridData (const MathSize cell_size, const Idx rows, const Idx columns, const V nodata_input, const T nodata_value, const MathSize xllcorner, const MathSize yllcorner, const MathSize xurcorner, const MathSize yurcorner, string &&proj4, D &&data)
 Constructor.
 
 GridData (const GridData &rhs)
 Copy constructor.
 
 GridData (GridData &&rhs) noexcept
 Move constructor.
 
GridDataoperator= (const GridData &rhs) noexcept
 Copy assignment.
 
GridDataoperator= (GridData &&rhs) noexcept
 Move assignment.
 
size_t size () const
 Size of data structure storing values.
 
template<class R >
string saveToFileWithoutRetry (const string &dir, const string &base_name, std::function< R(T value)> convert, const R no_data) const
 Save GridMap contents to file based on settings.
 
template<class R >
string saveToFileWithRetry (const string &dir, const string &base_name, std::function< R(T value)> convert, const R no_data) const
 Save GridMap contents to file based on settings.
 
template<class R >
string saveToFile (const string &dir, const string &base_name, std::function< R(T value)> convert, const R no_data) const
 Save GridMap contents to file based on settings.
 
template<class R >
string saveToFile (const string &dir, const string &base_name, std::function< R(T value)> convert) const
 Save GridMap contents to file based on settings.
 
template<class R = V>
string saveToFile (const string &dir, const string &base_name) const
 Save GridMap contents to file based on settings.
 
- Public Member Functions inherited from fs::data::Grid< T, V >
constexpr Idx rows () const noexcept
 Number of rows in the GridBase.
 
constexpr Idx columns () const noexcept
 Number of columns in the GridBase.
 
constexpr V nodataInput () const noexcept
 Value used for grid locations that have no data.
 
constexpr T nodataValue () const noexcept
 Value representing no data.
 
virtual T at (const Location &location) const=0
 Value for grid at given Location.
 
at (const Position< P > &position) const
 
virtual void set (const Location &location, T value)=0
 Set value for grid at given Location.
 
void set (const Position< P > &position, const T value)
 
- Public Member Functions inherited from fs::data::GridBase
 GridBase (GridBase &&rhs) noexcept=default
 Move constructor.
 
 GridBase (const GridBase &rhs)=default
 Copy constructor.
 
GridBaseoperator= (const GridBase &rhs)=default
 Copy assignment.
 
GridBaseoperator= (GridBase &&rhs) noexcept=default
 Move assignment.
 
constexpr MathSize cellSize () const noexcept
 Cell size used for GridBase.
 
constexpr FullIdx calculateRows () const noexcept
 Number of rows in the GridBase.
 
constexpr FullIdx calculateColumns () const noexcept
 Number of columns in the GridBase.
 
constexpr MathSize xllcorner () const noexcept
 Lower left corner X coordinate in meters.
 
constexpr MathSize yllcorner () const noexcept
 Lower left corner Y coordinate in meters.
 
constexpr MathSize xurcorner () const noexcept
 Upper right corner X coordinate in meters.
 
constexpr MathSize yurcorner () const noexcept
 Upper right corner Y coordinate in meters.
 
constexpr const string & proj4 () const noexcept
 Proj4 string defining coordinate system for this grid. Must be a UTM projection.
 
 GridBase (MathSize cell_size, MathSize xllcorner, MathSize yllcorner, MathSize xurcorner, MathSize yurcorner, string &&proj4) noexcept
 Constructor.
 
 GridBase () noexcept
 Default constructor.
 
void createPrj (const string &dir, const string &base_name) const
 Create .prj file in directory with base name for file.
 
unique_ptr< Coordinates > findCoordinates (const topo::Point &point, bool flipped) const
 Find Coordinates for Point.
 
unique_ptr< FullCoordinates > findFullCoordinates (const topo::Point &point, bool flipped) const
 Find FullCoordinates for Point.
 

Public Attributes

data
 Structure that holds data represented by this GridData.
 

Protected Member Functions

virtual tuple< Idx, Idx, Idx, Idx > dataBounds () const =0
 
template<class R >
string saveToAsciiFile (const string &dir, const string &base_name, std::function< R(T value)> convert, const R no_data) const
 Save GridMap contents to .asc file.
 
template<class R >
string saveToTiffFile (const string &dir, const string &base_name, std::function< R(T value)> convert, const R no_data) const
 Save GridMap contents to .tif file.
 
- Protected Member Functions inherited from fs::data::Grid< T, V >
 Grid (const MathSize cell_size, const Idx rows, const Idx columns, const V nodata_input, const T nodata_value, const MathSize xllcorner, const MathSize yllcorner, const MathSize xurcorner, const MathSize yurcorner, string &&proj4) noexcept
 Constructor.
 
 Grid (const GridBase &grid_info, V no_data) noexcept
 Construct based on GridBase and no data value.
 

Detailed Description

template<class T, class V, class D>
class fs::data::GridData< T, V, D >

A Grid that defines the data structure used for storing values.

Template Parameters
TType of data after conversion from initialization type.
VType of data used as an input when initializing.
DThe data type that stores the values.

Constructor & Destructor Documentation

◆ GridData() [1/3]

template<class T , class V , class D >
fs::data::GridData< T, V, D >::GridData ( const MathSize cell_size,
const Idx rows,
const Idx columns,
const V nodata_input,
const T nodata_value,
const MathSize xllcorner,
const MathSize yllcorner,
const MathSize xurcorner,
const MathSize yurcorner,
string && proj4,
D && data )
inline

Constructor.

Parameters
cell_sizeCell width and height (m)
rowsNumber of rows
columnsNumber of columns
nodata_inputValue that represents no data for type V
nodata_valueValue that represents no data for type T
xllcornerLower left corner X coordinate (m)
yllcornerLower left corner Y coordinate (m)
xurcornerUpper right corner X coordinate (m)
yurcornerUpper right corner Y coordinate (m)
proj4Proj4 projection definition
dataData to populate GridData with

◆ GridData() [2/3]

template<class T , class V , class D >
fs::data::GridData< T, V, D >::GridData ( const GridData< T, V, D > & rhs)
inline

Copy constructor.

Parameters
rhsGridData to copy from

◆ GridData() [3/3]

template<class T , class V , class D >
fs::data::GridData< T, V, D >::GridData ( GridData< T, V, D > && rhs)
inlinenoexcept

Move constructor.

Parameters
rhsGridData to move from

Member Function Documentation

◆ operator=() [1/2]

template<class T , class V , class D >
GridData & fs::data::GridData< T, V, D >::operator= ( const GridData< T, V, D > & rhs)
inlinenoexcept

Copy assignment.

Parameters
rhsGridData to copy from
Returns
This, after assignment

◆ operator=() [2/2]

template<class T , class V , class D >
GridData & fs::data::GridData< T, V, D >::operator= ( GridData< T, V, D > && rhs)
inlinenoexcept

Move assignment.

Parameters
rhsGridData to copy from
Returns
This, after assignment

◆ saveToAsciiFile()

template<class T , class V , class D >
template<class R >
string fs::data::GridData< T, V, D >::saveToAsciiFile ( const string & dir,
const string & base_name,
std::function< R(T value)> convert,
const R no_data ) const
inlineprotected

Save GridMap contents to .asc file.

Template Parameters
RType to be written to .asc file
Parameters
dirDirectory to save into
base_nameFile base name to use
convertFunction to convert from V to R
no_dataValue to use as nodata in output

◆ saveToFile() [1/3]

template<class T , class V , class D >
template<class R = V>
string fs::data::GridData< T, V, D >::saveToFile ( const string & dir,
const string & base_name ) const
inline

Save GridMap contents to file based on settings.

Parameters
dirDirectory to save into
base_nameFile base name to use

◆ saveToFile() [2/3]

template<class T , class V , class D >
template<class R >
string fs::data::GridData< T, V, D >::saveToFile ( const string & dir,
const string & base_name,
std::function< R(T value)> convert ) const
inline

Save GridMap contents to file based on settings.

Template Parameters
RType to be written to file
Parameters
dirDirectory to save into
base_nameFile base name to use
convertFunction to convert from V to R

◆ saveToFile() [3/3]

template<class T , class V , class D >
template<class R >
string fs::data::GridData< T, V, D >::saveToFile ( const string & dir,
const string & base_name,
std::function< R(T value)> convert,
const R no_data ) const
inline

Save GridMap contents to file based on settings.

Template Parameters
RType to be written to file
Parameters
dirDirectory to save into
base_nameFile base name to use
convertFunction to convert from V to R
no_dataValue to use as nodata in output
Here is the caller graph for this function:

◆ saveToFileWithoutRetry()

template<class T , class V , class D >
template<class R >
string fs::data::GridData< T, V, D >::saveToFileWithoutRetry ( const string & dir,
const string & base_name,
std::function< R(T value)> convert,
const R no_data ) const
inline

Save GridMap contents to file based on settings.

Template Parameters
RType to be written to file
Parameters
dirDirectory to save into
base_nameFile base name to use
convertFunction to convert from V to R
no_dataValue to use as nodata in output
Here is the call graph for this function:

◆ saveToFileWithRetry()

template<class T , class V , class D >
template<class R >
string fs::data::GridData< T, V, D >::saveToFileWithRetry ( const string & dir,
const string & base_name,
std::function< R(T value)> convert,
const R no_data ) const
inline

Save GridMap contents to file based on settings.

Template Parameters
RType to be written to file
Parameters
dirDirectory to save into
base_nameFile base name to use
convertFunction to convert from V to R
no_dataValue to use as nodata in output

◆ saveToTiffFile()

template<class T , class V , class D >
template<class R >
string fs::data::GridData< T, V, D >::saveToTiffFile ( const string & dir,
const string & base_name,
std::function< R(T value)> convert,
const R no_data ) const
inlineprotected

Save GridMap contents to .tif file.

Template Parameters
RType to be written to .tif file
Parameters
dirDirectory to save into
base_nameFile base name to use
convertFunction to convert from V to R

◆ size()

template<class T , class V , class D >
size_t fs::data::GridData< T, V, D >::size ( ) const
inlinenodiscard

Size of data structure storing values.

Returns
Size of data structure storing values

The documentation for this class was generated from the following file: