Skip to content

Commit

Permalink
adjusting order calculation before joining in join_l3
Browse files Browse the repository at this point in the history
datasets are ordered based on their first timestamp and in reverse chronological order
  • Loading branch information
BaptisteVandecrux committed Aug 15, 2024
1 parent 975f19f commit 3897140
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/pypromice/process/join_l3.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def join_l3(config_folder, site, folder_l3, folder_gcnet, outpath, variables, me
list_station_data.append((l3, station_info))

# Sort the list in reverse chronological order so that we start with the latest data
sorted_list_station_data = sorted(list_station_data, key=lambda x: x[0].time.max(), reverse=True)
sorted_list_station_data = sorted(list_station_data, key=lambda x: x[0].time.min(), reverse=True)
sorted_stids = [info["stid"] for _, info in sorted_list_station_data]
logger.info('joining %s' % ' '.join(sorted_stids))

Expand Down Expand Up @@ -360,8 +360,9 @@ def join_l3(config_folder, site, folder_l3, folder_gcnet, outpath, variables, me
# adjusting surface height in the most recent data (l3_merged)
# so that it shows continuity with the older data (l3)
l3_merged['z_surf_combined'] = ('time',
align_surface_heights(l3_merged.z_surf_combined.to_series(),
l3.z_surf_combined.to_series())
align_surface_heights(
l3_merged.z_surf_combined.to_series(),
l3.z_surf_combined.to_series())
)

# merging by time block
Expand Down

0 comments on commit 3897140

Please sign in to comment.