Skip to content

Commit

Permalink
per #2710, fix bug in if/else block where both were doing the same th…
Browse files Browse the repository at this point in the history
…ing. Removed commented code and create variable for constant to satisfy SonarQube
  • Loading branch information
georgemccabe committed Sep 30, 2024
1 parent 31940b1 commit 49bd93e
Showing 1 changed file with 8 additions and 7 deletions.
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

0 comments on commit 49bd93e

Please sign in to comment.