glamod / glamod-nuim

NUIM code in support of GLAMOD
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Add script to fix locations for Rel 7 only #96

Closed rjhd2 closed 2 days ago

rjhd2 commented 5 days ago

Raising PR to enable easy code-diff for this temporary fix

93

DO NOT MERGE

sjnoone commented 5 days ago

ok failed again, pls remove merged_df["height_of_station_above_sea_level"] = merged_df["height_of_station_above_sea_level"].astype(int) on line 591 and add the following at line 618 after location function call : merged_df = merged_df[["station_name","primary_station_id","report_id","observation_id", "longitude","latitude","height_of_station_above_sea_level","report_timestamp", "report_meaning_of_time_stamp","report_duration","observed_variable", "units","observation_value","quality_flag","source_id","data_policy_licence", "report_type","value_significance"]]

    # Convert the column to numeric first
    merged_df['height_of_station_above_sea_level'] = pd.to_numeric(merged_df['height_of_station_above_sea_level'])

    # Then round or convert to integers
    merged_df['height_of_station_above_sea_level'] = merged_df['height_of_station_above_sea_level'].round(0).astype(int)

    merged_df["latitude"] = pd.to_numeric(merged_df["latitude"],errors='coerce')
    merged_df["longitude"] = pd.to_numeric(merged_df["longitude"],errors='coerce')
    merged_df["latitude"]= merged_df["latitude"].round(3)
    merged_df["longitude"]= merged_df["longitude"].round(3)