Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor changes needed to run on aws-vm-dev #275

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/pypromice/process/join_l3.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def join_l3(config_folder, site, folder_l3, folder_gcnet, outpath, variables, me

filepath = os.path.join(folder_l3, stid, stid+'_hour.nc')
isNead = False
if station_info["project"].lower() in ["historical gc-net", "glaciobasis"]:
if station_info["project"].lower() in ["historical gc-net"]:
filepath = os.path.join(folder_gcnet, stid+'.csv')
isNead = True
if not os.path.isfile(filepath):
Expand All @@ -221,6 +221,22 @@ def join_l3(config_folder, site, folder_l3, folder_gcnet, outpath, variables, me
for l3, station_info in sorted_list_station_data:
stid = station_info["stid"]

# This is necessary in xarray < 2024.6.0:
for v in ['lat','lon','alt']:
if v in l3.keys():
tmp = l3[v]
l3 = l3.drop_vars(v)
l3[v] = (tmp[v].data)
# lat lon and alt are set as coordinates to all variables in the l3 data
# this makes it impossible to concatenate with other datasets where
# lat lon alt are not coordinates
# I have tried .reset_coords(drop=True) and .drop_vars([...]) without success
# this was the only way they could be reset as 0-dimensional variables
# which are not coordinates.
# This will be removed in further updates because lat/lon/alt will become
# real time-dependent variables, and will not be specified anymore as coordinates
# in the variable.csv

if l3_merged is None:
# saving attributes of stid
st_attrs = {}
Expand Down
6 changes: 5 additions & 1 deletion src/pypromice/process/write.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ def prepare_and_write(dataset, outpath, vars_df=None, meta_dict=None, time='60mi
d2 = roundValues(d2, vars_df)

# Get variable names to write out
col_names = getColNames(vars_df, d2, remove_nan_fields=True)
if 'site_id' in d2.attrs.keys():
remove_nan_fields = True
else:
remove_nan_fields = False
col_names = getColNames(vars_df, d2, remove_nan_fields=remove_nan_fields)

# Define filename based on resample rate
t = int(pd.Timedelta((d2['time'][1] - d2['time'][0]).values).total_seconds())
Expand Down
Loading