This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import xml.etree.ElementTree as ET | |
import matplotlib.pyplot as plt | |
import geopandas as gpd | |
from shapely.geometry import Polygon | |
from shapely.ops import unary_union | |
def poslist_to_polygon(poslist_str): | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import xml.etree.ElementTree as ET | |
import matplotlib.pyplot as plt | |
import geopandas as gpd | |
from shapely.geometry import Polygon | |
from shapely.ops import unary_union | |
import matplotlib.patches as mpatches | |
def poslist_to_polygon(poslist_str): | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import xml.etree.ElementTree as ET | |
import matplotlib.pyplot as plt | |
import geopandas as gpd | |
from shapely.geometry import Polygon | |
from shapely.ops import unary_union | |
import matplotlib.patches as mpatches | |
import time | |
def poslist_to_polygon(poslist_str): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import necessary libraries | |
import pandas as pd | |
from calendar import monthrange | |
# Load the Excel file containing disaster data into a pandas DataFrame | |
df = pd.read_excel('D:/ProjDB/GAUL/public_emdat_GDIS_GAUL_FIDs.xlsx') | |
# Define a function to format the start and end dates into ISO 8601 format | |
def format_dates(row): | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import xml.etree.ElementTree as ET | |
############################################################################### | |
# 1) Define file paths | |
############################################################################### | |
excel_file_path = 'D:/ProjDB/GAUL/public_emdat_GDIS_GAUL_aligned.xlsx' | |
# GAUL Level-2 XML (for FID_2) | |
xml_file_path_2 = 'D:/ProjDB/GAUL/g2015_2014_2_GeomExtract.xml' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import json | |
import xml.etree.ElementTree as ET | |
from xml.dom import minidom | |
############################################################################### | |
# 1) Define File Paths | |
############################################################################### | |
file_path = 'D:/ProjDB/EMDAT/public_emdat_GDIS_aligned.xlsx' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#--------------------- Align EM-DAT database format to GDIS database ---------------------- | |
# | |
# This script processes EM-DAT disaster event data to align its format with the GDIS database. | |
# Key tasks include: | |
# - Splitting multi-location events into separate observations for each named location. | |
# - Normalizing and cleaning location names for consistency. | |
# - Expanding province-prefecture mappings when applicable. | |
# - Matching locations to administrative units using fuzzy matching. | |
# - Assigning unique serial codes to processed events. | |
# - Saving the cleaned and structured data into a new Excel file. |