Ejemplo n.º 1
0
obstemp = pd.Series(bottom_value(obs['TEMP_VALS'][tf_index]), index=tf_index)
obsdata_roms = pd.DataFrame({
    'depth': obsdepth,
    'temp': obstemp
}).sort_index(by='depth')
Temp_roms = pd.Series(str2ndlist(
    obs['modTempByDepth'][obsdata_roms['temp'].index], bracket=True),
                      index=obsdata_roms['temp'].index)
temp_roms = []
for i in obsdata_roms['temp'].index:
    if Temp_roms[i][-1] > 100:  #get rid of some bad data
        temp_roms.append(obsdata_roms['temp'][i])
    else:
        temp_roms.append(Temp_roms[i][-1])
temp_roms = pd.Series(temp_roms, index=obsdata_roms['temp'].index)
index_roms = index_by_depth(obsdata_roms['depth'], 50)
###################################fvcom#######################################
obs = pd.read_csv('ctdWithdepthofbottom_fvcom.csv')
tf_index = np.where(obs['in FVcom range'].notnull())[0]
obsdepth = pd.Series(obs['MAX_DBAR'][tf_index], index=tf_index)
obstemp = pd.Series(bottom_value(obs['TEMP_VALS'][tf_index]), index=tf_index)
obsdata_fvcom = pd.DataFrame({
    'depth': obsdepth,
    'temp': obstemp
}).sort_index(by='depth')
Temp_fvcom = pd.Series(str2ndlist(
    obs['modtempBYdepth'][obsdata_fvcom['temp'].index], bracket=True),
                       index=obsdata_fvcom['temp'].index)
temp_fvcom = []
for i in obsdata_fvcom['temp'].index:
    if Temp_fvcom[i][-1] > 100:  #get rid of some bad data
Ejemplo n.º 2
0
obsdepth = obs['MAX_DBAR'][tf_index].values
# obstemp = mean_value(obs['TEMP_VALS'][tf_index])
obstemp = bottom_value(obs['TEMP_VALS'][tf_index])
obsdata = pd.DataFrame({'depth':obsdepth, 'temp':obstemp, 'lon':obslon,
                        'lat':obslat, 'time':obstime}).sort_index(by='depth')

starttime = datetime(2009, 8, 24)
endtime = datetime(2013,12 ,13)
tempobj = wtm.water_roms()
url = tempobj.get_url(starttime, endtime)
# temp = tempobj.watertemp(obslon, obslat, obsdepth, obstime, url)
temp = tempobj.watertemp(obsdata['lon'].values, obsdata['lat'].values,
                         obsdata['depth'].values, obsdata['time'].values, url)
temp = pd.Series(temp, index = obsdata['temp'].index)

index = index_by_depth(obsdata['depth'], 50)
# colors = utilities.uniquecolors(10)
tp='all'
if tp == 'all':
    x1, y1 = temp, obsdata['temp']
    ax1, ax2, r_squared = show2pic(x1, y1, FONTSIZE)
    ax1.set_title('R-squared: %.4f' % r_squared, fontsize=FONTSIZE)
    ax2.set_title('R-squared: %.4f' % r_squared, fontsize=FONTSIZE)
elif tp == '<50':
    x1, y1 = temp[index[0]], obsdata['temp'][index[0]]
    ax1, ax2, r_squared = show2pic(x1, y1, FONTSIZE)
    ax1.set_title('%s, R-squared: %.4f' % (tp, r_squared), fontsize=FONTSIZE)
    ax2.set_title('%s, R-squared: %.4f' % (tp, r_squared), fontsize=FONTSIZE)
elif tp == '>50':
    x1, y1 = temp[index[1]], obsdata['temp'][index[1]]
    ax1, ax2, r_squared = show2pic(x1, y1, FONTSIZE)
    'lat': obslat,
    'time': obstime
}).sort_index(by='depth')

