diff --git a/scripts/build_gas_input_locations.py b/scripts/build_gas_input_locations.py index 6e64d70e..4c30030a 100644 --- a/scripts/build_gas_input_locations.py +++ b/scripts/build_gas_input_locations.py @@ -27,8 +27,7 @@ def build_gas_input_locations(lng_fn, entry_fn, prod_fn, countries): # LNG terminals lng = gpd.read_file(lng_fn) - for index in lng.index: - lng.CapacityInMtpa[index] = float(lng.CapacityInMtpa[index]) + lng.CapacityInMtpa = lng.CapacityInMtpa.astype(float) # Entry points from outside the model scope entry = read_scigrid_gas(entry_fn) diff --git a/scripts/retrieve_gas_input_locations.py b/scripts/retrieve_gas_input_locations.py index 8e3f46ac..cea8d8b5 100644 --- a/scripts/retrieve_gas_input_locations.py +++ b/scripts/retrieve_gas_input_locations.py @@ -28,17 +28,10 @@ if __name__ == "__main__": remove_country = ['Cyprus','Turkey'] remove_terminal = ['Puerto de la Luz LNG Terminal','Gran Canaria LNG Terminal'] - for index in df.index: - if df.Status[index] in remove_status: - df = df.drop([index]) - elif df.Country[index] in remove_country: - df = df.drop([index]) - elif df.TerminalName[index] in remove_terminal: - df = df.drop([index]) - elif df.CapacityInMtpa[index] == "--": - df = df.drop([index]) - else: - continue + df = df.query("Status != 'Cancelled' \ + & Country != @remove_country \ + & TerminalName != @remove_terminal \ + & CapacityInMtpa != '--'") geometry = gpd.points_from_xy(df['Longitude'], df['Latitude']) lng = gpd.GeoDataFrame(df, geometry=geometry, crs="EPSG:4326")