In [1]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
pd.__version__ # need 0.14.0 for multiindex slicing


Out[1]:
'0.14.1'

In [2]:
%pylab inline


Populating the interactive namespace from numpy and matplotlib

Read statistics files


In [3]:
o_raw = pd.read_table("overall_statistics_ensemble.txt")
v_raw = pd.read_table("variable_statistics_ensemble.txt")

In [4]:
o = o_raw.set_index(["RUN","STATISTIC"]).loc[:,"VALUE"].unstack()
v = v_raw.set_index(["RUN","STATISTIC","VARIABLE"]).loc[:,"VALUE"].unstack().unstack()

Read variable information


In [5]:
vi_raw = pd.read_table("variable_information.txt")
vi = vi_raw.set_index(["VARIABLE","INFO"]).unstack().loc[:,"VALUE"]
vi["levels"] = vi["levels"].astype("int")
vi.columns.name = ""

Performance per variable


In [6]:
statistics_of_interest = ["rms_error","srr", "max_error","precisionbits","correlation"]

In [15]:
v.mean(axis=0).unstack("STATISTIC").loc[:,statistics_of_interest].sort("rms_error").join(vi)


Out[15]:
rms_error srr max_error precisionbits correlation levels name
VARIABLE
Z3 0.000105 11.318098 0.002930 7.452184 1.000000 30 Geopotential Height (above sea level)
SL 0.000207 10.011432 0.004308 6.923686 1.000000 30 Liquid water static energy
SLV 0.000208 10.002514 0.004313 6.921773 1.000000 30 Liq wat virtual static energy
UFLX 0.000395 3.494550 0.052348 3.290988 0.996049 31 Zonal momentum flux
ABSORB 0.000419 4.785370 0.054303 3.238712 0.999335 30 Aerosol absorption
EXTINCT 0.000464 5.279493 0.046709 3.444937 0.999666 30 Aerosol extinction
QFLX 0.000533 8.659153 0.009412 5.751369 0.999997 1 Surface water flux
LHFLX 0.000534 8.654262 0.009371 5.757869 0.999997 1 Surface latent heat flux
dst_a3 0.000537 4.538821 0.046771 3.449480 0.999063 30 dst_a3 concentration
T 0.000540 9.055367 0.010042 5.692609 0.999998 30 Temperature
VFLX 0.000564 3.145780 0.080370 2.659652 0.993586 31 Meridional momentm flux
num_a3 0.000569 4.969747 0.054707 3.234423 0.999488 30 num_a3 concentration
dst_a1 0.000588 4.835878 0.055197 3.221993 0.999383 30 dst_a1 concentration
FSNT 0.000605 8.651299 0.010251 5.663321 0.999997 1 Net solar flux at top of model
FSNTOA 0.000608 8.644216 0.010140 5.677966 0.999997 1 Net solar flux at top of atmosphere
TS 0.000634 8.040495 0.007365 6.101627 0.999993 1 Surface temperature (radiative)
TSMX 0.000634 8.040495 0.007365 6.101627 0.999993 1 Maximum surface temperature over output period
TSMN 0.000634 8.040495 0.007365 6.101627 0.999993 1 Minimum surface temperature over output period
FSNS 0.000645 8.468348 0.015704 5.072529 0.999996 1 Net solar flux at surface
SRFRAD 0.000670 8.308920 0.008020 5.986549 0.999995 1 Net radiative flux at surface
OMEGAT 0.000734 4.450644 0.020112 4.642431 0.998953 30 Vertical heat flux
FLUTC 0.000735 7.853352 0.010651 5.611214 0.999991 1 Clearsky upwelling longwave flux at top of model
FLNTC 0.000736 7.850550 0.010665 5.609375 0.999991 1 Clearsky net longwave flux at top of model
OCNFRAC 0.000736 9.275139 0.022414 4.664229 0.999999 1 Fraction of sfc area covered by ocean
QT 0.000739 8.290220 0.024973 4.341027 0.999995 30 Total water mixing ratio
OMEGA 0.000740 4.383765 0.019266 4.709412 0.998851 30 Vertical velocity (pressure)
Q 0.000743 8.285648 0.025071 4.335912 0.999995 30 Specific humidity
LANDFRAC 0.000754 9.230194 0.023566 4.622250 0.999998 1 Fraction of sfc area covered by land
SLFLX 0.000755 5.180561 0.031574 4.013095 0.999619 31 Liquid static energy flux
TREFHT 0.000759 7.824072 0.008924 5.828102 0.999990 1 Reference height temperature
... ... ... ... ... ... ... ...
LND_MBL 0.001846 4.292132 0.200820 1.503658 0.998330 1 Soil erodibility factor
CLDFSNOW 0.001849 6.090118 0.042578 3.566756 0.999892 30 CLDFSNOW
CLDTOT 0.001861 6.678379 0.020207 4.644719 0.999952 1 Vertically-integrated total cloud
ANSNOW 0.001869 3.357310 0.090775 2.485459 0.995177 30 Average snow number conc
PCONVT 0.001913 6.642461 0.025854 4.302781 0.999950 1 convection top pressure
FREQR 0.001926 6.008965 0.055953 3.176147 0.999879 30 Fractional occurance of rain
LWCF 0.001952 5.667826 0.023177 4.448041 0.999806 1 Longwave cloud forcing
dgnw_a03 0.001952 6.680626 0.040256 3.647954 0.999952 30 wet dgnum, interstitial, mode 03
LCLOUD 0.001993 5.894676 0.058587 3.108647 0.999859 30 Liquid cloud fraction
TGCLDLWP 0.002050 5.668508 0.026237 4.265125 0.999806 1 Total grid-box cloud liquid water path
AREI 0.002087 5.861974 0.060401 3.072907 0.999852 30 Average ice effective radius
CLOUD 0.002087 6.075749 0.040139 3.654858 0.999890 30 Cloud fraction
BURDEN2 0.002091 4.549150 0.040957 3.634196 0.999082 1 Aerosol burden mode 2
T850 0.002091 6.203632 0.032083 3.982456 0.999907 1 Temperature at 850 mbar pressure surface
PRECSC 0.002096 5.280325 0.083850 2.794985 0.999606 1 Convective snow rate (water equivalent)
ANRAIN 0.002148 4.686469 0.137509 1.906918 0.999231 30 Average rain number conc
CDNUMC 0.002156 5.197205 0.027532 4.199769 0.999626 1 Vertically-integrated droplet concentration
PRECSH 0.002171 5.097251 0.070374 2.846871 0.999563 1 Shallow Convection precipitation rate
TAUX 0.002173 5.461698 0.042293 3.596120 0.999729 1 Zonal surface stress
FICE 0.002242 7.042924 0.078309 2.685178 0.999971 30 Fractional ice content within cloud
SSAVIS 0.002252 6.465554 0.024507 4.371974 0.999936 1 Aerosol singel-scatter albedo
PRECSL 0.002255 5.403087 0.057284 3.232515 0.999705 1 Large-scale (stable) snow rate (water equivalent)
CLDHGH 0.002287 5.996920 0.023588 4.421730 0.999877 1 Vertically-integrated high cloud
FREQS 0.002308 6.172173 0.073472 2.779543 0.999904 30 Fractional occurance of snow
AODMODE2 0.002348 4.041533 0.067693 2.905112 0.998147 1 Aerosol optical depth 550 nm mode 2
TOT_ICLD_VISTAU 0.002409 3.961873 0.159779 1.684660 0.997827 30 Total in-cloud extinction visible sw optical d...
FREQZM 0.002446 6.498906 0.026981 4.230549 0.999939 1 Fractional occurance of ZM convection
PSL 0.002602 6.086555 0.032902 3.948064 0.999891 1 Sea level pressure
SSTSFMBL 0.002659 6.291067 0.066927 2.977699 0.999914 1 Mobilization flux at surface
CLDMED 0.002692 5.941506 0.044688 3.512217 0.999867 1 Vertically-integrated mid-level cloud

