(0-360)转(-180,180)
import pandas as pd
import matplotlib.pyplot as plt
import csv
#(0-360)转(-180,180)
data = pd.read_csv(r"G:\FLL\Ceres\400m\Ceres_cat.csv")
print("columns:",data.columns)data_long = list(data["Long"])
data["new_long"] = 0print("len(data_long):",data_long)
new_long = []
for i in range(len(data_long)):# 经纬度的转换,从0-360转换为-180-180lon = (int(data_long[i]) - 180) % 360 - 180new_long.append(lon)data["new"] = new_long
data.to_csv('G:/FLL/Ceres/400m/new_data2.csv', index=False)
(-180,180)转(0-360)
for i in range(len(data_long)):# 经纬度的转换,if data_long[i]<0:lon = int(data_long[i]) +360 new_long.append(lon)