without ehancement on h1. It get unfold always.


In [1]:
import os
import sys
import random
import time
from random import seed, randint
import argparse
import platform
from datetime import datetime
import imp
import numpy as np
import fileinput
from itertools import product
import pandas as pd
from scipy.interpolate import griddata
from scipy.interpolate import interp2d
import seaborn as sns
from os import listdir

import matplotlib.pyplot as plt
import seaborn as sns
from scipy.interpolate import griddata
import matplotlib as mpl
sys.path.insert(0,'..')
from notebookFunctions import *
# from .. import notebookFunctions

%matplotlib inline
plt.rcParams['figure.figsize'] = (10,6.180)    #golden ratio
# %matplotlib notebook
%load_ext autoreload
%autoreload 2

In [4]:
data = pd.read_feather("/Users/weilu/Research/server/may_2018/second_start_native/rerun_0_06_May_223049.feather")
dic = {"T0":300, "T1":335, "T2":373, "T3":417, "T4":465, "T5":519, "T6":579, "T7":645, "T8":720, "T9":803, "T10":896, "T11":1000}
a = data
a["Temp"] = a["Temp"].apply(lambda x: dic[x])
rerun0 = data
t = a.query("Temp < 400").groupby(["BiasTo","Temp"])[["DisReal","Run"]].mean().reset_index()
t["Diff"] = t["DisReal"]-t["BiasTo"].apply(pd.to_numeric)
t["BiasTo"] = t["BiasTo"].apply(pd.to_numeric)
fg = sns.FacetGrid(data=t, hue='Temp', size=8, aspect=1.61)
fg.map(plt.scatter, 'BiasTo', 'Diff').add_legend()


Out[4]:
<seaborn.axisgrid.FacetGrid at 0x1a20cee470>

In [25]:
data = pd.read_feather("/Users/weilu/Research/server/may_2018/second_start_native/rerun_1_06_May_223049.feather")
dic = {"T0":300, "T1":335, "T2":373, "T3":417, "T4":465, "T5":519, "T6":579, "T7":645, "T8":720, "T9":803, "T10":896, "T11":1000}
a = data
a["Temp"] = a["Temp"].apply(lambda x: dic[x])
rerun1 = data
t = a.query("Temp < 500").groupby(["BiasTo","Temp"])[["DisReal","Run"]].mean().reset_index()
t["Diff"] = t["DisReal"]-t["BiasTo"].apply(pd.to_numeric)
t["BiasTo"] = t["BiasTo"].apply(pd.to_numeric)
fg = sns.FacetGrid(data=t, hue='Temp', size=8, aspect=1.61)
fg.map(plt.scatter, 'BiasTo', 'Diff').add_legend()


Out[25]:
<seaborn.axisgrid.FacetGrid at 0x1a138c7f98>

In [53]:
data = pd.read_feather("/Users/weilu/Research/server/may_2018/second_start_native/rerun_3_10_May_154056.feather")
dic = {"T0":300, "T1":335, "T2":373, "T3":417, "T4":465, "T5":519, "T6":579, "T7":645, "T8":720, "T9":803, "T10":896, "T11":1000}
a = data
a["Temp"] = a["Temp"].apply(lambda x: dic[x])
rerun3 = data
t = a.query("Temp < 500").groupby(["BiasTo","Temp"])[["DisReal","Run"]].mean().reset_index()
t["Diff"] = t["DisReal"]-t["BiasTo"].apply(pd.to_numeric)
t["BiasTo"] = t["BiasTo"].apply(pd.to_numeric)
fg = sns.FacetGrid(data=t, hue='Temp', size=8, aspect=1.61)
fg.map(plt.scatter, 'BiasTo', 'Diff').add_legend()


Out[53]:
<seaborn.axisgrid.FacetGrid at 0x1a48895588>

In [59]:
rerun1.query("Temp == 417").plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)


Out[59]:
<matplotlib.axes._subplots.AxesSubplot at 0x1a3e124278>

In [58]:
rerun3.query("Temp == 417").plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)


Out[58]:
<matplotlib.axes._subplots.AxesSubplot at 0x1a10ddd0b8>

In [52]:
rerun0.query("Temp == 417").plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)


Out[52]:
<matplotlib.axes._subplots.AxesSubplot at 0x1a0e1579b0>

In [51]:
rerun1.query("Temp == 417").plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)


Out[51]:
<matplotlib.axes._subplots.AxesSubplot at 0x1a11aef5c0>

In [39]:
rerun0.query("Temp == 300").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)


Out[39]:
<matplotlib.axes._subplots.AxesSubplot at 0x1a0f36b278>