186 rows × 7 columns


In [22]:
t = v.mean(axis=0).unstack("STATISTIC").loc[:,statistics_of_interest].sort("rms_error").join(vi).reset_index()
t[t["VARIABLE"].isin(("U","FSDSC","Z3","CCN3"))]


Out[22]:
VARIABLE rms_error srr max_error precisionbits correlation levels name
0 Z3 0.000105 11.318098 0.002930 7.452184 1.000000 30 Geopotential Height (above sea level)
42 CCN3 0.000888 5.657070 0.042473 3.572727 0.999803 30 CCN concentration at S=0.1%
77 FSDSC 0.001134 7.718138 0.021229 4.603497 0.999989 1 Clearsky downwelling solar flux at surface
99 U 0.001292 6.937174 0.020729 4.605949 0.999967 30 Zonal wind

In [8]:
v.mean(axis=0).unstack("STATISTIC").loc[:,statistics_of_interest].sort("max_error").join(vi)


Out[8]:
rms_error srr max_error precisionbits correlation levels name
VARIABLE
Z3 0.000105 11.318098 0.002930 7.452184 1.000000 30 Geopotential Height (above sea level)
SL 0.000207 10.011432 0.004308 6.923686 1.000000 30 Liquid water static energy
SLV 0.000208 10.002514 0.004313 6.921773 1.000000 30 Liq wat virtual static energy
TS 0.000634 8.040495 0.007365 6.101627 0.999993 1 Surface temperature (radiative)
TSMN 0.000634 8.040495 0.007365 6.101627 0.999993 1 Minimum surface temperature over output period
TSMX 0.000634 8.040495 0.007365 6.101627 0.999993 1 Maximum surface temperature over output period
SRFRAD 0.000670 8.308920 0.008020 5.986549 0.999995 1 Net radiative flux at surface
TREFHT 0.000759 7.824072 0.008924 5.828102 0.999990 1 Reference height temperature
LHFLX 0.000534 8.654262 0.009371 5.757869 0.999997 1 Surface latent heat flux
QFLX 0.000533 8.659153 0.009412 5.751369 0.999997 1 Surface water flux
T 0.000540 9.055367 0.010042 5.692609 0.999998 30 Temperature
FSNTOA 0.000608 8.644216 0.010140 5.677966 0.999997 1 Net solar flux at top of atmosphere
FSNT 0.000605 8.651299 0.010251 5.663321 0.999997 1 Net solar flux at top of model
FLUTC 0.000735 7.853352 0.010651 5.611214 0.999991 1 Clearsky upwelling longwave flux at top of model
FLNTC 0.000736 7.850550 0.010665 5.609375 0.999991 1 Clearsky net longwave flux at top of model
FLDS 0.000998 7.561160 0.011647 5.440790 0.999986 1 Downwelling longwave flux at surface
AEROD_v 0.000833 6.145683 0.012077 5.413943 0.999899 1 Total Aerosol Optical Depth in visible band
AODVIS 0.000833 6.145683 0.012077 5.413943 0.999899 1 Aerosol optical depth 550 nm
TROP_Z 0.001227 7.675467 0.012410 5.354200 0.999988 1 Tropopause Height
PBLH 0.001225 7.062270 0.013897 5.189860 0.999972 1 PBL height
U10 0.001102 7.675600 0.014206 5.159481 0.999988 1 10m wind speed
BURDEN1 0.001135 6.019933 0.015435 5.039534 0.999881 1 Aerosol burden mode 1
FLUT 0.001369 7.000648 0.015547 5.022870 0.999969 1 Upwelling longwave flux at top of model
AODMODE3 0.000908 5.824932 0.015554 5.046091 0.999843 1 Aerosol optical depth 550 nm mode 3
FLNT 0.001372 6.997030 0.015584 5.019498 0.999969 1 Net longwave flux at top of model
FSNS 0.000645 8.468348 0.015704 5.072529 0.999996 1 Net solar flux at surface
TMQ 0.001141 7.763246 0.015798 5.010735 0.999989 1 Total (vertically integrated) precipitable water
AODDUST3 0.000874 5.873474 0.016181 4.992338 0.999853 1 Aerosol optical depth 550 nm model 3 from dust
SOLIN 0.001184 7.930771 0.016451 4.994237 0.999992 1 Solar insolation
TREFMXAV 0.001357 6.871216 0.016480 4.940533 0.999963 1 Average of TREFHT daily maximum
... ... ... ... ... ... ... ...
QRS 0.001368 6.445209 0.068366 2.921943 0.999934 30 Solar heating rate
PRECSH 0.002171 5.097251 0.070374 2.846871 0.999563 1 Shallow Convection precipitation rate
KVM 0.001683 4.753972 0.070532 2.851807 0.999312 31 Vertical diffusion diffusivities (momentum)
NUMLIQ 0.001715 4.375925 0.071836 2.813376 0.998834 30 Grid box averaged cloud liquid number
FREQS 0.002308 6.172173 0.073472 2.779543 0.999904 30 Fractional occurance of snow
AQSNOW 0.001043 4.778626 0.075265 2.763124 0.999333 30 Average snow mixing ratio
AREL 0.001664 6.024491 0.075822 2.749215 0.999882 30 Average droplet effective radius
TOT_CLD_VISTAU 0.001684 4.371075 0.075897 2.776844 0.998830 30 Total gbx cloud extinction visible sw optical ...
AWNC 0.001762 4.842418 0.076015 2.738478 0.999390 30 Average cloud water number conc
SNOWHLND 0.001801 6.673995 0.076494 2.919809 0.999937 1 Water equivalent snow depth
FICE 0.002242 7.042924 0.078309 2.685178 0.999971 30 Fractional ice content within cloud
ICWMR 0.001572 5.886597 0.078317 2.697758 0.999857 30 Prognostic in-cloud water mixing ratio
VFLX 0.000564 3.145780 0.080370 2.659652 0.993586 31 Meridional momentm flux
CMFDT 0.001232 5.796596 0.081956 2.637914 0.999838 30 T tendency - shallow convection
PRECSC 0.002096 5.280325 0.083850 2.794985 0.999606 1 Convective snow rate (water equivalent)
num_a2 0.001202 4.020414 0.084115 2.596724 0.998092 30 num_a2 concentration
ICIMR 0.001375 5.082574 0.085212 2.572346 0.999562 30 Prognostic in-cloud ice mixing ratio
wat_a2 0.000836 4.138009 0.085469 2.559528 0.998379 30 aerosol water, interstitial, mode 02
ANSNOW 0.001869 3.357310 0.090775 2.485459 0.995177 30 Average snow number conc
so4_a2 0.000960 3.664798 0.092620 2.464298 0.996877 30 so4_a2 concentration
SO2 0.001078 4.424929 0.097937 2.382438 0.998913 30 SO2 concentration
CMFDQR 0.001323 5.029419 0.104403 2.287355 0.999530 30 Q tendency - shallow convection rainout
QC 0.001331 5.543827 0.119684 2.088864 0.999770 30 Q tendency - shallow convection LW export
ANRAIN 0.002148 4.686469 0.137509 1.906918 0.999231 30 Average rain number conc
TOT_ICLD_VISTAU 0.002409 3.961873 0.159779 1.684660 0.997827 30 Total in-cloud extinction visible sw optical d...
H2SO4 0.001618 3.907146 0.167555 1.643990 0.997766 30 H2SO4 concentration
LND_MBL 0.001846 4.292132 0.200820 1.503658 0.998330 1 Soil erodibility factor
DSTSFMBL 0.001607 2.324484 0.201674 1.458365 0.974991 1 Mobilization flux at surface
dst_a3SF 0.001607 2.324484 0.201674 1.458365 0.974991 1 dst_a3 dust surface emission
dst_a1SF 0.001607 2.324484 0.201674 1.458365 0.974991 1 dst_a1 dust surface emission

