32 lines
1.2 KiB
Python
32 lines
1.2 KiB
Python
from pycen import zh,con_bdcen
|
|
import geopandas as gpd
|
|
|
|
zh = zh()
|
|
|
|
dzh = zh.v_zoneshumides()
|
|
col_date = dzh.columns[dzh.columns.str.contains('date')]
|
|
dzh[col_date] = dzh[col_date].astype(str)
|
|
site = gpd.read_postgis('SELECT * FROM sites.c_sites_zonages WHERE date_fin IS NULL',con_bdcen)
|
|
|
|
col_rmq = dzh.columns[dzh.columns.str.contains('rmq')]
|
|
|
|
c1 = dzh[dzh.code_cb.str.contains('54.1',na=False)]
|
|
c2 = c1[c1.intersects(site.unary_union)]
|
|
c3 = dzh[dzh.code_cb.str.contains('54.1') &
|
|
(
|
|
dzh.rmq_interet_patri.str.contains('tufi',case=False)
|
|
# dzh.rmq_site.str.contains('tufi',case=False) |
|
|
# dzh.rmq_fct_majeur.str.contains('tufi',case=False) |
|
|
# dzh.rmq_bilan_menace.str.contains('tufi',case=False) |
|
|
# dzh.rmq_orient_act.str.contains('tufi',case=False) |
|
|
# dzh.rmq_usage_process.str.contains('tufi',case=False) |
|
|
# dzh.rmq_activ_hum.str.contains('tufi',case=False)
|
|
)
|
|
]
|
|
|
|
|
|
to_file = '/home/colas/Documents/tmp/diagnos_tuffière.gpkg'
|
|
c1.to_file(to_file,layer='541 only',driver='GPKG')
|
|
c2.to_file(to_file,layer='541 ENS',driver='GPKG')
|
|
c3.to_file(to_file,layer='541 TUF',driver='GPKG')
|