diff --git a/hat/data.py b/hat/data.py index cfa04ed..b54abc3 100644 --- a/hat/data.py +++ b/hat/data.py @@ -218,25 +218,6 @@ def is_csv(file_path): return file_extension.lower() == ".csv" -def read_csv_and_cache(fpath: str) -> gpd.GeoDataFrame: - """read .csv file and cache to pickle""" - - # cache filepath - cache_fname = os.path.splitext(os.path.basename(fpath))[0] - cache_fpath = get_tmp_filepath(cache_fname, extension=".pickle") - - # use cache if it exists - if os.path.exists(cache_fpath): - gdf = pd.read_pickle(cache_fpath) - - # otherwise load from user defined filepath (and then cache) - else: - gdf = gpd.read_file(fpath) - gdf.to_pickle(cache_fpath) - - return gdf - - """ other data (e.g. non geospatial)""" diff --git a/hat/observations.py b/hat/observations.py index 467eb70..a744f4a 100644 --- a/hat/observations.py +++ b/hat/observations.py @@ -1,7 +1,7 @@ import geopandas as gpd import pandas as pd -from hat.data import is_csv, read_csv_and_cache +from hat.data import is_csv from hat.filters import filter_dataframe @@ -28,7 +28,7 @@ def add_geometry_column(gdf: gpd.GeoDataFrame, coord_names): # Create a geometry column gdf["geometry"] = gpd.points_from_xy(gdf[x_coord_name], gdf[y_coord_name]) - return gdf + return gpd.GeoDataFrame(gdf, geometry="geometry") def read_station_metadata_file( @@ -39,7 +39,7 @@ def read_station_metadata_file( try: if is_csv(fpath): - gdf = read_csv_and_cache(fpath) + gdf = gpd.read_file(fpath) gdf = add_geometry_column(gdf, coord_names) gdf = gdf.set_crs(epsg=epsg) else: