def read_verticalperiodfile(c_Model, c_Var, planes=False):
# Routine to read variable from hourly (HH) file
c_Files = ops.find(IncF.c_ModelDir, 'PP_' + c_Model + '-3D*')
if c_Files is None:
return None
c_File = c_Files[0]
logging.info('Reading File: %s', c_File.split(os.sep)[-1])
if planes:
assert IncF.f_Make_Cuts # To make sure this option was filled. This doesn't check format
new_data = ncfile.read_ncfile3D(c_File, c_Var, IncF.f_Make_Cuts)
else:
new_data = ncfile.read_ncfile3D(c_File, c_Var)
if new_data is not None:
f_Data_aux, f_lat, f_lon, f_elev_aux, d_Time_aux, c_Units = new_data
else:
return None
# CHECKING FOR TIME FREQUENCY BETWEEN TIME STEPS
c_TimeFreq, Dt = delta_time_freq(d_Time_aux)
f_Time_aux = map(float, date2num(d_Time_aux))
f_date_i = date2num(dt.datetime.strptime(IncF.c_Start_Date[0], '%d-%m-%Y'))
f_date_f = date2num(dt.datetime.strptime(IncF.c_Last_Date[0], '%d-%m-%Y'))
if planes:
f_Data, d_Time = time_crop(f_date_i, f_date_f, Dt, f_Time_aux, f_Data_aux, multiple=True)
f_elev, _ = time_crop(f_date_i, f_date_f, Dt, f_Time_aux, f_elev_aux, multiple=True)
else:
f_Data, d_Time = time_crop(f_date_i, f_date_f, Dt, f_Time_aux, f_Data_aux)
f_elev, _ = time_crop(f_date_i, f_date_f, Dt, f_Time_aux, f_elev_aux)
return f_Data, f_lat, f_lon, f_elev, d_Time, c_TimeFreq, c_Units
评论列表
文章目录