starttime = datetime(
    2009, 10, 11, 2, 0
)  # altough our starttime is(2009, 8, 24),but the roms time start on 2009,10,11
endtime = datetime(2013, 12, 13)
tempobj = wtm.water_roms()
url = tempobj.get_url(starttime, endtime)
# temp = tempobj.watertemp(obslon, obslat, obsdepth, obstime, url)
temp = tempobj.watertemp(obsdata['lon'].values, obsdata['lat'].values,
                         obsdata['depth'].values, obsdata['time'], url)
temp = pd.Series(temp, index=obsdata['temp'].index)

index = index_by_depth(obsdata['depth'], 50)
# colors = utilities.uniquecolors(10)
tp = 'all'
if tp == 'all':
    x1, y1 = temp, obsdata['temp']
    ax1, ax2, r_squared = show2pic(x1, y1, FONTSIZE)
    ax1.set_title('Bottom Temperature(R-squared=%.2f)' % r_squared,
                  fontsize=FONTSIZE)
    ax2.set_title('Bottom Temperature(R-squared=%.2f)' % r_squared,
                  fontsize=FONTSIZE)
elif tp == '<50':
    x1, y1 = temp[index[0]], obsdata['temp'][index[0]]
    ax1, ax2, r_squared = show2pic(x1, y1, FONTSIZE)
    ax1.set_title('%s, R-squared: %.4f' % (tp, r_squared), fontsize=FONTSIZE)
    ax2.set_title('%s, R-squared: %.4f' % (tp, r_squared), fontsize=FONTSIZE)
elif tp == '>50':
Ejemplo n.º 4
0
####################################roms#######################################
FONTSIZE = 25
obs = pd.read_csv('ctdWithModTempByDepth.csv')
tf_index = np.where(obs['TF'].notnull())[0]
obsdepth = pd.Series(obs['MAX_DBAR'][tf_index],index=tf_index)
obstemp = pd.Series(bottom_value(obs['TEMP_VALS'][tf_index]),index=tf_index)
obsdata_roms= pd.DataFrame({'depth':obsdepth, 'temp':obstemp}).sort_index(by='depth')
Temp_roms=pd.Series(str2ndlist(obs['modTempByDepth'][obsdata_roms['temp'].index],bracket=True),index=obsdata_roms['temp'].index)
temp_roms=[]
for i in obsdata_roms['temp'].index:
    if Temp_roms[i][-1]>100:   #get rid of some bad data
        temp_roms.append(obsdata_roms['temp'][i])
    else:
        temp_roms.append(Temp_roms[i][-1])
temp_roms=pd.Series(temp_roms,index=obsdata_roms['temp'].index)
index_roms=index_by_depth(obsdata_roms['depth'], 50)
###################################fvcom#######################################
obs = pd.read_csv('ctdWithdepthofbottom_fvcom.csv')
tf_index = np.where(obs['in FVcom range'].notnull())[0]
obsdepth = pd.Series(obs['MAX_DBAR'][tf_index],index=tf_index)
obstemp = pd.Series(bottom_value(obs['TEMP_VALS'][tf_index]),index=tf_index)
obsdata_fvcom = pd.DataFrame({'depth':obsdepth, 'temp':obstemp}).sort_index(by='depth')
Temp_fvcom =pd.Series(str2ndlist(obs['modtempBYdepth'][obsdata_fvcom['temp'].index],bracket=True),index=obsdata_fvcom['temp'].index)
temp_fvcom =[]
for i in obsdata_fvcom['temp'].index:
    if Temp_fvcom[i][-1]>100:   #get rid of some bad data
        temp_fvcom.append(obsdata_fvcom['temp'][i])
    else:
        temp_fvcom.append(Temp_fvcom[i][-1])
temp_fvcom=pd.Series(temp_fvcom,index=obsdata_fvcom['temp'].index)
index_fvcom=index_by_depth(obsdata_fvcom['depth'], 50)