You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm looking for assistance to solve a spatial Kriging problem in Python (or any other solution you might suggest) that involves integrating multiple variables from the columns of the same dataframe and a digital elevation model (DEM). I'm trying to use libraries like scikit-gstat, PyKrige, or similar ones to perform a prediction that works as interpolation based on a defined dimension through a GeoDataFrame or a raster. Weather data is contained in a dataframe, and I want to predict data from one specific column using the others to enhance the prediction. However, I'm facing some challenges in properly integrating all the information. Here's an overview of the challenges I'm encountering.
Here's an example of the data structure I have access to:
index name lat lon h_sea B11001
0 Bologna urbana 11.32879 44.50075 78.0 227.705601
1 Ferrara urbana 11.62114 44.83250 26.0 198.142529
2 Finale Emilia 11.28402 44.83906 12.0 177.565454
3 Forli' urbana 12.04182 44.22039 51.0 223.155397
4 Granarolo Faentino 11.92193 44.36161 15.0 228.395657
5 Martorano 12.26798 44.16614 25.0 218.178186
6 Modena urbana 10.91699 44.65639 73.0 228.691860
7 Parma urbana 10.33049 44.80800 79.0 204.097518
8 Piacenza urbana 9.67965 45.05492 71.0 209.698362
9 Reggio nell'Emilia urbana 10.63370 44.69781 72.0 204.874015
10 Rimini urbana 12.57354 44.05919 16.0 217.934321
11 San Pietro Capofiume 11.62264 44.65378 11.0 223.010690
gdf = gpd.read_file("shapefile_path")
pixel_size = 100 # Dimensione dei pixel
variogram_model = "linear" # Modello di variogramma
area_bounds_gdf = emilia_borders.copy() # Puoi sostituire questo con il tuo altro GeoDataFrame per definire l'estensione
I have a geospatial dataset in GeoDataFrame format that includes a variable of interest (e.g., weather data) and some covariates (other related variables).
I want to perform spatial Kriging to estimate the value of the variable of interest on a raster grid.
I also want to include a digital elevation model (DEM) as an external covariate in Kriging to influence the estimation of the variable of interest.
I've tried to use libraries like scikit-gstat and PyKrige, but I'm experiencing difficulties in integrating covariates and DEM into the Kriging process. Specifically, I'm trying to define the experimental variogram for each variable, but I'm struggling with the correct configuration.
I've already attempted different variations of code, but I keep receiving errors related to the configuration of experimental variograms and the specification of covariates and DEM in the Kriging process.
I'm seeking assistance and advice on the correct setup to perform this spatial Kriging while considering all the involved variables. Any help, suggestions, or example code would be highly appreciated.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm looking for assistance to solve a spatial Kriging problem in Python (or any other solution you might suggest) that involves integrating multiple variables from the columns of the same dataframe and a digital elevation model (DEM). I'm trying to use libraries like scikit-gstat, PyKrige, or similar ones to perform a prediction that works as interpolation based on a defined dimension through a GeoDataFrame or a raster. Weather data is contained in a dataframe, and I want to predict data from one specific column using the others to enhance the prediction. However, I'm facing some challenges in properly integrating all the information. Here's an overview of the challenges I'm encountering.
Here's an example of the data structure I have access to:
index name lat lon h_sea B11001
0 Bologna urbana 11.32879 44.50075 78.0 227.705601
1 Ferrara urbana 11.62114 44.83250 26.0 198.142529
2 Finale Emilia 11.28402 44.83906 12.0 177.565454
3 Forli' urbana 12.04182 44.22039 51.0 223.155397
4 Granarolo Faentino 11.92193 44.36161 15.0 228.395657
5 Martorano 12.26798 44.16614 25.0 218.178186
6 Modena urbana 10.91699 44.65639 73.0 228.691860
7 Parma urbana 10.33049 44.80800 79.0 204.097518
8 Piacenza urbana 9.67965 45.05492 71.0 209.698362
9 Reggio nell'Emilia urbana 10.63370 44.69781 72.0 204.874015
10 Rimini urbana 12.57354 44.05919 16.0 217.934321
11 San Pietro Capofiume 11.62264 44.65378 11.0 223.010690
index B11002 B12101_C B13003
0 1.916224 5.802898 74.152932
1 2.229462 5.061348 79.357680
2 1.811290 3.764022 80.027007
3 1.848094 5.767242 76.988415
4 2.143994 4.222029 85.696343
5 2.224553 5.377731 80.022900
6 2.077067 4.990518 74.163372
7 1.365618 5.175278 76.194010
8 1.345687 4.610513 74.584989
9 1.280448 5.221846 73.971977
10 2.137484 6.226524 74.544494
11 2.285721 3.531839 84.784460
`
def geodataframe_to_kriging_raster(geodataframe, column_name, pixel_size, covariates, dem, variogram_model="linear"):
`
I call the function like this:
`
Esempio di utilizzo
gdf = gpd.read_file("shapefile_path")
pixel_size = 100 # Dimensione dei pixel
variogram_model = "linear" # Modello di variogramma
area_bounds_gdf = emilia_borders.copy() # Puoi sostituire questo con il tuo altro GeoDataFrame per definire l'estensione
raster, transform = geodataframe_to_kriging_raster(gdf, "B11002", pixel_size, dem, variogram_model)
`
Beta Was this translation helpful? Give feedback.
All reactions