In [6]:
rerun1.query("Temp == 300").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)


Out[6]:
<matplotlib.axes._subplots.AxesSubplot at 0x1a0da30a58>

In [35]:
rerun1.query("Temp == 335").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)


Out[35]:
<matplotlib.axes._subplots.AxesSubplot at 0x1a0edcea58>

In [38]:
rerun1.query("Temp == 465").plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)


Out[38]:
<matplotlib.axes._subplots.AxesSubplot at 0x1a1120fd30>

In [34]:
rerun1.query("Temp == 417").plot.hexbin("z_h6", "Qw", cmap="seismic", sharex=False)


Out[34]:
<matplotlib.axes._subplots.AxesSubplot at 0x1a11cdcc50>

In [9]:
rerun1.query("Temp == 335").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)


Out[9]:
<matplotlib.axes._subplots.AxesSubplot at 0x10310e278>

In [13]:
rerun1.query("Temp == 373").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)


Out[13]:
<matplotlib.axes._subplots.AxesSubplot at 0x1a0c75ab00>

In [14]:
rerun1.query("Temp == 417").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)


Out[14]:
<matplotlib.axes._subplots.AxesSubplot at 0x1a133957f0>

In [24]:
rerun1.query("Temp == 465").plot.hexbin("DisReal", "Qw", cmap="seismic", sharex=False)


Out[24]:
<matplotlib.axes._subplots.AxesSubplot at 0x1a11579128>

In [7]:
all_data = pd.concat([rerun0,rerun1])

In [21]:
tmp = temperature_exchange_table(all_data.query("BiasTo == '70.0'"))
tmp


Out[21]:
Temp 300 335 373 417 465 519 579 645 720 803 896 1000
0 3738.0 874.0 388.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN
1 210.0 872.0 1542.0 2376.0 NaN NaN NaN NaN NaN NaN NaN NaN
2 414.0 1320.0 1324.0 1942.0 NaN NaN NaN NaN NaN NaN NaN NaN
3 638.0 1934.0 1144.0 504.0 780.0 NaN NaN NaN NaN NaN NaN NaN
4 NaN NaN 602.0 178.0 656.0 191.0 1459.0 708.0 876.0 30.0 174.0 126.0
5 NaN NaN NaN NaN 1152.0 1077.0 2173.0 598.0 NaN NaN NaN NaN
6 NaN NaN NaN NaN 852.0 1655.0 773.0 1720.0 NaN NaN NaN NaN
7 NaN NaN NaN NaN 1560.0 2077.0 595.0 768.0 NaN NaN NaN NaN
8 NaN NaN NaN NaN NaN NaN NaN NaN 1048.0 2024.0 1290.0 638.0
9 NaN NaN NaN NaN NaN NaN NaN 188.0 1364.0 1025.0 1107.0 1316.0
10 NaN NaN NaN NaN NaN NaN NaN 1018.0 798.0 687.0 1001.0 1496.0
11 NaN NaN NaN NaN NaN NaN NaN NaN 914.0 1234.0 1428.0 1424.0

In [10]:
a = all_data.groupby("BiasTo").apply(summarise_temperature_exchange_table)
a.index = a.index.astype("float")

In [11]:
a.sort_index().plot()


Out[11]:
<matplotlib.axes._subplots.AxesSubplot at 0x1a0d9f8e80>

In [29]:
pre = "/Users/weilu/Research/server/may_2018/01_week"
temp = 320
location = pre + "/second_start_native/_280-350/2d_z_qw/quick/"
location2 = location + f"pmf-{temp}.dat"
path, f = shortest_path(location2, start=(15, 15), end=(25,25),save=False, xlabel="z_H6", ylabel="Qw", zmax=40,res=30)
# plt.savefig("/Users/weilu/papers/figures/2d_z6_qw.png", dpi=300)
# plt.savefig("/Users/weilu/papers/figures/shortest_path.png", dpi=300)
location3 = location + f"evpb-{temp}.dat"
(xi,yi,zi) = plot2d(location3, zmax=120)
plt.plot(xi[path[:,1]], yi[path[:,0]], 'r.-')
# plt.savefig("/Users/weilu/papers/figures/2d_expected_dis.png", dpi=300)
plt.figure()
f_on_path = [zi[tuple(p)] for p in reversed(path)]
plt.plot(f_on_path)
# plt.savefig("/Users/weilu/papers/figures/shortest_path_expected_dis.png", dpi=300)


<matplotlib.colors.LinearSegmentedColormap object at 0x107e93ef0>
Out[29]:
[<matplotlib.lines.Line2D at 0x1a11cc6358>]

In [ ]: