Skip to content

Commit

Permalink
Feature #2710 - clean up use cases (#2711)
Browse files Browse the repository at this point in the history
* per #2710, remove line that has no effect because next line overwrites value

* per #2710, fix bug in if/else block where both were doing the same thing. Removed commented code and create variable for constant to satisfy SonarQube

* updated config file commands

* updated level of winds to capture change in script

---------

Co-authored-by: j-opatz <[email protected]>
  • Loading branch information
georgemccabe and j-opatz authored Oct 16, 2024
1 parent d7f2103 commit 7043821
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ FCST_VAR1_NAME = WIND
FCST_VAR1_LEVELS = Z0

OBS_VAR1_NAME = wind_speed_alt
OBS_VAR1_LEVELS = Z0
OBS_VAR1_LEVELS = Z10

POINT_STAT_OUTPUT_PREFIX = wind

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
import datetime as dt
import xarray as xr
import pandas as pd
#from met.point import convert_point_data

DATA_GROUP = "/data_01"
DATA_KU_GROUP = "/data_01/ku"

#Users are responsible for passing the following arguements at runtime:
##input file
Expand All @@ -29,12 +31,12 @@
if file_type == 'JASON' or file_type == 'SENTINEL':
#need to check if the variable is in the data_01 group or data_01/ku group
try:
ds = xr.open_dataset(input_file, group="/data_01/ku")
du = xr.open_dataset(input_file, group="/data_01")
ds = xr.open_dataset(input_file, group=DATA_KU_GROUP)
du = xr.open_dataset(input_file, group=DATA_GROUP)
obs_hold = ds[field_name]
except KeyError:
ds = xr.open_dataset(input_file, group="/data_01")
du = xr.open_dataset(input_file, group="/data_01")
ds = xr.open_dataset(input_file, group=DATA_GROUP)
du = xr.open_dataset(input_file, group=DATA_GROUP)
obs_hold = ds[field_name]
obs = obs_hold.values
latitude = np.array(du.latitude.values)
Expand Down Expand Up @@ -76,7 +78,7 @@
#adding additional check; if 'wind' appears in the variable name, it's assumed
#to be a wind speed and gets a height of 10m; otherwise its a height of 0
if field_name.rfind('wind') != -1:
hgt = np.full(len(latitude),0,dtype=int).tolist()
hgt = np.full(len(latitude),10,dtype=int).tolist()
else:
hgt = np.full(len(latitude),0,dtype=int).tolist()
qc = np.full(len(latitude),'NA').tolist()
Expand All @@ -91,7 +93,6 @@
obs = obs.tolist()
l_tuple = list(zip(typ,sid,vld,lat,lon,elv,var,lvl,hgt,qc,obs))
point_data = [list(ele) for ele in l_tuple]
#met_point_data = convert_point_data(point_data)

print("Data Length:\t" + repr(len(point_data)))
print("Data Type:\t" + repr(type(point_data)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@ def get_tn(tn):
alt_gap = alt_d[pblh_ind]-alt_d[pblh_ind-1]

if alt_gap < (gap_max + alt_d[pblh_ind]/20.):
pblh[i] = alt_d[pblh_ind]

# linear interpolate PBLH between this data point and the one below it
pblh[i] = np.interp((pt_min[i]+pt_delta), pt_d[pblh_ind-1:pblh_ind+1], alt_d[pblh_ind-1:pblh_ind+1])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ SERIES_ANALYSIS_OUTPUT_TEMPLATE = series_analysis_{MODEL}_{OBTYPE}_stats_F{lead?

[full_stats]

SERIES_ANALYSIS_CLIMO_MEAN_INPUT_DIR = {SERIES_ANALYSIS_OUTPUT_DIR}
SERIES_ANALYSIS_CLIMO_MEAN_INPUT_TEMPLATE = series_analysis_{MODEL}_{OBTYPE}_stats_F{lead?fmt=%2m}_climo.nc
SERIES_ANALYSIS_CLIMO_MEAN_FILE_NAME = {SERIES_ANALYSIS_OUTPUT_DIR}/series_analysis_{MODEL}_{OBTYPE}_stats_F{lead?fmt=%2m}_climo.nc

[config]

Expand Down Expand Up @@ -122,9 +121,12 @@ SERIES_ANALYSIS_GENERATE_ANIMATIONS = no
SERIES_ANALYSIS_RUN_ONCE_PER_STORM_ID = False


SERIES_ANALYSIS_STAT_LIST = OBAR
SERIES_ANALYSIS_OUTPUT_STATS_CNT = OBAR

[full_stats]
SERIES_ANALYSIS_CLIMO_MEAN_FIELD = {name="series_cnt_OBAR"; level="(*,*)";}

SERIES_ANALYSIS_STAT_LIST =TOTAL, FBAR, OBAR, ME, MAE, RMSE, ANOM_CORR, PR_CORR
SERIES_ANALYSIS_CTS_LIST = BASER, CSI, GSS
SERIES_ANALYSIS_CLIMO_MEAN_DAY_INTERVAL = NA

SERIES_ANALYSIS_OUTPUT_STATS_CNT = TOTAL, FBAR, OBAR, ME, MAE, RMSE, ANOM_CORR, PR_CORR
SERIES_ANALYSIS_OUTPUT_STATS_CTS = BASER, CSI, GSS

0 comments on commit 7043821

Please sign in to comment.