Skip to content

Commit

Permalink
Merge pull request #60 from CIAT-DAPA/develop
Browse files Browse the repository at this point in the history
in complete data filter the file issue.csv and we won't process it. a…
  • Loading branch information
stevensotelo authored Sep 13, 2023
2 parents 5754948 + 576b1cf commit b4b8aa1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,13 @@ src/unittests.py
/cdsapirc
/.cdsapirc


# TEST FILES

data/local
test/test_files
/test/complete_local_test.py
test/complete_local_test.py

data/chirp.2023.06.01.tif
data/Temperature-Air-2m-Max-24h_C3S-glob-agric_AgERA5_20230601_final-v1.0.tif
Expand Down
14 changes: 7 additions & 7 deletions src/aclimate_resampling/complete_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,8 @@ def extract_values(self,dir_path,var,locations, date_start,date_end,date_format)
def filter_extract_data(self, data_frame):
current_year = self.start_date.year
current_month = self.start_date.month

filter_data_frame = data_frame.loc[
(data_frame["year"] <= current_year) & (data_frame["month"] <= current_month),
:]

filter_data_frame = data_frame.loc[(data_frame["year"] <= current_year) & (data_frame["month"] <= current_month),:]
return filter_data_frame


Expand Down Expand Up @@ -466,8 +464,10 @@ def run(self):

print("Listing stations")
df_ws = self.list_ws()
df_ws_full = df_ws[df_ws['message'].isna()]
df_ws_nan = df_ws[~df_ws['message'].isna()]
df_ws_full = df_ws.loc[df_ws['message'] == "",:]
df_ws_nan = df_ws.loc[df_ws['message'] != "",:]
df_ws_full.to_csv(os.path.join(self.path_country_outputs_forecast,"resampling_complete_data_stations_coord.csv"),index=False)
df_ws_nan.to_csv(os.path.join(self.path_country_outputs_forecast,"resampling_complete_data_stations_without_coord.csv"),index=False)
print("Listed stations")
print("Adding data started!")
pool = mp.Pool(processes=self.cores)
Expand All @@ -477,5 +477,5 @@ def run(self):
process.get()
print("Added data!")

df_ws_nan.to_csv(os.path.join(self.path_country_outputs_forecast,"stations_without_coord.csv"),index=False)

print("Process finished")

0 comments on commit b4b8aa1

Please sign in to comment.