Skip to content

Commit

Permalink
Resolve pandas warnings (#322)
Browse files Browse the repository at this point in the history
* pandas warning fix

* define hofx layout explicitly

---------

Co-authored-by: dooruk <[email protected]>
  • Loading branch information
asewnath and Dooruk authored Apr 17, 2024
1 parent 0dd142d commit cebcb49
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/swell/deployment/create_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ def prepare_cylc_suite_jinja2(logger, swell_suite_path, exp_suite_path, experime
account = 'g0613'
qos = 'allnccs'
partition = None
constraint = 'cas'
constraint = 'cas|sky'

# Extract from slurm global file
if 'qos' in slurm_global:
Expand Down
2 changes: 2 additions & 0 deletions src/swell/test/suite_tests/hofx-tier1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ save_geovals: true
models:
geos_atmosphere:
horizontal_resolution: '91'
npx_proc: 2
npy_proc: 2
observations:
- aircraft
- airs_aqua
Expand Down
7 changes: 5 additions & 2 deletions src/swell/utilities/gsi_record_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ def __init__(self):
def get_channel_list(self, start):
channel_list = []
rows = self.instr_df.loc[self.instr_df["start"] == start]
[channel_list.extend(i) for i in rows["channels"].values]
for row_ch_list in rows["channels"].values:
ch_list = eval(row_ch_list)
channel_list.extend(ch_list)

channel_list = list(set(channel_list))
channel_list.sort(key=int)
return channel_list
Expand Down Expand Up @@ -62,7 +65,7 @@ def run(self, instr_df):
start_df = self.instr_df.loc[self.instr_df['start'] == main_start]
if (len(start_df) == 1):
# Only one row to process
channel_list = start_df['channels'].values[0]
channel_list = eval(start_df['channels'].values[0])
comment = start_df['comments'].values[0]
self.update_return_df(main_start, main_end, channel_list, comment)
done.append(main_start)
Expand Down
17 changes: 9 additions & 8 deletions src/swell/utilities/observing_system_records.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ def read_sat_db(path_to_sat_db, column_names):
'end': [''],
'instr': [''],
'channel_num': [0],
'channels': [[]],
'channels': [''],
'comments': ['']})

df = pd.concat([df, new_row], ignore_index=True)
df['sat'][idx] = line_parts[0]
df['start'][idx] = line_parts[1]+line_parts[2]
df['end'][idx] = line_parts[3]+line_parts[4]
df['instr'][idx] = line_parts[5]
df['channel_num'][idx] = line_parts[6]
df.loc[idx, 'sat'] = line_parts[0]
df.loc[idx, 'start'] = line_parts[1]+line_parts[2]
df.loc[idx, 'end'] = line_parts[3]+line_parts[4]
df.loc[idx, 'instr'] = line_parts[5]
df.loc[idx, 'channel_num'] = line_parts[6]

comment_present = next((i for i, x in enumerate(line_parts) if x == '#'), None)

Expand All @@ -61,11 +61,12 @@ def read_sat_db(path_to_sat_db, column_names):
comment_str = ' '.join(comment)
# Accounting for no comment
if (len(comment_str) != 1):
df['comments'][idx] = comment_str
df.loc[idx, 'comments'] = comment_str
else:
channel_list = line_parts[7:]

df['channels'][idx] = channel_list
# convert channel list to string
df.loc[idx, 'channels'] = str(channel_list)
idx += 1
return df

Expand Down

0 comments on commit cebcb49

Please sign in to comment.