Files

20 lines
555 B
Python

import joblib
import geopandas as gpd
import numpy as np
cache_file = "dataset_cache/training_data_2d.joblib"
data = joblib.load(cache_file)
X = data['X']
print("X shape:", len(X))
gdf = gpd.read_file("train/ST_training_data_updated_1130points_new.shp")
gdf = gdf.to_crs("EPSG:32648")
print("gdf length:", len(gdf))
if len(X) == len(gdf):
y = [(row['HT_code'] - 1) for idx, row in gdf.iterrows()]
joblib.dump({'X': X, 'y': y}, cache_file)
print("Fixed y in cache! Saved.")
else:
print("Lengths do not match, cannot fix automatically.")