|
| void | freeRawData (struct rawData *data) |
| | Free encapsulated fields of raw data struct.
|
| void | freeAverageData (struct averagedData *data) |
| | Free encapsulated fields of averaged data struct.
|
| int | readRasterDataset (GDALDatasetH raster, struct rawData *dataBuffer) |
| | Read all bands of an GDAL raster dataset into a buffer.
|
| int | averageRawData (const struct rawData *data, struct averagedData *average) |
| | Compute arithmetic mean pixel values across raster band dimension for all bands.
|
| int | averageRawDataWithSizeOffset (const struct rawData *data, struct averagedData *average, const size_t size, const size_t offset) |
| | Compute arithmetic mean pixel values across raster band dimension for a subset of bands.
|
| int | averagePILRawDataWithSizeOffset (const struct rawData *data, struct averagedData *average, const size_t size, const size_t offset) |
| | Compute arithmetic mean pixel values across raster band dimension for a subset of bands.
|
| int | reorderToBandInterleavedByPixel (struct rawData *data) |
| | Transpose data tensor from band sequential to band interleaved by pixel.
|
| OGRGeometryH | mergeFootprintSplitAtDateline (const OGRGeometryH splitFootprint) |
| | Shift and merge a Multipolygon split at the dateline.
|
| meanVector * | calculateAreaWeightedMean (intersectionVector *intersections, const char *rasterWkt, const bool geometriesAreFootprints, const bool useFastGeodesicAreaCalculation) |
| | Compute area weighted mean for features of AOI dataset.
|
| int | writeWeightedMeans (meanVector *values, const char *filePath) |
| | Write area weighted means to file in format usable by FORCE.
|
| double | coordinateFromCell (double origin, double axisOfInterest, double pixelExtent, double complementaryAxis, double rotation) |
| | Compute corner coordinates of raster cell based on geo transformation.
|
| stringList * | parseLogFile (const char *filePath) |
| | Parse logfile for processing.
|
| int | writeUpdatedLogFile (stringList *list, const char *filePath) |
| | Update logfile with new dataset statuses.
|
| int | backFillOptions (option_t *options, GDALDatasetH dataset) |
| | Deduce temporal information from a given dataset.
|
| int | process (option_t *options) |
| | Main procedure to process downloaded ERA-5 datasets.
|
| meanVector * calculateAreaWeightedMean |
( |
intersectionVector * | intersections, |
|
|
const char * | rasterWkt, |
|
|
const bool | geometriesAreFootprints, |
|
|
const bool | useFastGeodesicAreaCalculation ) |
|
nodiscard |
Compute area weighted mean for features of AOI dataset.
This functions iterates over all features in intersections, computes their centroid coordinates and, depending on the version of GDAL used, the geographic or planar area. All intersecting geometries extracted from an STRTree are converted from GEOS geometries to OGR geometries via the WKB import/export interface. The actual intersection is performed without regards to underlying CRS, though the newly created polygon is assigned the spatial reference derived from rasterWkt. The error introduced by assuming planar geometries should be small. Area calculation is performed, depending on the version of GDAL used, differently depending of the CRS type (geographic vs. planar). A weight equal to the fractional cover of the intersecting geometry to the AOI feature is computed and used to calculate an area weighted arithmetic mean.
- Warning
- Only use with wkbPolygon, wkbPolygon25D, wkbMultiPolygon, wkbMultiPolygon25D.
- Note
- With GDAL >= 3.9.0, area calculation of geographic coordinates is correct. Otherwise, planar geometries are assumed.
-
Intersection of geometries is performed assuming planar geometries in all cases.
-
After the function returns, the caller owns the returned object and musst free it.
-
Outputs intersection geometries in debug builds in a GeoPackage in the current working directory.
- Parameters
-
| intersections | Vector containing AOI features and all vectorized raster cells that intersect a given feature. |
| rasterWkt | CRS in WKT representation of raster dataset. |
| geometriesAreFootprints | Boolean indicating if geometries represent footprints and should be merged if cut at dateline. |
| useFastGeodesicAreaCalculation | Use fast implementations for geodesic area calculation. Should only be used when sure that input geometries are already in a CRS that directly allows geodesic caclulations. See fastGeodesicArea() for further details on the imposed limitations. |
- Returns
- mean_t* Reference to vector containing centroids of AOI geometries and associated water column value, NULL on error.
| double coordinateFromCell |
( |
double | origin, |
|
|
double | axisOfInterest, |
|
|
double | pixelExtent, |
|
|
double | complementaryAxis, |
|
|
double | rotation ) |
Compute corner coordinates of raster cell based on geo transformation.
Computes the x/y coordinate given pixel/line index and a geo transformation. The axis of interest refers to the axis whose coordinate should be computed and influences which coordinate is used as the origin. I.e. to compute the x coordinate of the upper-left pixel, the origin must refer to x coordinate, the axis of interest to the columnn index 0, the pixel extent to the width of the pixel, the complementary axis to the row index and the rotation to the row rotation.
- Note
- GDAL uses the upper-left corner of a pixel as its origin, mapping the upper-left pixel to cell (0, 0). To get the center coordinate, one would need to use (0.5, 0.5)
- Parameters
-
| origin | Origin coordinate of upper-left pixel in direction of requested coordinate dimension. |
| axisOfInterest | Index in direction of requested coordinate dimension. |
| pixelExtent | Pixel extent in CRS units in direction of requested coordinate dimension. |
| complementaryAxis | Index in direction of complementary coordinate dimension. |
| rotation | Rotation of complementary axis. |
- Returns
- double Georeferenced coordinate value in direction of requested coordinate dimension.