186 rows × 7 columns

Read RMSZ values


In [9]:
zo = pd.read_table("rmsz_orig_some.txt").set_index(["VARIABLE","ENSEMBLE"])
zr_raw = pd.read_table("rmsz_recon_some.txt")
zr_raw.loc[:,"ENSEMBLE"] = zr_raw.loc[:,"ENSEMBLE"].apply(lambda x: int(x[:3]))
zr = zr_raw.set_index(["VARIABLE","ENSEMBLE"])

In [10]:
abs(zo["RMSZ"]-zr["RMSZ"]).unstack("VARIABLE")


Out[10]:
VARIABLE CCN3 CLDICE IWC dst_a1 dst_a3
ENSEMBLE
0 0.016698 0.344925 4.404879 0.049784 0.048654
1 0.004204 0.068655 0.789322 0.079807 0.147191
2 0.012071 0.524031 2.680315 0.040901 0.065063
3 0.003744 1.587701 18.507921 0.040382 0.010410
4 0.007083 4.475079 5.102316 0.082805 0.104911
5 0.002328 0.517788 2.006497 0.004378 0.032829
6 0.015617 0.906367 8.601122 0.016999 0.035455
7 0.006815 0.187979 1.020700 0.000017 0.056157
8 0.024261 1.730156 6.568199 0.002106 0.081795
9 0.012569 1.370788 2.120515 0.101580 0.173039
10 0.006533 0.338435 3.895049 0.013781 0.091289
11 0.006066 2.784260 3.041993 0.050065 0.235825
12 0.022387 0.455983 15.234851 0.026769 0.069043
13 0.012908 2.329660 10.122257 0.071990 0.153837
14 0.007407 0.662419 1.365739 0.149568 0.068676
15 0.004470 1.185708 3.865835 0.061023 0.054836
16 0.004782 0.938881 5.129010 0.084418 0.160144
17 0.007913 3.927494 7.087770 0.056088 0.172961
18 0.000613 0.012204 1.257773 0.045814 0.043962
19 0.015223 0.676956 0.631580 0.125623 0.486205
20 0.001150 20.190393 16.961534 0.033105 0.092788
21 0.017262 0.423621 1.472318 0.018864 0.145158
22 0.010478 0.966397 0.062523 0.044771 0.033036
23 0.003383 2.427022 1.309258 0.011134 0.009697
24 0.000948 0.463028 0.865908 0.034748 0.080500
25 0.003285 5.386507 5.943073 0.153913 0.171693
26 0.006444 0.071080 6.296858 0.000336 0.097942
27 0.006053 1.055192 1.473824 0.187999 0.342160
28 0.004918 0.401806 1.383985 0.035912 0.071636
29 0.013647 15.348197 12.620939 0.016426 0.009117
... ... ... ... ... ...
71 0.022992 13.650552 7.897640 0.169145 0.264274
72 0.004520 0.200078 1.205537 0.074139 0.111861
73 0.005540 3.260577 0.818358 0.020315 0.295873
74 0.014580 1.393444 3.380053 0.109432 0.094274
75 0.011830 0.278216 1.857611 0.179153 0.328043
76 0.002599 1.935868 3.026704 0.023002 0.100164
77 0.000211 4.420763 1.832907 0.053457 0.056187
78 0.003779 0.385943 4.671992 0.041710 0.034708
79 0.002178 0.837078 1.358120 0.064165 0.076775
80 0.000833 0.481577 2.452646 0.016390 0.030500
81 0.005764 0.658876 14.392383 0.083319 0.102785
82 0.022104 0.035565 1.379366 0.104596 0.194186
83 0.006628 0.595381 1.798556 0.048207 0.064765
84 0.008552 2.916826 15.067361 0.020897 0.016830
85 0.003075 2.009235 17.441648 0.003860 0.000210
86 0.000677 0.310344 1.708894 0.038237 0.091656
87 0.002408 0.288595 7.298881 0.015607 0.017621
88 0.006889 1.581226 2.321903 0.068344 0.211744
89 0.032231 0.030344 17.229650 0.095968 0.030308
90 0.004645 3.403040 10.144836 0.056571 0.103323
91 0.019701 45.771502 49.675231 0.071148 0.049261
92 0.010780 4.546920 9.018857 0.059346 0.106601
93 0.007124 0.101137 3.049786 0.042821 0.053492
94 0.000228 0.275089 0.603243 0.080600 0.066898
95 0.005233 0.733026 5.732611 0.100855 0.138474
96 0.008028 1.549989 1.410629 0.032501 0.085800
97 0.010191 0.321127 2.699940 0.024336 0.043550
98 0.001492 0.699182 8.355502 0.021004 0.000805
99 0.013962 2.264701 5.277319 0.047158 0.141463
100 0.024591 61.745989 57.148394 0.008426 0.019466

101 rows × 5 columns


In [14]:
var = "CCN3"
zo_var = zo["RMSZ"].unstack("VARIABLE")[var]
zr_var = zr["RMSZ"].unstack("VARIABLE")[var]
intercept, slope = np.polyfit(zo_var, zr_var, 1)
linear_fn = np.poly1d((intercept, slope))

plt.plot(zo_var, linear_fn(zo_var), "-r")
plt.scatter(zo_var, zr_var)
plt.grid(True)
plt.axis("equal")
print(intercept, slope)


0.976378676619 0.0250522812442