Commit a0e7ffff authored by Le Roux Erwan's avatar Le Roux Erwan
Browse files

add script to compute longitude and latitude for Ribatet.

parent 3148d587
No related merge requests found
Showing with 19 additions and 8 deletions
+19 -8
...@@ -458,6 +458,17 @@ class AbstractStudy(object): ...@@ -458,6 +458,17 @@ class AbstractStudy(object):
data = dict(zip(columns, [longitude[self.flat_mask], latitude[self.flat_mask]])) data = dict(zip(columns, [longitude[self.flat_mask], latitude[self.flat_mask]]))
return pd.DataFrame(data=data, index=self.study_massif_names, columns=columns) return pd.DataFrame(data=data, index=self.study_massif_names, columns=columns)
@property
def _save_excel_with_longitutde_and_latitude(self):
any_ordered_dict = list(self.year_to_dataset_ordered_dict.values())[0]
print(any_ordered_dict.variables.keys())
longitude = np.array(any_ordered_dict.variables['LON'])[self.flat_mask]
latitude = np.array(any_ordered_dict.variables['LAT'])[self.flat_mask]
data = [longitude, latitude]
df = pd.DataFrame(data=data, index=['Longitude', 'Latitude'], columns=self.study_massif_names).transpose()
print(df.head())
df.to_csv('S2M_latitude_and_longitude_for_the_centroid_of_each_massif.csv')
@property @property
def missing_massif_name(self): def missing_massif_name(self):
return set(self.all_massif_names(self.reanalysis_path, self.dbf_filename)) - set( return set(self.all_massif_names(self.reanalysis_path, self.dbf_filename)) - set(
......
...@@ -207,13 +207,13 @@ class SafranTemperature(Safran): ...@@ -207,13 +207,13 @@ class SafranTemperature(Safran):
if __name__ == '__main__': if __name__ == '__main__':
altitude = 600 # altitude = 1800
altitude = 900
year_min = 1959 year_min = 1959
year_max = 1962 year_max = 2019
study = SafranDateFirstSnowfall(altitude=altitude, year_min=year_min, year_max=year_max) study = SafranSnowfall(altitude=altitude, year_min=year_min, year_max=year_max)
print(study.study_massif_names) print(study.study_massif_names)
print(study.massif_name_to_annual_maxima) # print(study.massif_name_to_annual_maxima)
print(study.year_to_daily_time_serie_array[1959].shape) # print(study.year_to_daily_time_serie_array[1959].shape)
print(study.massif_name_to_daily_time_series['Vanoise'].shape) # print(study.massif_name_to_daily_time_series['Vanoise'].shape)
# print(study.year_to_annual_maxima[1959]) study._save_excel_with_longitutde_and_latitude()
# print(study.ordered_years)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment