Commit 3d5c6917 authored by Laura LINDEPERG's avatar Laura LINDEPERG
Browse files

Tries

parent b157a93b
......@@ -40,9 +40,27 @@ bv_for_test_path = 'C:/Users/laura.lindeperg/Documents/DonneesLaura/Watersheds/G
bv_for_test = gpd.read_file(bv_for_test_path)
#----------GEOMORPHO
## Depth to Bedrock
depth_to_bedrock_path = 'C:/Users/laura.lindeperg/Documents/DonneesLaura/Watersheds/GEOMORPHO/DTB/V1020010_DTB_250m.tif'
depth_to_bedrock = rxr.open_rasterio(depth_to_bedrock_path, masked = True).squeeze()
## BDAlti 25m
BDAlti_path = 'C:/Users/laura.lindeperg/Documents/DonneesLaura/Watersheds/TOPO/BDAlti_25m/J4742020_BDAlti_25m.tif'
BDAlti_test = rxr.open_rasterio(BDAlti_path).squeeze()
BDAlti_path = 'C:/Users/laura.lindeperg/Documents/DonneesLaura/Watersheds/GEOMORPHO/BDAlti_25m/J4742020_BDAlti_25m.tif'
BDAlti_test = rxr.open_rasterio(BDAlti_path, masked=True).squeeze()
## Slope
slope_path = 'C:/Users/laura.lindeperg/Documents/DonneesLaura/Watersheds/GEOMORPHO/Slope/J4742020_slope_25m.tif'
slope = rxr.open_rasterio(slope_path).squeeze()
## BDTopage
......@@ -87,6 +105,12 @@ ZHp_test = rxr.open_rasterio(ZHp_test_path).squeeze() # masked=True pour masque
#------------GEOL
## GLHYMPS
GLHYMPS_path = 'C:/Users/laura.lindeperg/Documents/DonneesLaura/Watersheds/GEOL/GLHYMPS/V1020010_GLHYMPS.shp' # V1020010
glhymps = gpd.read_file(GLHYMPS_path)
## Hydraulic conductivity of topsoil
# Raster file
......@@ -119,6 +143,61 @@ FC_test = rxr.open_rasterio(FC_test_path).squeeze()
# *************************** Extract indicators ************************************
def extract_GUMinfo_GLHYMPS(glhymps_file):
gum_k = glhymps_file['GUM_K']
class_proportion = gum_k.value_counts(normalize = True)
from_GUM = class_proportion.loc[2]
try:
no_data = class_proportion.loc[0]
except:
no_data = 0
def extract_info_GLHYMPS(glhymps_file):
def extract_K_GLHYMPS(glhymps_file):
where_gum_k_0 = glhymps_file['GUM_K'].eq(0)
log_k = glhymps_file['logK_Ferr_']
log_k = log_k.where(~where_gum_k_0, np.nan)
k = pow(10,log_k/100)
k = np.nanmean(k)
K = k*999.97*9.8/(1e-3)
K = K*1e2*24*3600
def extract_mean_DTB(self, DTB_map):
import numpy.ma as ma
mean_DTB = np.mean(ma.masked_values(DTB_map, DTB_map._FillValue)) # if masked = False when reading raster
return mean_DTB
def extract_mean_DTB(self, DTB_map):
mean_DTB = np.nanmean(DTB_map) # if masked = True when reading raster
return mean_DTB
def extract_mean_elevation(self, topographic_property_map):
import numpy.ma as ma
mean_elevation = np.mean(ma.masked_values(topographic_property_map, topographic_property_map._FillValue))
return mean_elevation
def extract_median_slope(topographic_property_map):
import numpy.ma as ma
slope = ma.masked_values(topographic_property_map, topographic_property_map._FillValue)
slope = slope.filled(np.nan)
median_slope = np.nanmedian(slope)
return median_slope
topographic_property_map = BDAlti_test
def extract_mean_elevation(topographic_property_map):
......@@ -328,11 +407,11 @@ plt.show()
BDAlti_test.plot.hist()
depth_to_bedrock.plot.hist()
plt.show()
f, ax = plt.subplots(figsize=(10, 4))
BDAlti_test.plot(ax=ax,
depth_to_bedrock.plot(ax=ax,
cmap='Greys')
ax.set(title="Final Clipped ZHp")
ax.set_axis_off()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment