created_at timestamp[s] | mode string | source_dir string | entries list | bands_list_order list |
|---|---|---|---|---|
2026-05-17T17:05:37 | symlink | /home/valerian/SGTPublication/Data | [
"Coordinates1Mil",
"LUCAS_LFU_Lfl_00to23_Bavaria_OC.xlsx",
"LUCAS_LFU_Bavaria_OC_joint_data_modified.xlsx",
"OC_LUCAS_LFU_LfL_Coordinates_v2",
"RasterTensorData"
] | [
"Elevation",
"LAI",
"LST",
"MODIS_NPP",
"SoilEvaporation",
"TotalEvapotranspiration",
"NDVI",
"EVI",
"Precipitation",
"AirTemperature",
"SoilMoisture_layer1",
"SnowDepth",
"ClayContent_0_10cm",
"SandContent_0_10cm",
"pH_H2O_0_10cm",
"BulkDensity_0_10cm",
"CEC_0_10cm",
"Slope",
"A... |
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
As of Tuesday, 8th July 2025, we are currently looking at:
base_path_data = '/home/vfourel/SOCProject/SOCmapping/Data'
We have the 2 excel files:
file_path_LUCAS_LFU_Lfl_00to23_Bavaria_OC = f"{base_path_data}/LUCAS_LFU_Lfl_00to23_Bavaria_OC.xlsx"
# and
/lustre/home/vfourel/SOCProject/SOCmapping/Data/LUCAS_LFU_Bavaria_OC_joint_data_modified.xlsx
The full dataset of eligible points (And more !) can be found at: LUCAS_LFU_Lfl_00to23_Bavaria_OC.xlsx
The
Inside ofthe folder OC_LUCAS_LFU_LfL_Coordinates, we have the points coordinates in gps points of the sample location, and the XY coordinates matching them in the cation inside of the RasterTensorData Version, we also have to take into account which files it is in, this has been precomputed.
Raster Data Extraction Script - ./Data/Preprocessing/SamplePoints/samplePoints.py
This script is part of the SOC mapping project's preprocessing pipeline, specifically handling the extraction of environmental and remote sensing data from raster files at sample point locations.
Location in Project Structure
SOCmapping/
βββ Data/
βββ Preprocessing/
βββ SamplePoints/
βββ samplePoints.py
Purpose
The samplePoints.py script serves as the critical preprocessing step that bridges raw raster data with machine learning-ready datasets. It extracts values from multiple environmental raster datasets at specific coordinate points, creating the feature matrices necessary for soil organic carbon (SOC) prediction models.
Key Features
Multi-source Data Processing: Handles various raster datasets including:
- MODIS Net Primary Productivity (NPP) - yearly
- Elevation data - static
- Land Surface Temperature (LST) - yearly and seasonal
- Leaf Area Index (LAI) - yearly and seasonal
- Soil and Total Evapotranspiration - yearly and seasonal
Parallel Processing: Uses
ProcessPoolExecutorto leverage multiple CPU cores for faster processingSpatial Indexing: Implements KD-trees for efficient spatial queries to find the correct raster tiles
Multiple Coordinate Systems: Handles coordinate transformation between WGS84 and raster coordinate systems
Main Functions
Core Processing Functions
build_kdtree_from_npy_file(): Creates spatial index from coordinate arraysfind_closest_indices(): Finds nearest raster tiles for given coordinatesget_tif_ID(): Determines which raster tile contains a coordinate pointget_tif_ArrayPosition(): Converts geographic coordinates to raster array indices
Data Processing Workflows
process_all_subfolders(): Processes regular coordinate grids (1 million sample points)process_all_subfolders_OC_yearly(): Processes LUCAS soil sampling data by yearprocess_all_subfolders_OC_seasons(): Processes LUCAS soil sampling data by season
Input Data
Coordinate Files:
coordinates_Bavaria_1mil.csv: 1 million sample coordinates across BavariaLUCAS_LFU_Lfl_00to23_Bavaria_OC.xlsx: LUCAS soil sampling locations with temporal data
Raster Data: Organized in hierarchical folders by data type, temporal resolution, and time period
Output
The script generates .npy files containing coordinate positions and corresponding raster array indices, organized in a directory structure matching the input raster data organization:
Data/
βββ Coordinates1Mil/
β βββ YearlyValue/
β β βββ MODIS_NPP/2000/coordinates.npy
β β βββ LST/2001/coordinates.npy
β β βββ ...
β βββ StaticValue/
β βββ Elevation/coordinates.npy
βββ OC_LUCAS_LFU_LfL_Coordinates/
βββ YearlyValue/
βββ SeasonalValue/
Performance Optimizations
- Parallel Processing: Utilizes all available CPU cores
- Memory Efficient: Processes data in chunks to avoid memory overflow
- Progress Tracking: Uses
tqdmfor progress monitoring - Error Handling: Robust error handling for missing or corrupted data
Dependencies
numpy,pandas: Data manipulationrasterio: Raster data processingscipy.spatial.cKDTree: Spatial indexingmultiprocessing,concurrent.futures: Parallel processingtqdm: Progress bars
Usage
The script is designed to run as a standalone processor that:
- Builds spatial indices for all raster datasets
- Processes coordinate files to extract raster positions
- Saves results for downstream machine learning applications
This preprocessing step is essential for creating training datasets where environmental variables serve as features for predicting soil organic carbon content.
Integration with SOC Mapping Pipeline
This script is a crucial component in the data preprocessing workflow, preparing the spatial data needed for the machine learning models that will predict soil organic carbon levels across Bavaria. The extracted features at each sample point will be combined with actual SOC measurements to train and validate the prediction models.
- Downloads last month
- 3,901