using RRTM
using Base.Test

using PyCall
@pyimport xarray as xr

# dset = xr.open_dataset("$(@__DIR__)/true.nc",decode_times=false)
# dset = xr.open_dataset("true.nc",decode_times=false)

# mask_dset = xr.open_dataset("$(@__DIR__)/../netcdfs/unit.24.T63GR15.nc",decode_times=false)
# mask_dset = xr.open_dataset("../netcdfs/unit.24.T63GR15.nc",decode_times=false)

time_i = 1
lat_is = [1,8,16,24,32,40,48,57,65,73,81,89,96] #90ºN:15º:90ºS
lon_i = 1 # 0º
CO2_multiple = 1

CO2s = [0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552, 0.000432552]
psctm = 1407.5099

# 90ºN - north pole
atmosphere_90N = Dict(
  :philat => 88.57216851400727,
  :laland => 0.0,
  :laglac => 0.0,
  :ktype => 2.0f0,
  :pp_fl => [0.99459267,4.2806373,11.122996,23.14909,42.585,73.55228,121.53176,192.91608,295.71387,440.0099,637.48126,901.0901,1245.0629,1684.5829,2235.4373,2913.625,3743.0635,4751.7656,5964.3306,7405.9443,9102.234,11068.068,13248.308,15601.156,18159.912,20941.22,23947.07,27177.154,30620.8,34269.59,38109.56,42118.613,46284.684,50598.27,55039.945,59588.61,64224.66,68923.05,73646.42,78348.7,82973.65,87438.08,91630.66,95421.125,98643.91,101081.82,102470.516],
  :pp_hl => [0.0,1.9891853,6.5720897,15.6739025,30.624279,54.54572,92.55883,150.5047,235.32745,356.10025,523.9195,751.04297,1051.1372,1438.9884,1930.1774,2540.697,3286.553,4199.574,5303.957,6624.704,8187.185,10017.283,12118.853,14377.763,16824.55,19495.271,22387.17,25506.97,28847.34,32394.262,36144.918,40074.2,44163.027,48406.34,52790.2,57289.695,61887.523,66561.8,71284.3,76008.54,80688.87,85258.44,89617.72,93643.59,97198.664,100089.16,102074.48,102866.555],
  :tk_fl => [223.88419,248.47968,255.4491,266.82556,270.40826,259.0211,246.09972,235.70581,233.36575,230.7696,226.04025,223.51967,219.90114,216.93134,215.23575,214.07541,212.59341,210.68037,209.36635,208.5025,209.92278,209.84415,209.15971,207.97006,206.0842,206.3612,207.78735,209.20135,212.00252,215.64642,219.90482,224.22945,228.88504,232.64694,236.41977,239.50287,242.46432,243.29868,247.39883,250.61507,253.88438,257.0402,259.98456,262.66583,264.8438,266.3855,267.4195],
  :tk_hl => [207.86427,239.90411,252.42989,261.80734,268.74167,264.47754,252.30017,240.69234,234.49263,232.02328,228.32442,224.73746,221.65,218.36716,216.05582,214.63681,213.31653,211.61378,210.00748,208.92397,209.22974,209.88234,209.48354,208.54004,206.99683,206.22707,207.09506,208.51492,210.64345,213.87613,217.83914,222.13222,226.62384,230.81914,234.58815,238.00584,241.02684,242.89409,245.41629,249.06421,252.31613,255.54073,258.6053,261.4355,263.88498,265.7668,267.12747,269.1351],
  :xm_vap => Float32[2.39237f-6, 2.39403f-6, 2.39567f-6, 2.40148f-6, 2.40799f-6, 2.40958f-6, 2.41401f-6, 2.4205f-6, 2.42498f-6, 2.42571f-6, 2.42543f-6, 2.42371f-6, 2.41548f-6, 2.40475f-6, 2.395f-6, 2.39481f-6, 2.4099f-6, 2.42986f-6, 2.44496f-6, 2.48615f-6, 2.57795f-6, 2.64616f-6, 2.8534f-6, 3.92202f-6, 7.71968f-6, 1.03065f-5, 9.37027f-6, 9.46506f-6, 1.15951f-5, 1.67026f-5, 2.45891f-5, 3.92644f-5, 5.00154f-5, 7.7754f-5, 0.000108968, 0.000168396, 0.000213419, 0.000328351, 0.000519952, 0.000605298, 0.000809924, 0.0010138, 0.0011645, 0.00139964, 0.00166935, 0.00179955, 0.001852],
  :xm_liq => Float32[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.42299f-26, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
  :xm_ice => Float32[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.27147f-5, 0.0, 0.0, 0.0, 0.0, 1.89825f-6, 0.0, 0.0],
  :cdnc => Float32[5.0f7, 5.0f7, 5.0f7, 5.0f7, 5.0f7, 5.0f7, 5.0f7, 5.0f7, 5.0f7, 5.0f7, 5.0f7, 5.0f7, 5.0f7, 5.0f7, 5.0f7, 5.0f7, 5.0f7, 5.0f7, 5.0f7, 5.0f7, 5.0f7, 5.0f7, 5.0f7, 5.0f7, 5.0f7, 5.0f7, 5.00009f7, 5.00113f7, 5.0072f7, 5.02895f7, 5.08351f7, 5.18876f7, 5.35658f7, 5.58934f7, 5.87981f7, 6.21451f7, 6.57777f7, 6.95414f7, 7.32951f7, 7.6923f7, 8.0f7, 8.0f7, 8.0f7, 8.0f7, 8.0f7, 8.0f7, 8.0f7],
  :cld_frc => Float32[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.546269, 0.0, 0.0, 0.0, 0.0, 0.0369192, 0.0, 0.0],
  :xm_o3 => Float32[1.4375f-8, 2.43107f-7, 7.17661f-7, 1.52752f-6, 2.6913f-6, 4.06779f-6, 5.70307f-6, 6.96006f-6, 7.71852f-6, 7.82512f-6, 7.64679f-6, 7.30457f-6, 6.92151f-6, 6.49013f-6, 6.00309f-6, 5.50232f-6, 4.95128f-6, 4.30694f-6, 3.59893f-6, 2.88255f-6, 2.272f-6, 1.85168f-6, 1.53636f-6, 1.12178f-6, 8.4771f-7, 6.23823f-7, 4.28845f-7, 2.95365f-7, 2.11821f-7, 1.60993f-7, 1.27915f-7, 1.04783f-7, 8.61367f-8, 7.15079f-8, 6.73225f-8, 6.371f-8, 6.05139f-8, 5.70196f-8, 5.33389f-8, 4.97705f-8, 4.63004f-8, 4.3429f-8, 4.10897f-8, 3.89749f-8, 3.74552f-8, 3.66676f-8, 3.66676f-8],
  :xm_co2 => CO2s,
  :xm_ch4 => Float32[5.47948f-8, 5.50713f-8, 5.5959f-8, 5.80949f-8, 6.24999f-8, 7.10122f-8, 8.62122f-8, 1.10624f-7, 1.4548f-7, 1.89255f-7, 2.37155f-7, 2.83069f-7, 3.2244f-7, 3.53508f-7, 3.76709f-7, 3.93491f-7, 4.05539f-7, 4.14184f-7, 4.20378f-7, 4.2483f-7, 4.28051f-7, 4.30391f-7, 4.32062f-7, 4.33267f-7, 4.34169f-7, 4.3486f-7, 4.35398f-7, 4.35822f-7, 4.3616f-7, 4.36431f-7, 4.36651f-7, 4.3683f-7, 4.36978f-7, 4.371f-7, 4.37203f-7, 4.3729f-7, 4.37363f-7, 4.37425f-7, 4.37479f-7, 4.37524f-7, 4.37563f-7, 4.37596f-7, 4.37623f-7, 4.37646f-7, 4.37663f-7, 4.37675f-7, 4.37682f-7],
  :xm_n2o => Float32[5.03772f-9, 5.14763f-9, 5.50119f-9, 6.35613f-9, 8.13862f-9, 1.16585f-8, 1.82028f-8, 2.94688f-8, 4.74031f-8, 7.36759f-8, 1.08635f-7, 1.50452f-7, 1.9533f-7, 2.38841f-7, 2.77527f-7, 3.09684f-7, 3.3537f-7, 3.55344f-7, 3.70535f-7, 3.81945f-7, 3.90472f-7, 3.96814f-7, 4.01425f-7, 4.04789f-7, 4.07331f-7, 4.09295f-7, 4.10831f-7, 4.12046f-7, 4.13016f-7, 4.13798f-7, 4.14433f-7, 4.14952f-7, 4.1538f-7, 4.15737f-7, 4.16035f-7, 4.16287f-7, 4.165f-7, 4.16682f-7, 4.16837f-7, 4.1697f-7, 4.17083f-7, 4.17179f-7, 4.17259f-7, 4.17324f-7, 4.17375f-7, 4.1741f-7, 4.1743f-7],
  :solar_constant => psctm,
  # :cos_mu0 => 0.0,
  :cos_mu0m => 0.1,
  :zi0 => 0.0,
  :alb => 0.07,
  :aer_tau_lw_vr => [0.000224725 0.000224725 0.000257824 0.000257824 0.000257824 0.000221002 0.000249906 0.000221002 0.000224725 0.000224725 0.000224725 0.000224725 0.000224725 0.000224725 0.000224725 0.000224725; 0.000512769 0.000512769 0.000587659 0.000587659 0.000587659 0.000504535 0.000571359 0.000504535 0.000512769 0.000512769 0.000512769 0.000512769 0.000512769 0.000512769 0.000512769 0.000512769; 0.000631778 0.000631778 0.000722472 0.000722472 0.000722472 0.000622271 0.000706757 0.000622271 0.000631778 0.000631778 0.000631778 0.000631778 0.000631778 0.000631778 0.000631778 0.000631778; 0.000621497 0.000621497 0.000708231 0.000708231 0.000708231 0.00061317 0.000699689 0.00061317 0.000621497 0.000621497 0.000621497 0.000621497 0.000621497 0.000621497 0.000621497 0.000621497; 0.000539792 0.000539792 0.000611911 0.000611911 0.000611911 0.000533923 0.000613497 0.000533923 0.000539792 0.000539792 0.000539792 0.000539792 0.000539792 0.000539792 0.000539792 0.000539792; 0.000435545 0.000435545 0.000490025 0.000490025 0.000490025 0.000432457 0.000501827 0.000432457 0.000435545 0.000435545 0.000435545 0.000435545 0.000435545 0.000435545 0.000435545 0.000435545; 0.000335057 0.000335057 0.000373027 0.000373027 0.000373027 0.000334558 0.00039349 0.000334558 0.000335057 0.000335057 0.000335057 0.000335057 0.000335057 0.000335057 0.000335057 0.000335057; 0.000251951 0.000251951 0.00027662 0.00027662 0.00027662 0.000253631 0.000303559 0.000253631 0.000251951 0.000251951 0.000251951 0.000251951 0.000251951 0.000251951 0.000251951 0.000251951; 0.000189904 0.000189904 0.000204961 0.000204961 0.000204961 0.000193415 0.000236398 0.000193415 0.000189904 0.000189904 0.000189904 0.000189904 0.000189904 0.000189904 0.000189904 0.000189904; 0.000146462 0.000146462 0.0001551 0.0001551 0.0001551 0.000151518 0.00018946 0.000151518 0.000146462 0.000146462 0.000146462 0.000146462 0.000146462 0.000146462 0.000146462 0.000146462; 0.000116962 0.000116962 0.000121544 0.000121544 0.000121544 0.00012317 0.000157419 0.00012317 0.000116962 0.000116962 0.000116962 0.000116962 0.000116962 0.000116962 0.000116962 0.000116962; 9.75888e-5 9.75888e-5 9.99078e-5 9.99078e-5 9.99078e-5 0.000105022 0.000136698 0.000105022 9.75888e-5 9.75888e-5 9.75888e-5 9.75888e-5 9.75888e-5 9.75888e-5 9.75888e-5 9.75888e-5; 8.50276e-5 8.50276e-5 8.64935e-5 8.64935e-5 8.64935e-5 9.4396e-5 0.000124448 9.4396e-5 8.50276e-5 8.50276e-5 8.50276e-5 8.50276e-5 8.50276e-5 8.50276e-5 8.50276e-5 8.50276e-5; 7.69119e-5 7.69119e-5 7.86762e-5 7.86762e-5 7.86762e-5 8.94298e-5 0.000118696 8.94298e-5 7.69119e-5 7.69119e-5 7.69119e-5 7.69119e-5 7.69119e-5 7.69119e-5 7.69119e-5 7.69119e-5; 7.16285e-5 7.16285e-5 7.49711e-5 7.49711e-5 7.49711e-5 8.96988e-5 0.000119144 8.96988e-5 7.16285e-5 7.16285e-5 7.16285e-5 7.16285e-5 7.16285e-5 7.16285e-5 7.16285e-5 7.16285e-5; 6.87327e-5 6.87327e-5 7.55734e-5 7.55734e-5 7.55734e-5 9.71516e-5 0.000128414 9.71516e-5 6.87327e-5 6.87327e-5 6.87327e-5 6.87327e-5 6.87327e-5 6.87327e-5 6.87327e-5 6.87327e-5; 6.83432e-5 6.83432e-5 8.16348e-5 8.16348e-5 8.16348e-5 0.000115224 0.000150942 0.000115224 6.83432e-5 6.83432e-5 6.83432e-5 6.83432e-5 6.83432e-5 6.83432e-5 6.83432e-5 6.83432e-5; 7.05204e-5 7.05204e-5 9.42911e-5 9.42911e-5 9.42911e-5 0.000147231 0.000190934 0.000147231 7.05204e-5 7.05204e-5 7.05204e-5 7.05204e-5 7.05204e-5 7.05204e-5 7.05204e-5 7.05204e-5; 7.50666e-5 7.50666e-5 0.000113428 0.000113428 0.000113428 0.000193309 0.000248588 0.000193309 7.50666e-5 7.50666e-5 7.50666e-5 7.50666e-5 7.50666e-5 7.50666e-5 7.50666e-5 7.50666e-5; 8.02994e-5 8.02994e-5 0.000133949 0.000133949 0.000133949 0.000242062 0.000309613 0.000242062 8.02994e-5 8.02994e-5 8.02994e-5 8.02994e-5 8.02994e-5 8.02994e-5 8.02994e-5 8.02994e-5; 8.33771e-5 8.33771e-5 0.000148483 0.000148483 0.000148483 0.000277611 0.000354015 0.000277611 8.33771e-5 8.33771e-5 8.33771e-5 8.33771e-5 8.33771e-5 8.33771e-5 8.33771e-5 8.33771e-5; 8.35784e-5 8.35784e-5 0.000155051 0.000155051 0.000155051 0.00029563 0.000376351 0.00029563 8.35784e-5 8.35784e-5 8.35784e-5 8.35784e-5 8.35784e-5 8.35784e-5 8.35784e-5 8.35784e-5; 7.96704e-5 7.96704e-5 0.000150056 0.000150056 0.000150056 0.000288106 0.000366554 0.000288106 7.96704e-5 7.96704e-5 7.96704e-5 7.96704e-5 7.96704e-5 7.96704e-5 7.96704e-5 7.96704e-5; 7.29701e-5 7.29701e-5 0.000137455 0.000137455 0.000137455 0.000263928 0.000335791 0.000263928 7.29701e-5 7.29701e-5 7.29701e-5 7.29701e-5 7.29701e-5 7.29701e-5 7.29701e-5 7.29701e-5; 6.7352e-5 6.7352e-5 0.000126885 0.000126885 0.000126885 0.000243646 0.000309985 0.000243646 6.7352e-5 6.7352e-5 6.7352e-5 6.7352e-5 6.7352e-5 6.7352e-5 6.7352e-5 6.7352e-5; 6.26494e-5 6.26494e-5 0.000118036 0.000118036 0.000118036 0.000226663 0.000288378 0.000226663 6.26494e-5 6.26494e-5 6.26494e-5 6.26494e-5 6.26494e-5 6.26494e-5 6.26494e-5 6.26494e-5; 5.59173e-5 5.59173e-5 0.000106499 0.000106499 0.000106499 0.00020551 0.000261355 0.00020551 5.59173e-5 5.59173e-5 5.59173e-5 5.59173e-5 5.59173e-5 5.59173e-5 5.59173e-5 5.59173e-5; 4.95586e-5 4.95586e-5 9.58668e-5 9.58668e-5 9.58668e-5 0.00018627 0.000236749 0.00018627 4.95586e-5 4.95586e-5 4.95586e-5 4.95586e-5 4.95586e-5 4.95586e-5 4.95586e-5 4.95586e-5; 4.2406e-5 4.2406e-5 8.24322e-5 8.24322e-5 8.24322e-5 0.000160508 0.000203968 0.000160508 4.2406e-5 4.2406e-5 4.2406e-5 4.2406e-5 4.2406e-5 4.2406e-5 4.2406e-5 4.2406e-5; 3.54591e-5 3.54591e-5 6.89282e-5 6.89282e-5 6.89282e-5 0.000134213 0.000170554 0.000134213 3.54591e-5 3.54591e-5 3.54591e-5 3.54591e-5 3.54591e-5 3.54591e-5 3.54591e-5 3.54591e-5; 2.93149e-5 2.93149e-5 5.69847e-5 5.69847e-5 5.69847e-5 0.000110958 0.000141002 0.000110958 2.93149e-5 2.93149e-5 2.93149e-5 2.93149e-5 2.93149e-5 2.93149e-5 2.93149e-5 2.93149e-5; 2.39476e-5 2.39476e-5 4.65514e-5 4.65514e-5 4.65514e-5 9.06423e-5 0.000115186 9.06423e-5 2.39476e-5 2.39476e-5 2.39476e-5 2.39476e-5 2.39476e-5 2.39476e-5 2.39476e-5 2.39476e-5; 1.96023e-5 1.96023e-5 3.81046e-5 3.81046e-5 3.81046e-5 7.41952e-5 9.4285e-5 7.41952e-5 1.96023e-5 1.96023e-5 1.96023e-5 1.96023e-5 1.96023e-5 1.96023e-5 1.96023e-5 1.96023e-5; 1.57709e-5 1.57709e-5 3.06567e-5 3.06567e-5 3.06567e-5 5.96932e-5 7.58563e-5 5.96932e-5 1.57709e-5 1.57709e-5 1.57709e-5 1.57709e-5 1.57709e-5 1.57709e-5 1.57709e-5 1.57709e-5; 1.2453e-5 1.2453e-5 2.42071e-5 2.42071e-5 2.42071e-5 4.71348e-5 5.98974e-5 4.71348e-5 1.2453e-5 1.2453e-5 1.2453e-5 1.2453e-5 1.2453e-5 1.2453e-5 1.2453e-5 1.2453e-5; 9.63531e-6 9.63531e-6 1.87299e-5 1.87299e-5 1.87299e-5 3.64698e-5 4.63448e-5 3.64698e-5 9.63531e-6 9.63531e-6 9.63531e-6 9.63531e-6 9.63531e-6 9.63531e-6 9.63531e-6 9.63531e-6; 7.29239e-6 7.29239e-6 1.41755e-5 1.41755e-5 1.41755e-5 2.76018e-5 3.50756e-5 2.76018e-5 7.29239e-6 7.29239e-6 7.29239e-6 7.29239e-6 7.29239e-6 7.29239e-6 7.29239e-6 7.29239e-6; 5.38827e-6 5.38827e-6 1.04742e-5 1.04742e-5 1.04742e-5 2.03947e-5 2.5917e-5 2.03947e-5 5.38827e-6 5.38827e-6 5.38827e-6 5.38827e-6 5.38827e-6 5.38827e-6 5.38827e-6 5.38827e-6; 3.87773e-6 3.87773e-6 7.53783e-6 7.53783e-6 7.53783e-6 1.46773e-5 1.86514e-5 1.46773e-5 3.87773e-6 3.87773e-6 3.87773e-6 3.87773e-6 3.87773e-6 3.87773e-6 3.87773e-6 3.87773e-6; 2.72346e-6 2.72346e-6 5.29407e-6 5.29407e-6 5.29407e-6 1.03083e-5 1.30995e-5 1.03083e-5 2.72346e-6 2.72346e-6 2.72346e-6 2.72346e-6 2.72346e-6 2.72346e-6 2.72346e-6 2.72346e-6; 1.8605e-6 1.8605e-6 3.6166e-6 3.6166e-6 3.6166e-6 7.04204e-6 8.94881e-6 7.04204e-6 1.8605e-6 1.8605e-6 1.8605e-6 1.8605e-6 1.8605e-6 1.8605e-6 1.8605e-6 1.8605e-6; 1.22051e-6 1.22051e-6 2.37253e-6 2.37253e-6 2.37253e-6 4.61965e-6 5.87052e-6 4.61965e-6 1.22051e-6 1.22051e-6 1.22051e-6 1.22051e-6 1.22051e-6 1.22051e-6 1.22051e-6 1.22051e-6; 7.6806e-7 7.6806e-7 1.49302e-6 1.49302e-6 1.49302e-6 2.90712e-6 3.69428e-6 2.90712e-6 7.6806e-7 7.6806e-7 7.6806e-7 7.6806e-7 7.6806e-7 7.6806e-7 7.6806e-7 7.6806e-7; 4.80021e-7 4.80021e-7 9.33103e-7 9.33103e-7 9.33103e-7 1.81689e-6 2.30885e-6 1.81689e-6 4.80021e-7 4.80021e-7 4.80021e-7 4.80021e-7 4.80021e-7 4.80021e-7 4.80021e-7 4.80021e-7; 2.92237e-7 2.92237e-7 5.68075e-7 5.68075e-7 5.68075e-7 1.10612e-6 1.40563e-6 1.10612e-6 2.92237e-7 2.92237e-7 2.92237e-7 2.92237e-7 2.92237e-7 2.92237e-7 2.92237e-7 2.92237e-7; 1.47146e-7 1.47146e-7 2.86034e-7 2.86034e-7 2.86034e-7 5.56951e-7 7.07756e-7 5.56951e-7 1.47146e-7 1.47146e-7 1.47146e-7 1.47146e-7 1.47146e-7 1.47146e-7 1.47146e-7 1.47146e-7; 6.3868e-8 6.3868e-8 1.24152e-7 1.24152e-7 1.24152e-7 2.41742e-7 3.07198e-7 2.41742e-7 6.3868e-8 6.3868e-8 6.3868e-8 6.3868e-8 6.3868e-8 6.3868e-8 6.3868e-8 6.3868e-8],
  :aer_tau_sw_vr => [0.00361212 0.00361212 0.00361212 0.00361212 0.00361212 0.00361212 0.00361212 0.00361212 0.00361212 0.00361212 0.00361212 0.00361212 0.00361212 0.00361212; 0.00825244 0.00825244 0.00825244 0.00825244 0.00825244 0.00825244 0.00825244 0.00825244 0.00825244 0.00825244 0.00825244 0.00825244 0.00825244 0.00825244; 0.0101935 0.0101935 0.0101935 0.0101935 0.0101935 0.0101935 0.0101935 0.0101935 0.0101935 0.0101935 0.0101935 0.0101935 0.0101935 0.0101935; 0.0100685 0.0100685 0.0100685 0.0100685 0.0100685 0.0100685 0.0100685 0.0100685 0.0100685 0.0100685 0.0100685 0.0100685 0.0100685 0.0100685; 0.0087982 0.0087982 0.0087982 0.0087982 0.0087982 0.0087982 0.0087982 0.0087982 0.0087982 0.0087982 0.0087982 0.0087982 0.0087982 0.0087982; 0.00716182 0.00716182 0.00716182 0.00716182 0.00716182 0.00716182 0.00716182 0.00716182 0.00716182 0.00716182 0.00716182 0.00716182 0.00716182 0.00716182; 0.00557801 0.00557801 0.00557801 0.00557801 0.00557801 0.00557801 0.00557801 0.00557801 0.00557801 0.00557801 0.00557801 0.00557801 0.00557801 0.00557801; 0.00426505 0.00426505 0.00426505 0.00426505 0.00426505 0.00426505 0.00426505 0.00426505 0.00426505 0.00426505 0.00426505 0.00426505 0.00426505 0.00426505; 0.00328455 0.00328455 0.00328455 0.00328455 0.00328455 0.00328455 0.00328455 0.00328455 0.00328455 0.00328455 0.00328455 0.00328455 0.00328455 0.00328455; 0.00259875 0.00259875 0.00259875 0.00259875 0.00259875 0.00259875 0.00259875 0.00259875 0.00259875 0.00259875 0.00259875 0.00259875 0.00259875 0.00259875; 0.00213146 0.00213146 0.00213146 0.00213146 0.00213146 0.00213146 0.00213146 0.00213146 0.00213146 0.00213146 0.00213146 0.00213146 0.00213146 0.00213146; 0.00182739 0.00182739 0.00182739 0.00182739 0.00182739 0.00182739 0.00182739 0.00182739 0.00182739 0.00182739 0.00182739 0.00182739 0.00182739 0.00182739; 0.00164086 0.00164086 0.00164086 0.00164086 0.00164086 0.00164086 0.00164086 0.00164086 0.00164086 0.00164086 0.00164086 0.00164086 0.00164086 0.00164086; 0.00153977 0.00153977 0.00153977 0.00153977 0.00153977 0.00153977 0.00153977 0.00153977 0.00153977 0.00153977 0.00153977 0.00153977 0.00153977 0.00153977; 0.0015117 0.0015117 0.0015117 0.0015117 0.0015117 0.0015117 0.0015117 0.0015117 0.0015117 0.0015117 0.0015117 0.0015117 0.0015117 0.0015117; 0.00157764 0.00157764 0.00157764 0.00157764 0.00157764 0.00157764 0.00157764 0.00157764 0.00157764 0.00157764 0.00157764 0.00157764 0.00157764 0.00157764; 0.00177832 0.00177832 0.00177832 0.00177832 0.00177832 0.00177832 0.00177832 0.00177832 0.00177832 0.00177832 0.00177832 0.00177832 0.00177832 0.00177832; 0.00215205 0.00215205 0.00215205 0.00215205 0.00215205 0.00215205 0.00215205 0.00215205 0.00215205 0.00215205 0.00215205 0.00215205 0.00215205 0.00215205; 0.00269943 0.00269943 0.00269943 0.00269943 0.00269943 0.00269943 0.00269943 0.00269943 0.00269943 0.00269943 0.00269943 0.00269943 0.00269943 0.00269943; 0.00328137 0.00328137 0.00328137 0.00328137 0.00328137 0.00328137 0.00328137 0.00328137 0.00328137 0.00328137 0.00328137 0.00328137 0.00328137 0.00328137; 0.00370033 0.00370033 0.00370033 0.00370033 0.00370033 0.00370033 0.00370033 0.00370033 0.00370033 0.00370033 0.00370033 0.00370033 0.00370033 0.00370033; 0.00390285 0.00390285 0.00390285 0.00390285 0.00390285 0.00390285 0.00390285 0.00390285 0.00390285 0.00390285 0.00390285 0.00390285 0.00390285 0.00390285; 0.00379065 0.00379065 0.00379065 0.00379065 0.00379065 0.00379065 0.00379065 0.00379065 0.00379065 0.00379065 0.00379065 0.00379065 0.00379065 0.00379065; 0.00347243 0.00347243 0.00347243 0.00347243 0.00347243 0.00347243 0.00347243 0.00347243 0.00347243 0.00347243 0.00347243 0.00347243 0.00347243 0.00347243; 0.00320551 0.00320551 0.00320551 0.00320551 0.00320551 0.00320551 0.00320551 0.00320551 0.00320551 0.00320551 0.00320551 0.00320551 0.00320551 0.00320551; 0.00298202 0.00298202 0.00298202 0.00298202 0.00298202 0.00298202 0.00298202 0.00298202 0.00298202 0.00298202 0.00298202 0.00298202 0.00298202 0.00298202; 0.00269732 0.00269732 0.00269732 0.00269732 0.00269732 0.00269732 0.00269732 0.00269732 0.00269732 0.00269732 0.00269732 0.00269732 0.00269732 0.00269732; 0.00243667 0.00243667 0.00243667 0.00243667 0.00243667 0.00243667 0.00243667 0.00243667 0.00243667 0.00243667 0.00243667 0.00243667 0.00243667 0.00243667; 0.00209751 0.00209751 0.00209751 0.00209751 0.00209751 0.00209751 0.00209751 0.00209751 0.00209751 0.00209751 0.00209751 0.00209751 0.00209751 0.00209751; 0.0017539 0.0017539 0.0017539 0.0017539 0.0017539 0.0017539 0.0017539 0.0017539 0.0017539 0.0017539 0.0017539 0.0017539 0.0017539 0.0017539; 0.00144999 0.00144999 0.00144999 0.00144999 0.00144999 0.00144999 0.00144999 0.00144999 0.00144999 0.00144999 0.00144999 0.00144999 0.00144999 0.00144999; 0.00118451 0.00118451 0.00118451 0.00118451 0.00118451 0.00118451 0.00118451 0.00118451 0.00118451 0.00118451 0.00118451 0.00118451 0.00118451 0.00118451; 0.000969582 0.000969582 0.000969582 0.000969582 0.000969582 0.000969582 0.000969582 0.000969582 0.000969582 0.000969582 0.000969582 0.000969582 0.000969582 0.000969582; 0.00078007 0.00078007 0.00078007 0.00078007 0.00078007 0.00078007 0.00078007 0.00078007 0.00078007 0.00078007 0.00078007 0.00078007 0.00078007 0.00078007; 0.000615956 0.000615956 0.000615956 0.000615956 0.000615956 0.000615956 0.000615956 0.000615956 0.000615956 0.000615956 0.000615956 0.000615956 0.000615956 0.000615956; 0.000476587 0.000476587 0.000476587 0.000476587 0.000476587 0.000476587 0.000476587 0.000476587 0.000476587 0.000476587 0.000476587 0.000476587 0.000476587 0.000476587; 0.000360701 0.000360701 0.000360701 0.000360701 0.000360701 0.000360701 0.000360701 0.000360701 0.000360701 0.000360701 0.000360701 0.000360701 0.000360701 0.000360701; 0.000266518 0.000266518 0.000266518 0.000266518 0.000266518 0.000266518 0.000266518 0.000266518 0.000266518 0.000266518 0.000266518 0.000266518 0.000266518 0.000266518; 0.000191802 0.000191802 0.000191802 0.000191802 0.000191802 0.000191802 0.000191802 0.000191802 0.000191802 0.000191802 0.000191802 0.000191802 0.000191802 0.000191802; 0.000134709 0.000134709 0.000134709 0.000134709 0.000134709 0.000134709 0.000134709 0.000134709 0.000134709 0.000134709 0.000134709 0.000134709 0.000134709 0.000134709; 9.20253e-5 9.20253e-5 9.20253e-5 9.20253e-5 9.20253e-5 9.20253e-5 9.20253e-5 9.20253e-5 9.20253e-5 9.20253e-5 9.20253e-5 9.20253e-5 9.20253e-5 9.20253e-5; 6.03696e-5 6.03696e-5 6.03696e-5 6.03696e-5 6.03696e-5 6.03696e-5 6.03696e-5 6.03696e-5 6.03696e-5 6.03696e-5 6.03696e-5 6.03696e-5 6.03696e-5 6.03696e-5; 3.79902e-5 3.79902e-5 3.79902e-5 3.79902e-5 3.79902e-5 3.79902e-5 3.79902e-5 3.79902e-5 3.79902e-5 3.79902e-5 3.79902e-5 3.79902e-5 3.79902e-5 3.79902e-5; 2.37431e-5 2.37431e-5 2.37431e-5 2.37431e-5 2.37431e-5 2.37431e-5 2.37431e-5 2.37431e-5 2.37431e-5 2.37431e-5 2.37431e-5 2.37431e-5 2.37431e-5 2.37431e-5; 1.44548e-5 1.44548e-5 1.44548e-5 1.44548e-5 1.44548e-5 1.44548e-5 1.44548e-5 1.44548e-5 1.44548e-5 1.44548e-5 1.44548e-5 1.44548e-5 1.44548e-5 1.44548e-5; 7.27823e-6 7.27823e-6 7.27823e-6 7.27823e-6 7.27823e-6 7.27823e-6 7.27823e-6 7.27823e-6 7.27823e-6 7.27823e-6 7.27823e-6 7.27823e-6 7.27823e-6 7.27823e-6; 3.15908e-6 3.15908e-6 3.15908e-6 3.15908e-6 3.15908e-6 3.15908e-6 3.15908e-6 3.15908e-6 3.15908e-6 3.15908e-6 3.15908e-6 3.15908e-6 3.15908e-6 3.15908e-6],
  :aer_piz_sw_vr => [0.858433 0.858433 0.858433 0.858433 0.858433 0.858433 0.858433 0.858433 0.858433 0.858433 0.858433 0.858433 0.858433 0.858433; 0.85855 0.85855 0.85855 0.85855 0.85855 0.85855 0.85855 0.85855 0.85855 0.85855 0.85855 0.85855 0.85855 0.85855; 0.858783 0.858783 0.858783 0.858783 0.858783 0.858783 0.858783 0.858783 0.858783 0.858783 0.858783 0.858783 0.858783 0.858783; 0.859158 0.859158 0.859158 0.859158 0.859158 0.859158 0.859158 0.859158 0.859158 0.859158 0.859158 0.859158 0.859158 0.859158; 0.859722 0.859722 0.859722 0.859722 0.859722 0.859722 0.859722 0.859722 0.859722 0.859722 0.859722 0.859722 0.859722 0.859722; 0.860544 0.860544 0.860544 0.860544 0.860544 0.860544 0.860544 0.860544 0.860544 0.860544 0.860544 0.860544 0.860544 0.860544; 0.861714 0.861714 0.861714 0.861714 0.861714 0.861714 0.861714 0.861714 0.861714 0.861714 0.861714 0.861714 0.861714 0.861714; 0.863325 0.863325 0.863325 0.863325 0.863325 0.863325 0.863325 0.863325 0.863325 0.863325 0.863325 0.863325 0.863325 0.863325; 0.865485 0.865485 0.865485 0.865485 0.865485 0.865485 0.865485 0.865485 0.865485 0.865485 0.865485 0.865485 0.865485 0.865485; 0.868173 0.868173 0.868173 0.868173 0.868173 0.868173 0.868173 0.868173 0.868173 0.868173 0.868173 0.868173 0.868173 0.868173; 0.871055 0.871055 0.871055 0.871055 0.871055 0.871055 0.871055 0.871055 0.871055 0.871055 0.871055 0.871055 0.871055 0.871055; 0.874289 0.874289 0.874289 0.874289 0.874289 0.874289 0.874289 0.874289 0.874289 0.874289 0.874289 0.874289 0.874289 0.874289; 0.878544 0.878544 0.878544 0.878544 0.878544 0.878544 0.878544 0.878544 0.878544 0.878544 0.878544 0.878544 0.878544 0.878544; 0.8845 0.8845 0.8845 0.8845 0.8845 0.8845 0.8845 0.8845 0.8845 0.8845 0.8845 0.8845 0.8845 0.8845; 0.893648 0.893648 0.893648 0.893648 0.893648 0.893648 0.893648 0.893648 0.893648 0.893648 0.893648 0.893648 0.893648 0.893648; 0.907973 0.907973 0.907973 0.907973 0.907973 0.907973 0.907973 0.907973 0.907973 0.907973 0.907973 0.907973 0.907973 0.907973; 0.927626 0.927626 0.927626 0.927626 0.927626 0.927626 0.927626 0.927626 0.927626 0.927626 0.927626 0.927626 0.927626 0.927626; 0.949446 0.949446 0.949446 0.949446 0.949446 0.949446 0.949446 0.949446 0.949446 0.949446 0.949446 0.949446 0.949446 0.949446; 0.968611 0.968611 0.968611 0.968611 0.968611 0.968611 0.968611 0.968611 0.968611 0.968611 0.968611 0.968611 0.968611 0.968611; 0.981515 0.981515 0.981515 0.981515 0.981515 0.981515 0.981515 0.981515 0.981515 0.981515 0.981515 0.981515 0.981515 0.981515; 0.989017 0.989017 0.989017 0.989017 0.989017 0.989017 0.989017 0.989017 0.989017 0.989017 0.989017 0.989017 0.989017 0.989017; 0.993341 0.993341 0.993341 0.993341 0.993341 0.993341 0.993341 0.993341 0.993341 0.993341 0.993341 0.993341 0.993341 0.993341; 0.994878 0.994878 0.994878 0.994878 0.994878 0.994878 0.994878 0.994878 0.994878 0.994878 0.994878 0.994878 0.994878 0.994878; 0.994891 0.994891 0.994891 0.994891 0.994891 0.994891 0.994891 0.994891 0.994891 0.994891 0.994891 0.994891 0.994891 0.994891; 0.994902 0.994902 0.994902 0.994902 0.994902 0.994902 0.994902 0.994902 0.994902 0.994902 0.994902 0.994902 0.994902 0.994902; 0.994911 0.994911 0.994911 0.994911 0.994911 0.994911 0.994911 0.994911 0.994911 0.994911 0.994911 0.994911 0.994911 0.994911; 0.995988 0.995988 0.995988 0.995988 0.995988 0.995988 0.995988 0.995988 0.995988 0.995988 0.995988 0.995988 0.995988 0.995988; 0.997505 0.997505 0.997505 0.997505 0.997505 0.997505 0.997505 0.997505 0.997505 0.997505 0.997505 0.997505 0.997505 0.997505; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975],
  :aer_cg_sw_vr => [0.658565 0.658565 0.658565 0.658565 0.658565 0.658565 0.658565 0.658565 0.658565 0.658565 0.658565 0.658565 0.658565 0.658565; 0.658473 0.658473 0.658473 0.658473 0.658473 0.658473 0.658473 0.658473 0.658473 0.658473 0.658473 0.658473 0.658473 0.658473; 0.65829 0.65829 0.65829 0.65829 0.65829 0.65829 0.65829 0.65829 0.65829 0.65829 0.65829 0.65829 0.65829 0.65829; 0.657996 0.657996 0.657996 0.657996 0.657996 0.657996 0.657996 0.657996 0.657996 0.657996 0.657996 0.657996 0.657996 0.657996; 0.65756 0.65756 0.65756 0.65756 0.65756 0.65756 0.65756 0.65756 0.65756 0.65756 0.65756 0.65756 0.65756 0.65756; 0.656937 0.656937 0.656937 0.656937 0.656937 0.656937 0.656937 0.656937 0.656937 0.656937 0.656937 0.656937 0.656937 0.656937; 0.656076 0.656076 0.656076 0.656076 0.656076 0.656076 0.656076 0.656076 0.656076 0.656076 0.656076 0.656076 0.656076 0.656076; 0.654941 0.654941 0.654941 0.654941 0.654941 0.654941 0.654941 0.654941 0.654941 0.654941 0.654941 0.654941 0.654941 0.654941; 0.653528 0.653528 0.653528 0.653528 0.653528 0.653528 0.653528 0.653528 0.653528 0.653528 0.653528 0.653528 0.653528 0.653528; 0.651919 0.651919 0.651919 0.651919 0.651919 0.651919 0.651919 0.651919 0.651919 0.651919 0.651919 0.651919 0.651919 0.651919; 0.65031 0.65031 0.65031 0.65031 0.65031 0.65031 0.65031 0.65031 0.65031 0.65031 0.65031 0.65031 0.65031 0.65031; 0.648775 0.648775 0.648775 0.648775 0.648775 0.648775 0.648775 0.648775 0.648775 0.648775 0.648775 0.648775 0.648775 0.648775; 0.647234 0.647234 0.647234 0.647234 0.647234 0.647234 0.647234 0.647234 0.647234 0.647234 0.647234 0.647234 0.647234 0.647234; 0.645558 0.645558 0.645558 0.645558 0.645558 0.645558 0.645558 0.645558 0.645558 0.645558 0.645558 0.645558 0.645558 0.645558; 0.643419 0.643419 0.643419 0.643419 0.643419 0.643419 0.643419 0.643419 0.643419 0.643419 0.643419 0.643419 0.643419 0.643419; 0.640416 0.640416 0.640416 0.640416 0.640416 0.640416 0.640416 0.640416 0.640416 0.640416 0.640416 0.640416 0.640416 0.640416; 0.636571 0.636571 0.636571 0.636571 0.636571 0.636571 0.636571 0.636571 0.636571 0.636571 0.636571 0.636571 0.636571 0.636571; 0.632537 0.632537 0.632537 0.632537 0.632537 0.632537 0.632537 0.632537 0.632537 0.632537 0.632537 0.632537 0.632537 0.632537; 0.629159 0.629159 0.629159 0.629159 0.629159 0.629159 0.629159 0.629159 0.629159 0.629159 0.629159 0.629159 0.629159 0.629159; 0.626963 0.626963 0.626963 0.626963 0.626963 0.626963 0.626963 0.626963 0.626963 0.626963 0.626963 0.626963 0.626963 0.626963; 0.625713 0.625713 0.625713 0.625713 0.625713 0.625713 0.625713 0.625713 0.625713 0.625713 0.625713 0.625713 0.625713 0.625713; 0.625001 0.625001 0.625001 0.625001 0.625001 0.625001 0.625001 0.625001 0.625001 0.625001 0.625001 0.625001 0.625001 0.625001; 0.62475 0.62475 0.62475 0.62475 0.62475 0.62475 0.62475 0.62475 0.62475 0.62475 0.62475 0.62475 0.62475 0.62475; 0.624748 0.624748 0.624748 0.624748 0.624748 0.624748 0.624748 0.624748 0.624748 0.624748 0.624748 0.624748 0.624748 0.624748; 0.624746 0.624746 0.624746 0.624746 0.624746 0.624746 0.624746 0.624746 0.624746 0.624746 0.624746 0.624746 0.624746 0.624746; 0.624745 0.624745 0.624745 0.624745 0.624745 0.624745 0.624745 0.624745 0.624745 0.624745 0.624745 0.624745 0.624745 0.624745; 0.624569 0.624569 0.624569 0.624569 0.624569 0.624569 0.624569 0.624569 0.624569 0.624569 0.624569 0.624569 0.624569 0.624569; 0.624322 0.624322 0.624322 0.624322 0.624322 0.624322 0.624322 0.624322 0.624322 0.624322 0.624322 0.624322 0.624322 0.624322; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246]
)

# output = radiation(atmosphere_90N, SW_correction=false, output_type=:profile)
# @test output[:LW_up] ≈ Float32[297.18, 294.719, 291.857, 287.862, 283.018, 277.469, 271.527, 265.593, 246.598, 241.478, 237.095, 234.587, 231.118, 227.753, 224.316, 221.106, 217.791, 214.953, 212.45, 210.359, 208.633, 207.217, 205.912, 205.028, 204.607, 204.216, 203.847, 203.476, 203.039, 202.838, 202.773, 202.812, 202.869, 202.931, 203.032, 203.188, 203.36, 203.503, 203.66, 203.762, 203.849, 203.996, 204.154, 204.271, 204.284, 204.259, 204.238, 204.21] atol=.002
# @test output[:LW_dn] ≈ Float32[217.142, 214.046, 208.899, 200.197, 191.167, 181.478, 171.24, 161.299, 115.353, 102.602, 93.1167, 83.8367, 73.7743, 64.5109, 55.8025, 48.1043, 40.881, 35.0809, 30.4824, 27.0386, 24.373, 21.869, 19.3198, 17.2725, 15.8369, 14.4617, 12.9725, 11.4358, 10.1641, 8.97049, 7.81455, 6.67484, 5.61965, 4.69831, 3.91432, 3.21385, 2.58376, 2.11297, 1.69107, 1.33019, 1.08748, 0.87937, 0.675934, 0.445198, 0.25868, 0.13656, 0.0524619, 0.0] atol=.002
# @test output[:SW_up] ≈ Float32[50.3689, 50.3659, 50.3589, 50.3452, 50.3232, 50.289, 50.2368, 50.1608, 50.0537, 49.9057, 49.7041, 49.4359, 49.0868, 48.6431, 48.0916, 47.4206, 46.6205, 45.6677, 44.5503, 43.2597, 41.8072, 40.2323, 38.5523, 36.8422, 35.0879, 33.2812, 31.4936, 29.8098, 28.281, 26.9394, 25.7654, 24.7133, 23.741, 22.8155, 21.9194, 21.0428, 20.1772, 19.3095, 18.4305, 17.5327, 9.17453, 8.38095, 7.54415, 6.6829, 5.84048, 4.92618, 4.38367, 4.15952][end:-1:1] atol=.002
# @test output[:SW_dn] ≈ Float32[140.751, 140.739, 140.713, 140.639, 140.458, 140.107, 139.622, 139.088, 138.521, 137.897, 137.194, 136.386, 135.451, 134.365, 133.115, 131.695, 130.102, 128.313, 126.345, 124.224, 121.993, 119.695, 117.304, 114.955, 112.637, 110.243, 107.882, 105.695, 103.688, 101.841, 100.085, 98.3609, 96.5777, 94.8004, 92.8888, 90.9038, 88.7595, 86.6197, 84.279, 81.7042, 70.9631, 68.9652, 66.9218, 64.9181, 62.9907, 61.113, 59.911, 59.4217][end:-1:1] atol=.002
# @test output[:LW_up_clr] ≈ Float32[297.081, 294.621, 291.762, 287.929, 283.074, 277.518, 271.572, 265.635, 260.017, 254.324, 249.641, 246.936, 243.319, 239.847, 236.327, 233.05, 229.676, 226.786, 224.232, 222.089, 220.307, 218.827, 217.451, 216.494, 216.003, 215.542, 215.11, 214.69, 214.21, 213.973, 213.88, 213.897, 213.936, 213.986, 214.078, 214.228, 214.395, 214.535, 214.69, 214.791, 214.877, 215.023, 215.182, 215.299, 215.312, 215.287, 215.266, 215.237] atol = .002
# @test output[:LW_dn_clr] ≈ Float32[192.341, 188.937, 182.973, 174.189, 163.623, 152.111, 139.642, 127.095, 115.353, 102.602, 93.1167, 83.8367, 73.7743, 64.5109, 55.8025, 48.1043, 40.881, 35.0809, 30.4824, 27.0386, 24.373, 21.869, 19.3198, 17.2725, 15.8369, 14.4617, 12.9725, 11.4358, 10.1641, 8.97049, 7.81455, 6.67484, 5.61965, 4.69831, 3.91432, 3.21385, 2.58376, 2.11297, 1.69107, 1.33019, 1.08748, 0.87937, 0.675934, 0.445198, 0.25868, 0.13656, 0.0524619, 0.0] atol = .002
# @test output[:SW_up_clr] ≈ Float32[45.1486, 45.1455, 45.1386, 45.1248, 45.1027, 45.0683, 45.0159, 44.9393, 44.8313, 44.682, 44.4786, 44.2079, 43.8556, 43.4079, 42.8516, 42.1747, 41.3678, 40.4071, 39.2807, 37.9802, 36.5169, 34.9306, 33.238, 31.5151, 29.7478, 27.9277, 26.1264, 24.429, 22.8868, 21.5323, 20.3456, 19.2807, 18.295, 17.3555, 16.444, 15.5505, 14.665, 13.7743, 12.8662, 11.9285, 10.9399, 9.88911, 8.77861, 7.63398, 6.51355, 5.52083, 4.79489, 4.49525][end:-1:1] atol = .002
# @test output[:SW_dn_clr] ≈ Float32[140.751, 140.739, 140.713, 140.639, 140.458, 140.107, 139.622, 139.087, 138.52, 137.895, 137.192, 136.383, 135.446, 134.359, 133.107, 131.685, 130.089, 128.296, 126.323, 124.196, 121.959, 119.653, 117.254, 114.896, 112.569, 110.164, 107.792, 105.594, 103.577, 101.719, 99.953, 98.2192, 96.4263, 94.6392, 92.7176, 90.7223, 88.5674, 86.4165, 84.0642, 81.477, 78.9771, 76.357, 73.6898, 71.0844, 68.5886, 66.4062, 64.85, 64.2179][end:-1:1] atol = .002
#
# output = radiation(atmosphere_90N, SW_correction=true, output_type=:profile)
# @test output[:LW_up] ≈ Float32[297.18, 294.719, 291.857, 287.862, 283.018, 277.469, 271.527, 265.593, 246.598, 241.478, 237.095, 234.587, 231.118, 227.753, 224.316, 221.106, 217.791, 214.953, 212.45, 210.359, 208.633, 207.217, 205.912, 205.028, 204.607, 204.216, 203.847, 203.476, 203.039, 202.838, 202.773, 202.812, 202.869, 202.931, 203.032, 203.188, 203.36, 203.503, 203.66, 203.762, 203.849, 203.996, 204.154, 204.271, 204.284, 204.259, 204.238, 204.21] atol=.002
# @test output[:LW_dn] ≈ Float32[217.142, 214.046, 208.899, 200.197, 191.167, 181.478, 171.24, 161.299, 115.353, 102.602, 93.1167, 83.8367, 73.7743, 64.5109, 55.8025, 48.1043, 40.881, 35.0809, 30.4824, 27.0386, 24.373, 21.869, 19.3198, 17.2725, 15.8369, 14.4617, 12.9725, 11.4358, 10.1641, 8.97049, 7.81455, 6.67484, 5.61965, 4.69831, 3.91432, 3.21385, 2.58376, 2.11297, 1.69107, 1.33019, 1.08748, 0.87937, 0.675934, 0.445198, 0.25868, 0.13656, 0.0524619, 0.0] atol=.002
# @test output[:SW_dn] - output[:SW_up] ≈ Float32[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] atol=.002
# @test output[:LW_up_clr] ≈ Float32[297.081, 294.621, 291.762, 287.929, 283.074, 277.518, 271.572, 265.635, 260.017, 254.324, 249.641, 246.936, 243.319, 239.847, 236.327, 233.05, 229.676, 226.786, 224.232, 222.089, 220.307, 218.827, 217.451, 216.494, 216.003, 215.542, 215.11, 214.69, 214.21, 213.973, 213.88, 213.897, 213.936, 213.986, 214.078, 214.228, 214.395, 214.535, 214.69, 214.791, 214.877, 215.023, 215.182, 215.299, 215.312, 215.287, 215.266, 215.237] atol = .002
# @test output[:LW_dn_clr] ≈ Float32[192.341, 188.937, 182.973, 174.189, 163.623, 152.111, 139.642, 127.095, 115.353, 102.602, 93.1167, 83.8367, 73.7743, 64.5109, 55.8025, 48.1043, 40.881, 35.0809, 30.4824, 27.0386, 24.373, 21.869, 19.3198, 17.2725, 15.8369, 14.4617, 12.9725, 11.4358, 10.1641, 8.97049, 7.81455, 6.67484, 5.61965, 4.69831, 3.91432, 3.21385, 2.58376, 2.11297, 1.69107, 1.33019, 1.08748, 0.87937, 0.675934, 0.445198, 0.25868, 0.13656, 0.0524619, 0.0] atol = .002
# @test output[:SW_up_clr] - output[:SW_dn_clr] ≈ Float32[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] atol = .002
#
# output = radiation(atmosphere_90N, SW_correction=false, output_type=:flux)
# @test output[:LW_up_toa] ≈ [-204.21] atol=.002
# @test output[:SW_up_toa] ≈ [-50.3689] atol=.002
# @test output[:SW_dn_toa] ≈ [140.751] atol=.002
# @test output[:LW_up_clr_toa] ≈ [-215.237] atol = .002
# @test output[:SW_up_clr_toa] ≈ [-45.1486] atol = .002
#
output = radiation(atmosphere_90N, SW_correction=true, output_type=:flux)
@test output[:SW_dn_toa] + output[:SW_up_toa] ≈ [0.0] atol=.002
@test output[:LW_up_toa] ≈ [-204.21] atol=.002
@test output[:SW_dn_toa] + output[:SW_up_toa] ≈ [0.0] atol=.002
@test output[:LW_up_clr_toa] ≈ [-215.237] atol=.002
@test output[:SW_dn_toa] + output[:SW_up_clr_toa] ≈ [0.0] atol=.002

# 75ºN,0º - greenland sea

# 60ºN,0º - north sea, near shetlands

# 45ºN,0º - france, near bordeaux

# 30ºN,0º - algeria

# 15ºN,0º - near meeting point of mali, burkina faso, and niger

# 0º,0º - atlantic ocean, gulf of guinea

# 15ºS,0º - atlantic ocean

# 30ºS,0º - atlantic ocean

# 45ºS,0º - atlantic ocean

# 60ºS,0º - atlantic/southern ocean

# 75ºS,0º - atlantic ocean

# 90ºS - south pole
atmosphere_90S = Dict(
  :philat => -88.57216851400727,
  :laland => 1.0,
  :laglac => 1.0,
  :ktype => 0.0f0,
  :pp_fl => [0.99459267,4.2806373,11.122996,23.14909,42.585,73.55228,121.53176,192.91608,295.71387,440.0099,637.48126,901.0901,1245.0629,1684.5829,2235.4373,2913.625,3743.0635,4751.7656,5964.3306,7405.9443,9095.712,11014.257,13051.0,15120.118,17225.555,19367.654,21543.508,23754.443,25999.568,28283.514,30610.25,32980.51,35403.43,37890.7,40447.36,43076.758,45782.133,48561.258,51401.24,54280.47,57167.156,60007.465,62724.316,65223.324,67381.3,69034.87,69983.29],
  :pp_hl => [0.0,1.9891853,6.5720897,15.6739025,30.624279,54.54572,92.55883,150.5047,235.32745,356.10025,523.9195,751.04297,1051.1372,1438.9884,1930.1774,2540.697,3286.553,4199.574,5303.957,6624.704,8187.185,10004.238,12024.276,14077.725,16162.512,18288.6,20446.709,22640.307,24868.58,27130.559,29436.47,31784.027,34176.996,36629.867,39151.53,41743.184,44410.336,47153.934,49968.582,52833.9,55727.04,58607.27,61407.66,64040.973,66405.67,68356.914,69712.81,70253.77],
  :tk_fl => [191.47856,204.6725,242.06593,268.1703,287.00006,298.96115,298.84537,288.48434,278.9773,270.60324,261.82812,254.09456,248.00613,243.33966,239.54138,236.70612,234.32597,232.60443,231.13396,230.06169,228.87677,227.51752,225.00604,221.9622,219.19379,216.18832,214.0565,212.91684,213.03142,213.90471,215.7798,218.17755,220.85512,223.7455,226.71996,229.71678,232.54152,235.60298,238.69757,241.82301,244.4456,246.90468,248.72021,249.8677,248.25815,244.38974,240.1063],
  :tk_hl => [182.88487,200.07224,225.86678,256.65552,278.24084,293.22968,298.90094,293.4551,283.5555,274.64706,266.0663,257.83093,250.9487,245.59578,241.3784,238.07788,235.48732,233.4444,231.85143,230.58485,229.45306,228.1681,226.16574,223.3838,220.50142,217.61429,215.0744,213.46332,212.97629,213.48224,214.87091,217.01189,219.54723,222.32938,225.26091,228.24403,231.1522,234.0978,237.18045,240.29532,243.1712,245.72221,247.86043,249.33595,248.97289,245.95312,241.316,238.69362],
  :xm_vap => [2.3965124e-6,2.3969997e-6,2.3972182e-6,2.3975854e-6,2.397729e-6,2.398413e-6,2.3988835e-6,2.400685e-6,2.4015133e-6,2.401896e-6,2.4022083e-6,2.401882e-6,2.4007823e-6,2.3987798e-6,2.3971083e-6,2.3883529e-6,2.360518e-6,2.29728e-6,2.2866352e-6,2.2731363e-6,2.2388433e-6,2.2689842e-6,2.4415554e-6,3.0612543e-6,4.899116e-6,9.070369e-6,1.418572e-5,1.8772378e-5,2.0645355e-5,2.3563349e-5,2.791322e-5,3.2265354e-5,3.906334e-5,4.874087e-5,6.208879e-5,8.123742e-5,0.00010691009,0.00014492523,0.0001765416,0.00020692483,0.0002399124,0.000323905,0.0003517731,0.00042887547,0.00044361732,0.00031653437,0.000210945],
  :xm_liq => [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],
  :xm_ice => [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],
  :cdnc => [5.0e7,5.0e7,5.0e7,5.0e7,5.0e7,5.0e7,5.0e7,5.0e7,5.0e7,5.0e7,5.0e7,5.0e7,5.0e7,5.0e7,5.0e7,5.0e7,5.0e7,5.0e7,5.0e7,5.0e7,5.0e7,5.0e7,5.0e7,5.0e7,5.0e7,5.0000004e7,5.000008e7,5.00009e7,5.0005856e7,5.002539e7,5.008188e7,5.0211364e7,5.0461268e7,5.0884956e7,5.1532864e7,5.2444948e7,5.3645944e7,5.51404e7,5.690794e7,5.8904636e7,6.106603e7,6.330352e7,6.5509104e7,6.756719e7,6.9350696e7,7.071377e7,7.149221e7],
  :cld_frc => [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0],
  :xm_o3 => [1.4361512e-8,2.4287866e-7,7.169853e-7,1.5260795e-6,2.6887649e-6,4.0639648e-6,5.6976996e-6,6.9535104e-6,7.711255e-6,7.817753e-6,7.639596e-6,7.297698e-6,6.914997e-6,6.484024e-6,5.997439e-6,5.497143e-6,4.9466153e-6,4.3028817e-6,3.595538e-6,2.8798336e-6,2.2716085e-6,1.8602751e-6,1.5622179e-6,1.2003655e-6,9.4663767e-7,7.497841e-7,5.807476e-7,4.4064763e-7,3.3569154e-7,2.5693802e-7,2.117891e-7,1.7421812e-7,1.5108354e-7,1.2967793e-7,1.1386697e-7,9.9419225e-8,8.775837e-8,7.8342296e-8,7.034802e-8,6.790383e-8,6.545331e-8,6.336153e-8,6.149029e-8,5.976909e-8,5.8166282e-8,5.687892e-8,5.6140543e-8],
  :xm_co2 => CO2s,
  :xm_ch4 => [5.479482e-8,5.507132e-8,5.5959013e-8,5.809487e-8,6.249989e-8,7.101216e-8,8.6212225e-8,1.1062362e-7,1.454805e-7,1.892554e-7,2.3715519e-7,2.8306903e-7,3.224402e-7,3.535077e-7,3.7670884e-7,3.9349067e-7,4.0553851e-7,4.1418386e-7,4.203778e-7,4.2482995e-7,4.280412e-7,4.3033953e-7,4.3193793e-7,4.3305616e-7,4.338759e-7,4.3449793e-7,4.3498247e-7,4.3536875e-7,4.3568238e-7,4.3594156e-7,4.361589e-7,4.3634324e-7,4.3650167e-7,4.3663945e-7,4.3676025e-7,4.3686683e-7,4.3696141e-7,4.370456e-7,4.371205e-7,4.3718697e-7,4.3724566e-7,4.3729685e-7,4.373407e-7,4.373772e-7,4.3740613e-7,4.3742682e-7,4.3743816e-7],
  :xm_n2o => [5.037719e-9,5.1476334e-9,5.5011875e-9,6.3561267e-9,8.138623e-9,1.1658466e-8,1.8202797e-8,2.946878e-8,4.7403056e-8,7.3675906e-8,1.0863518e-7,1.5045211e-7,1.953296e-7,2.3884098e-7,2.775271e-7,3.09684e-7,3.3536995e-7,3.5534396e-7,3.7053502e-7,3.8194537e-7,3.9044562e-7,3.9667432e-7,4.0107975e-7,4.041983e-7,4.0650391e-7,4.0826458e-7,4.0964275e-7,4.1074568e-7,4.1164395e-7,4.1238815e-7,4.1301357e-7,4.1354497e-7,4.140023e-7,4.144006e-7,4.1475022e-7,4.1505902e-7,4.1533323e-7,4.1557752e-7,4.1579506e-7,4.159882e-7,4.1615883e-7,4.163078e-7,4.1643537e-7,4.165416e-7,4.1662585e-7,4.1668616e-7,4.1671922e-7],
  :solar_constant => psctm,
  # :zi0 => 537.43243f0, # 1
  :zi0 => 536.4534f0, # 2
  # :cos_mu0 => 0.3906923f0,
  :cos_mu0m => 0.38647282f0,
  :alb => 0.85f0,
  :aer_tau_lw_vr => [0.000163688 0.000163688 0.000233321 0.000233321 0.000233321 0.000136998 9.22467e-5 0.000136998 0.000163688 0.000163688 0.000163688 0.000163688 0.000163688 0.000163688 0.000163688 0.000163688; 0.00037282 0.00037282 0.000530594 0.000530594 0.000530594 0.000312537 0.000211845 0.000312537 0.00037282 0.00037282 0.00037282 0.00037282 0.00037282 0.00037282 0.00037282 0.00037282; 0.000457364 0.000457364 0.000648994 0.000648994 0.000648994 0.000384582 0.000263936 0.000384582 0.000457364 0.000457364 0.000457364 0.000457364 0.000457364 0.000457364 0.000457364 0.000457364; 0.000446804 0.000446804 0.000630953 0.000630953 0.000630953 0.000377571 0.000264291 0.000377571 0.000446804 0.000446804 0.000446804 0.000446804 0.000446804 0.000446804 0.000446804 0.000446804; 0.000383795 0.000383795 0.000538013 0.000538013 0.000538013 0.000326975 0.000235754 0.000326975 0.000383795 0.000383795 0.000383795 0.000383795 0.000383795 0.000383795 0.000383795 0.000383795; 0.000304529 0.000304529 0.000422326 0.000422326 0.000422326 0.000262998 0.000197949 0.000262998 0.000304529 0.000304529 0.000304529 0.000304529 0.000304529 0.000304529 0.000304529 0.000304529; 0.000228819 0.000228819 0.000312486 0.000312486 0.000312486 0.000202051 0.000161373 0.000202051 0.000228819 0.000228819 0.000228819 0.000228819 0.000228819 0.000228819 0.000228819 0.000228819; 0.000166785 0.000166785 0.000223045 0.000223045 0.000223045 0.000152716 0.00013177 0.000152716 0.000166785 0.000166785 0.000166785 0.000166785 0.000166785 0.000166785 0.000166785 0.000166785; 0.000121073 0.000121073 0.000157734 0.000157734 0.000157734 0.000117591 0.000111306 0.000117591 0.000121073 0.000121073 0.000121073 0.000121073 0.000121073 0.000121073 0.000121073 0.000121073; 8.98286e-5 8.98286e-5 0.000113835 0.000113835 0.000113835 9.55762e-5 9.97526e-5 9.55762e-5 8.98286e-5 8.98286e-5 8.98286e-5 8.98286e-5 8.98286e-5 8.98286e-5 8.98286e-5 8.98286e-5; 6.96389e-5 6.96389e-5 8.64545e-5 8.64545e-5 8.64545e-5 8.41189e-5 9.57215e-5 8.41189e-5 6.96389e-5 6.96389e-5 6.96389e-5 6.96389e-5 6.96389e-5 6.96389e-5 6.96389e-5 6.96389e-5; 5.7651e-5 5.7651e-5 7.15062e-5 7.15062e-5 7.15062e-5 8.15166e-5 9.8745e-5 8.15166e-5 5.7651e-5 5.7651e-5 5.7651e-5 5.7651e-5 5.7651e-5 5.7651e-5 5.7651e-5 5.7651e-5; 5.14932e-5 5.14932e-5 6.58367e-5 6.58367e-5 6.58367e-5 8.71413e-5 0.000109454 8.71413e-5 5.14932e-5 5.14932e-5 5.14932e-5 5.14932e-5 5.14932e-5 5.14932e-5 5.14932e-5 5.14932e-5; 4.96293e-5 4.96293e-5 6.76147e-5 6.76147e-5 6.76147e-5 0.000101455 0.000129444 0.000101455 4.96293e-5 4.96293e-5 4.96293e-5 4.96293e-5 4.96293e-5 4.96293e-5 4.96293e-5 4.96293e-5; 5.09632e-5 5.09632e-5 7.56107e-5 7.56107e-5 7.56107e-5 0.000124868 0.000159898 0.000124868 5.09632e-5 5.09632e-5 5.09632e-5 5.09632e-5 5.09632e-5 5.09632e-5 5.09632e-5 5.09632e-5; 5.50109e-5 5.50109e-5 8.93641e-5 8.93641e-5 8.93641e-5 0.000158189 0.000202276 0.000158189 5.50109e-5 5.50109e-5 5.50109e-5 5.50109e-5 5.50109e-5 5.50109e-5 5.50109e-5 5.50109e-5; 6.12407e-5 6.12407e-5 0.000107941 0.000107941 0.000107941 0.000200496 0.00025569 0.000200496 6.12407e-5 6.12407e-5 6.12407e-5 6.12407e-5 6.12407e-5 6.12407e-5 6.12407e-5 6.12407e-5; 6.76463e-5 6.76463e-5 0.000126538 0.000126538 0.000126538 0.000242135 0.000308128 0.000242135 6.76463e-5 6.76463e-5 6.76463e-5 6.76463e-5 6.76463e-5 6.76463e-5 6.76463e-5 6.76463e-5; 7.12074e-5 7.12074e-5 0.000137325 0.000137325 0.000137325 0.00026646 0.000338706 0.00026646 7.12074e-5 7.12074e-5 7.12074e-5 7.12074e-5 7.12074e-5 7.12074e-5 7.12074e-5 7.12074e-5; 7.15445e-5 7.15445e-5 0.000139074 0.000139074 0.000139074 0.000270797 0.000344121 0.000270797 7.15445e-5 7.15445e-5 7.15445e-5 7.15445e-5 7.15445e-5 7.15445e-5 7.15445e-5 7.15445e-5; 7.04312e-5 7.04312e-5 0.00013691 0.00013691 0.00013691 0.000266583 0.000338766 0.000266583 7.04312e-5 7.04312e-5 7.04312e-5 7.04312e-5 7.04312e-5 7.04312e-5 7.04312e-5 7.04312e-5; 6.92917e-5 6.92917e-5 0.000134695 0.000134695 0.000134695 0.000262271 0.000333286 0.000262271 6.92917e-5 6.92917e-5 6.92917e-5 6.92917e-5 6.92917e-5 6.92917e-5 6.92917e-5 6.92917e-5; 6.82636e-5 6.82636e-5 0.000132696 0.000132696 0.000132696 0.000258379 0.00032834 0.000258379 6.82636e-5 6.82636e-5 6.82636e-5 6.82636e-5 6.82636e-5 6.82636e-5 6.82636e-5 6.82636e-5; 6.69375e-5 6.69375e-5 0.000130119 0.000130119 0.000130119 0.00025336 0.000321962 0.00025336 6.69375e-5 6.69375e-5 6.69375e-5 6.69375e-5 6.69375e-5 6.69375e-5 6.69375e-5 6.69375e-5; 6.59313e-5 6.59313e-5 0.000128163 0.000128163 0.000128163 0.000249551 0.000317122 0.000249551 6.59313e-5 6.59313e-5 6.59313e-5 6.59313e-5 6.59313e-5 6.59313e-5 6.59313e-5 6.59313e-5; 6.48586e-5 6.48586e-5 0.000126077 0.000126077 0.000126077 0.000245491 0.000311963 0.000245491 6.48586e-5 6.48586e-5 6.48586e-5 6.48586e-5 6.48586e-5 6.48586e-5 6.48586e-5 6.48586e-5; 5.83412e-5 5.83412e-5 0.000113408 0.000113408 0.000113408 0.000220823 0.000280615 0.000220823 5.83412e-5 5.83412e-5 5.83412e-5 5.83412e-5 5.83412e-5 5.83412e-5 5.83412e-5 5.83412e-5; 5.01675e-5 5.01675e-5 9.75197e-5 9.75197e-5 9.75197e-5 0.000189885 0.0002413 0.000189885 5.01675e-5 5.01675e-5 5.01675e-5 5.01675e-5 5.01675e-5 5.01675e-5 5.01675e-5 5.01675e-5; 4.2406e-5 4.2406e-5 8.24322e-5 8.24322e-5 8.24322e-5 0.000160508 0.000203968 0.000160508 4.2406e-5 4.2406e-5 4.2406e-5 4.2406e-5 4.2406e-5 4.2406e-5 4.2406e-5 4.2406e-5; 3.54591e-5 3.54591e-5 6.89282e-5 6.89282e-5 6.89282e-5 0.000134213 0.000170554 0.000134213 3.54591e-5 3.54591e-5 3.54591e-5 3.54591e-5 3.54591e-5 3.54591e-5 3.54591e-5 3.54591e-5; 2.93149e-5 2.93149e-5 5.69847e-5 5.69847e-5 5.69847e-5 0.000110958 0.000141002 0.000110958 2.93149e-5 2.93149e-5 2.93149e-5 2.93149e-5 2.93149e-5 2.93149e-5 2.93149e-5 2.93149e-5; 2.39476e-5 2.39476e-5 4.65514e-5 4.65514e-5 4.65514e-5 9.06423e-5 0.000115186 9.06423e-5 2.39476e-5 2.39476e-5 2.39476e-5 2.39476e-5 2.39476e-5 2.39476e-5 2.39476e-5 2.39476e-5; 1.96023e-5 1.96023e-5 3.81046e-5 3.81046e-5 3.81046e-5 7.41952e-5 9.4285e-5 7.41952e-5 1.96023e-5 1.96023e-5 1.96023e-5 1.96023e-5 1.96023e-5 1.96023e-5 1.96023e-5 1.96023e-5; 1.57709e-5 1.57709e-5 3.06567e-5 3.06567e-5 3.06567e-5 5.96932e-5 7.58563e-5 5.96932e-5 1.57709e-5 1.57709e-5 1.57709e-5 1.57709e-5 1.57709e-5 1.57709e-5 1.57709e-5 1.57709e-5; 1.2453e-5 1.2453e-5 2.42071e-5 2.42071e-5 2.42071e-5 4.71348e-5 5.98974e-5 4.71348e-5 1.2453e-5 1.2453e-5 1.2453e-5 1.2453e-5 1.2453e-5 1.2453e-5 1.2453e-5 1.2453e-5; 9.63531e-6 9.63531e-6 1.87299e-5 1.87299e-5 1.87299e-5 3.64698e-5 4.63448e-5 3.64698e-5 9.63531e-6 9.63531e-6 9.63531e-6 9.63531e-6 9.63531e-6 9.63531e-6 9.63531e-6 9.63531e-6; 7.29239e-6 7.29239e-6 1.41755e-5 1.41755e-5 1.41755e-5 2.76018e-5 3.50756e-5 2.76018e-5 7.29239e-6 7.29239e-6 7.29239e-6 7.29239e-6 7.29239e-6 7.29239e-6 7.29239e-6 7.29239e-6; 5.38827e-6 5.38827e-6 1.04742e-5 1.04742e-5 1.04742e-5 2.03947e-5 2.5917e-5 2.03947e-5 5.38827e-6 5.38827e-6 5.38827e-6 5.38827e-6 5.38827e-6 5.38827e-6 5.38827e-6 5.38827e-6; 3.87773e-6 3.87773e-6 7.53783e-6 7.53783e-6 7.53783e-6 1.46773e-5 1.86514e-5 1.46773e-5 3.87773e-6 3.87773e-6 3.87773e-6 3.87773e-6 3.87773e-6 3.87773e-6 3.87773e-6 3.87773e-6; 2.72346e-6 2.72346e-6 5.29407e-6 5.29407e-6 5.29407e-6 1.03083e-5 1.30995e-5 1.03083e-5 2.72346e-6 2.72346e-6 2.72346e-6 2.72346e-6 2.72346e-6 2.72346e-6 2.72346e-6 2.72346e-6; 1.8605e-6 1.8605e-6 3.6166e-6 3.6166e-6 3.6166e-6 7.04204e-6 8.94881e-6 7.04204e-6 1.8605e-6 1.8605e-6 1.8605e-6 1.8605e-6 1.8605e-6 1.8605e-6 1.8605e-6 1.8605e-6; 1.22051e-6 1.22051e-6 2.37253e-6 2.37253e-6 2.37253e-6 4.61965e-6 5.87052e-6 4.61965e-6 1.22051e-6 1.22051e-6 1.22051e-6 1.22051e-6 1.22051e-6 1.22051e-6 1.22051e-6 1.22051e-6; 7.6806e-7 7.6806e-7 1.49302e-6 1.49302e-6 1.49302e-6 2.90712e-6 3.69428e-6 2.90712e-6 7.6806e-7 7.6806e-7 7.6806e-7 7.6806e-7 7.6806e-7 7.6806e-7 7.6806e-7 7.6806e-7; 4.80021e-7 4.80021e-7 9.33103e-7 9.33103e-7 9.33103e-7 1.81689e-6 2.30885e-6 1.81689e-6 4.80021e-7 4.80021e-7 4.80021e-7 4.80021e-7 4.80021e-7 4.80021e-7 4.80021e-7 4.80021e-7; 2.92237e-7 2.92237e-7 5.68075e-7 5.68075e-7 5.68075e-7 1.10612e-6 1.40563e-6 1.10612e-6 2.92237e-7 2.92237e-7 2.92237e-7 2.92237e-7 2.92237e-7 2.92237e-7 2.92237e-7 2.92237e-7; 1.47146e-7 1.47146e-7 2.86034e-7 2.86034e-7 2.86034e-7 5.56951e-7 7.07756e-7 5.56951e-7 1.47146e-7 1.47146e-7 1.47146e-7 1.47146e-7 1.47146e-7 1.47146e-7 1.47146e-7 1.47146e-7; 6.3868e-8 6.3868e-8 1.24152e-7 1.24152e-7 1.24152e-7 2.41742e-7 3.07198e-7 2.41742e-7 6.3868e-8 6.3868e-8 6.3868e-8 6.3868e-8 6.3868e-8 6.3868e-8 6.3868e-8 6.3868e-8],
  :aer_tau_sw_vr => [0.00130065 0.00130065 0.00130065 0.00130065 0.00130065 0.00130065 0.00130065 0.00130065 0.00130065 0.00130065 0.00130065 0.00130065 0.00130065 0.00130065; 0.00298419 0.00298419 0.00298419 0.00298419 0.00298419 0.00298419 0.00298419 0.00298419 0.00298419 0.00298419 0.00298419 0.00298419 0.00298419 0.00298419; 0.00371159 0.00371159 0.00371159 0.00371159 0.00371159 0.00371159 0.00371159 0.00371159 0.00371159 0.00371159 0.00371159 0.00371159 0.00371159 0.00371159; 0.00370657 0.00370657 0.00370657 0.00370657 0.00370657 0.00370657 0.00370657 0.00370657 0.00370657 0.00370657 0.00370657 0.00370657 0.00370657 0.00370657; 0.00329231 0.00329231 0.00329231 0.00329231 0.00329231 0.00329231 0.00329231 0.00329231 0.00329231 0.00329231 0.00329231 0.00329231 0.00329231 0.00329231; 0.00274581 0.00274581 0.00274581 0.00274581 0.00274581 0.00274581 0.00274581 0.00274581 0.00274581 0.00274581 0.00274581 0.00274581 0.00274581 0.00274581; 0.00221599 0.00221599 0.00221599 0.00221599 0.00221599 0.00221599 0.00221599 0.00221599 0.00221599 0.00221599 0.00221599 0.00221599 0.00221599 0.00221599; 0.00178312 0.00178312 0.00178312 0.00178312 0.00178312 0.00178312 0.00178312 0.00178312 0.00178312 0.00178312 0.00178312 0.00178312 0.00178312 0.00178312; 0.00147534 0.00147534 0.00147534 0.00147534 0.00147534 0.00147534 0.00147534 0.00147534 0.00147534 0.00147534 0.00147534 0.00147534 0.00147534 0.00147534; 0.00128674 0.00128674 0.00128674 0.00128674 0.00128674 0.00128674 0.00128674 0.00128674 0.00128674 0.00128674 0.00128674 0.00128674 0.00128674 0.00128674; 0.00119585 0.00119585 0.00119585 0.00119585 0.00119585 0.00119585 0.00119585 0.00119585 0.00119585 0.00119585 0.00119585 0.00119585 0.00119585 0.00119585; 0.00119188 0.00119188 0.00119188 0.00119188 0.00119188 0.00119188 0.00119188 0.00119188 0.00119188 0.00119188 0.00119188 0.00119188 0.00119188 0.00119188; 0.00127527 0.00127527 0.00127527 0.00127527 0.00127527 0.00127527 0.00127527 0.00127527 0.00127527 0.00127527 0.00127527 0.00127527 0.00127527 0.00127527; 0.00145761 0.00145761 0.00145761 0.00145761 0.00145761 0.00145761 0.00145761 0.00145761 0.00145761 0.00145761 0.00145761 0.00145761 0.00145761 0.00145761; 0.0017473 0.0017473 0.0017473 0.0017473 0.0017473 0.0017473 0.0017473 0.0017473 0.0017473 0.0017473 0.0017473 0.0017473 0.0017473 0.0017473; 0.00215734 0.00215734 0.00215734 0.00215734 0.00215734 0.00215734 0.00215734 0.00215734 0.00215734 0.00215734 0.00215734 0.00215734 0.00215734 0.00215734; 0.00267823 0.00267823 0.00267823 0.00267823 0.00267823 0.00267823 0.00267823 0.00267823 0.00267823 0.00267823 0.00267823 0.00267823 0.00267823 0.00267823; 0.00319045 0.00319045 0.00319045 0.00319045 0.00319045 0.00319045 0.00319045 0.00319045 0.00319045 0.00319045 0.00319045 0.00319045 0.00319045 0.00319045; 0.00348791 0.00348791 0.00348791 0.00348791 0.00348791 0.00348791 0.00348791 0.00348791 0.00348791 0.00348791 0.00348791 0.00348791 0.00348791 0.00348791; 0.00353878 0.00353878 0.00353878 0.00353878 0.00353878 0.00353878 0.00353878 0.00353878 0.00353878 0.00353878 0.00353878 0.00353878 0.00353878 0.00353878; 0.00348371 0.00348371 0.00348371 0.00348371 0.00348371 0.00348371 0.00348371 0.00348371 0.00348371 0.00348371 0.00348371 0.00348371 0.00348371 0.00348371; 0.00342735 0.00342735 0.00342735 0.00342735 0.00342735 0.00342735 0.00342735 0.00342735 0.00342735 0.00342735 0.00342735 0.00342735 0.00342735 0.00342735; 0.00337649 0.00337649 0.00337649 0.00337649 0.00337649 0.00337649 0.00337649 0.00337649 0.00337649 0.00337649 0.00337649 0.00337649 0.00337649 0.00337649; 0.0033109 0.0033109 0.0033109 0.0033109 0.0033109 0.0033109 0.0033109 0.0033109 0.0033109 0.0033109 0.0033109 0.0033109 0.0033109 0.0033109; 0.00326113 0.00326113 0.00326113 0.00326113 0.00326113 0.00326113 0.00326113 0.00326113 0.00326113 0.00326113 0.00326113 0.00326113 0.00326113 0.00326113; 0.00320807 0.00320807 0.00320807 0.00320807 0.00320807 0.00320807 0.00320807 0.00320807 0.00320807 0.00320807 0.00320807 0.00320807 0.00320807 0.00320807; 0.00288571 0.00288571 0.00288571 0.00288571 0.00288571 0.00288571 0.00288571 0.00288571 0.00288571 0.00288571 0.00288571 0.00288571 0.00288571 0.00288571; 0.00248142 0.00248142 0.00248142 0.00248142 0.00248142 0.00248142 0.00248142 0.00248142 0.00248142 0.00248142 0.00248142 0.00248142 0.00248142 0.00248142; 0.00209751 0.00209751 0.00209751 0.00209751 0.00209751 0.00209751 0.00209751 0.00209751 0.00209751 0.00209751 0.00209751 0.00209751 0.00209751 0.00209751; 0.0017539 0.0017539 0.0017539 0.0017539 0.0017539 0.0017539 0.0017539 0.0017539 0.0017539 0.0017539 0.0017539 0.0017539 0.0017539 0.0017539; 0.00144999 0.00144999 0.00144999 0.00144999 0.00144999 0.00144999 0.00144999 0.00144999 0.00144999 0.00144999 0.00144999 0.00144999 0.00144999 0.00144999; 0.00118451 0.00118451 0.00118451 0.00118451 0.00118451 0.00118451 0.00118451 0.00118451 0.00118451 0.00118451 0.00118451 0.00118451 0.00118451 0.00118451; 0.000969582 0.000969582 0.000969582 0.000969582 0.000969582 0.000969582 0.000969582 0.000969582 0.000969582 0.000969582 0.000969582 0.000969582 0.000969582 0.000969582; 0.00078007 0.00078007 0.00078007 0.00078007 0.00078007 0.00078007 0.00078007 0.00078007 0.00078007 0.00078007 0.00078007 0.00078007 0.00078007 0.00078007; 0.000615956 0.000615956 0.000615956 0.000615956 0.000615956 0.000615956 0.000615956 0.000615956 0.000615956 0.000615956 0.000615956 0.000615956 0.000615956 0.000615956; 0.000476587 0.000476587 0.000476587 0.000476587 0.000476587 0.000476587 0.000476587 0.000476587 0.000476587 0.000476587 0.000476587 0.000476587 0.000476587 0.000476587; 0.000360701 0.000360701 0.000360701 0.000360701 0.000360701 0.000360701 0.000360701 0.000360701 0.000360701 0.000360701 0.000360701 0.000360701 0.000360701 0.000360701; 0.000266518 0.000266518 0.000266518 0.000266518 0.000266518 0.000266518 0.000266518 0.000266518 0.000266518 0.000266518 0.000266518 0.000266518 0.000266518 0.000266518; 0.000191802 0.000191802 0.000191802 0.000191802 0.000191802 0.000191802 0.000191802 0.000191802 0.000191802 0.000191802 0.000191802 0.000191802 0.000191802 0.000191802; 0.000134709 0.000134709 0.000134709 0.000134709 0.000134709 0.000134709 0.000134709 0.000134709 0.000134709 0.000134709 0.000134709 0.000134709 0.000134709 0.000134709; 9.20253e-5 9.20253e-5 9.20253e-5 9.20253e-5 9.20253e-5 9.20253e-5 9.20253e-5 9.20253e-5 9.20253e-5 9.20253e-5 9.20253e-5 9.20253e-5 9.20253e-5 9.20253e-5; 6.03696e-5 6.03696e-5 6.03696e-5 6.03696e-5 6.03696e-5 6.03696e-5 6.03696e-5 6.03696e-5 6.03696e-5 6.03696e-5 6.03696e-5 6.03696e-5 6.03696e-5 6.03696e-5; 3.79902e-5 3.79902e-5 3.79902e-5 3.79902e-5 3.79902e-5 3.79902e-5 3.79902e-5 3.79902e-5 3.79902e-5 3.79902e-5 3.79902e-5 3.79902e-5 3.79902e-5 3.79902e-5; 2.37431e-5 2.37431e-5 2.37431e-5 2.37431e-5 2.37431e-5 2.37431e-5 2.37431e-5 2.37431e-5 2.37431e-5 2.37431e-5 2.37431e-5 2.37431e-5 2.37431e-5 2.37431e-5; 1.44548e-5 1.44548e-5 1.44548e-5 1.44548e-5 1.44548e-5 1.44548e-5 1.44548e-5 1.44548e-5 1.44548e-5 1.44548e-5 1.44548e-5 1.44548e-5 1.44548e-5 1.44548e-5; 7.27823e-6 7.27823e-6 7.27823e-6 7.27823e-6 7.27823e-6 7.27823e-6 7.27823e-6 7.27823e-6 7.27823e-6 7.27823e-6 7.27823e-6 7.27823e-6 7.27823e-6 7.27823e-6; 3.15908e-6 3.15908e-6 3.15908e-6 3.15908e-6 3.15908e-6 3.15908e-6 3.15908e-6 3.15908e-6 3.15908e-6 3.15908e-6 3.15908e-6 3.15908e-6 3.15908e-6 3.15908e-6],
  :aer_piz_sw_vr => [0.966956 0.966956 0.966956 0.966956 0.966956 0.966956 0.966956 0.966956 0.966956 0.966956 0.966956 0.966956 0.966956 0.966956; 0.965868 0.965868 0.965868 0.965868 0.965868 0.965868 0.965868 0.965868 0.965868 0.965868 0.965868 0.965868 0.965868 0.965868; 0.963849 0.963849 0.963849 0.963849 0.963849 0.963849 0.963849 0.963849 0.963849 0.963849 0.963849 0.963849 0.963849 0.963849; 0.960674 0.960674 0.960674 0.960674 0.960674 0.960674 0.960674 0.960674 0.960674 0.960674 0.960674 0.960674 0.960674 0.960674; 0.956139 0.956139 0.956139 0.956139 0.956139 0.956139 0.956139 0.956139 0.956139 0.956139 0.956139 0.956139 0.956139 0.956139; 0.95008 0.95008 0.95008 0.95008 0.95008 0.95008 0.95008 0.95008 0.95008 0.95008 0.95008 0.95008 0.95008 0.95008; 0.942548 0.942548 0.942548 0.942548 0.942548 0.942548 0.942548 0.942548 0.942548 0.942548 0.942548 0.942548 0.942548 0.942548; 0.934208 0.934208 0.934208 0.934208 0.934208 0.934208 0.934208 0.934208 0.934208 0.934208 0.934208 0.934208 0.934208 0.934208; 0.92665 0.92665 0.92665 0.92665 0.92665 0.92665 0.92665 0.92665 0.92665 0.92665 0.92665 0.92665 0.92665 0.92665; 0.922148 0.922148 0.922148 0.922148 0.922148 0.922148 0.922148 0.922148 0.922148 0.922148 0.922148 0.922148 0.922148 0.922148; 0.922525 0.922525 0.922525 0.922525 0.922525 0.922525 0.922525 0.922525 0.922525 0.922525 0.922525 0.922525 0.922525 0.922525; 0.928301 0.928301 0.928301 0.928301 0.928301 0.928301 0.928301 0.928301 0.928301 0.928301 0.928301 0.928301 0.928301 0.928301; 0.938875 0.938875 0.938875 0.938875 0.938875 0.938875 0.938875 0.938875 0.938875 0.938875 0.938875 0.938875 0.938875 0.938875; 0.95238 0.95238 0.95238 0.95238 0.95238 0.95238 0.95238 0.95238 0.95238 0.95238 0.95238 0.95238 0.95238 0.95238; 0.966211 0.966211 0.966211 0.966211 0.966211 0.966211 0.966211 0.966211 0.966211 0.966211 0.966211 0.966211 0.966211 0.966211; 0.978409 0.978409 0.978409 0.978409 0.978409 0.978409 0.978409 0.978409 0.978409 0.978409 0.978409 0.978409 0.978409 0.978409; 0.987936 0.987936 0.987936 0.987936 0.987936 0.987936 0.987936 0.987936 0.987936 0.987936 0.987936 0.987936 0.987936 0.987936; 0.994197 0.994197 0.994197 0.994197 0.994197 0.994197 0.994197 0.994197 0.994197 0.994197 0.994197 0.994197 0.994197 0.994197; 0.997211 0.997211 0.997211 0.997211 0.997211 0.997211 0.997211 0.997211 0.997211 0.997211 0.997211 0.997211 0.997211 0.997211; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975; 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975 0.997975],
  :aer_cg_sw_vr => [0.72713 0.72713 0.72713 0.72713 0.72713 0.72713 0.72713 0.72713 0.72713 0.72713 0.72713 0.72713 0.72713 0.72713; 0.726227 0.726227 0.726227 0.726227 0.726227 0.726227 0.726227 0.726227 0.726227 0.726227 0.726227 0.726227 0.726227 0.726227; 0.724543 0.724543 0.724543 0.724543 0.724543 0.724543 0.724543 0.724543 0.724543 0.724543 0.724543 0.724543 0.724543 0.724543; 0.721882 0.721882 0.721882 0.721882 0.721882 0.721882 0.721882 0.721882 0.721882 0.721882 0.721882 0.721882 0.721882 0.721882; 0.717909 0.717909 0.717909 0.717909 0.717909 0.717909 0.717909 0.717909 0.717909 0.717909 0.717909 0.717909 0.717909 0.717909; 0.712172 0.712172 0.712172 0.712172 0.712172 0.712172 0.712172 0.712172 0.712172 0.712172 0.712172 0.712172 0.712172 0.712172; 0.704318 0.704318 0.704318 0.704318 0.704318 0.704318 0.704318 0.704318 0.704318 0.704318 0.704318 0.704318 0.704318 0.704318; 0.694176 0.694176 0.694176 0.694176 0.694176 0.694176 0.694176 0.694176 0.694176 0.694176 0.694176 0.694176 0.694176 0.694176; 0.682049 0.682049 0.682049 0.682049 0.682049 0.682049 0.682049 0.682049 0.682049 0.682049 0.682049 0.682049 0.682049 0.682049; 0.669042 0.669042 0.669042 0.669042 0.669042 0.669042 0.669042 0.669042 0.669042 0.669042 0.669042 0.669042 0.669042 0.669042; 0.656917 0.656917 0.656917 0.656917 0.656917 0.656917 0.656917 0.656917 0.656917 0.656917 0.656917 0.656917 0.656917 0.656917; 0.646979 0.646979 0.646979 0.646979 0.646979 0.646979 0.646979 0.646979 0.646979 0.646979 0.646979 0.646979 0.646979 0.646979; 0.639479 0.639479 0.639479 0.639479 0.639479 0.639479 0.639479 0.639479 0.639479 0.639479 0.639479 0.639479 0.639479 0.639479; 0.634081 0.634081 0.634081 0.634081 0.634081 0.634081 0.634081 0.634081 0.634081 0.634081 0.634081 0.634081 0.634081 0.634081; 0.630312 0.630312 0.630312 0.630312 0.630312 0.630312 0.630312 0.630312 0.630312 0.630312 0.630312 0.630312 0.630312 0.630312; 0.627708 0.627708 0.627708 0.627708 0.627708 0.627708 0.627708 0.627708 0.627708 0.627708 0.627708 0.627708 0.627708 0.627708; 0.625945 0.625945 0.625945 0.625945 0.625945 0.625945 0.625945 0.625945 0.625945 0.625945 0.625945 0.625945 0.625945 0.625945; 0.62487 0.62487 0.62487 0.62487 0.62487 0.62487 0.62487 0.62487 0.62487 0.62487 0.62487 0.62487 0.62487 0.62487; 0.624371 0.624371 0.624371 0.624371 0.624371 0.624371 0.624371 0.624371 0.624371 0.624371 0.624371 0.624371 0.624371 0.624371; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246; 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246 0.624246]
)

# output = radiation(atmosphere_90S, SW_correction=false, output_type=:profile)
# @test output[:LW_up] ≈ [183.779, 184.637, 188.548, 193.32, 195.981, 195.982, 194.792, 192.826, 190.433, 187.698, 184.991, 182.499, 180.226, 178.055, 176.022, 174.146, 172.448, 170.929, 169.681, 168.771, 168.172, 167.996, 168.173, 168.617, 169.158, 169.827, 170.471, 170.931, 171.31, 171.635, 171.979, 172.344, 172.751, 173.193, 173.683, 174.208, 174.777, 175.382, 175.971, 176.489, 176.955, 177.329, 177.442, 177.373, 177.261, 177.166, 177.12, 177.103] atol=.002
# @test output[:LW_dn] ≈ [112.055, 113.346, 114.987, 113.769, 108.874, 102.472, 94.8578, 87.6185, 80.1781, 72.8776, 65.9497, 59.8909, 54.4063, 49.5301, 45.2257, 41.458, 38.1442, 35.1705, 32.6112, 30.319, 28.1725, 26.3, 24.7902, 23.711, 22.8125, 21.7024, 20.1645, 18.4649, 16.6568, 14.8621, 13.1221, 11.5106, 10.0582, 8.77109, 7.6215, 6.5862, 5.65091, 4.82217, 4.03554, 3.24048, 2.42131, 1.57102, 0.88219, 0.441359, 0.18487, 0.0546009, 0.0216264, 0.0] atol=.002
# @test output[:SW_up] ≈ Float32[401.781, 401.779, 401.775, 401.767, 401.756, 401.741, 401.724, 401.71, 401.703, 401.704, 401.71, 401.716, 401.716, 401.705, 401.675, 401.615, 401.512, 401.347, 401.089, 400.703, 400.152, 399.422, 398.565, 397.656, 396.679, 395.652, 394.593, 393.506, 392.396, 391.291, 390.25, 389.326, 388.521, 387.815, 387.188, 386.625, 386.12, 385.671, 385.295, 384.981, 384.726, 384.533, 384.512, 384.553, 384.756, 384.972, 384.957, 384.888][end:-1:1] atol=.002
# @test output[:SW_dn] ≈ Float32[543.964, 543.947, 543.921, 543.841, 543.64, 543.177, 542.292, 540.988, 539.572, 538.191, 536.841, 535.481, 534.076, 532.595, 531.024, 529.354, 527.569, 525.631, 523.553, 521.353, 519.05, 516.655, 514.191, 511.858, 509.654, 507.477, 505.241, 502.962, 500.659, 498.426, 496.253, 494.137, 492.079, 490.006, 487.861, 485.591, 483.13, 480.434, 477.419, 474.255, 471.005, 467.701, 464.088, 460.727, 457.488, 454.859, 453.333, 452.809][end:-1:1] atol=.002
# @test output[:LW_up_clr] ≈ [183.779, 184.637, 188.548, 193.32, 195.981, 195.982, 194.792, 192.826, 190.433, 187.698, 184.991, 182.499, 180.226, 178.055, 176.022, 174.146, 172.448, 170.929, 169.681, 168.771, 168.172, 167.996, 168.173, 168.617, 169.158, 169.827, 170.471, 170.931, 171.31, 171.635, 171.979, 172.344, 172.751, 173.193, 173.683, 174.208, 174.777, 175.382, 175.971, 176.489, 176.955, 177.329, 177.442, 177.373, 177.261, 177.166, 177.12, 177.103] atol = .002
# @test output[:LW_dn_clr] ≈ [112.055, 113.346, 114.987, 113.769, 108.874, 102.472, 94.8578, 87.6185, 80.1781, 72.8776, 65.9497, 59.8909, 54.4063, 49.5301, 45.2257, 41.458, 38.1442, 35.1705, 32.6112, 30.319, 28.1725, 26.3, 24.7902, 23.711, 22.8125, 21.7024, 20.1645, 18.4649, 16.6568, 14.8621, 13.1221, 11.5106, 10.0582, 8.77109, 7.6215, 6.5862, 5.65091, 4.82217, 4.03554, 3.24048, 2.42131, 1.57102, 0.88219, 0.441359, 0.18487, 0.0546009, 0.0216264, 0.0] atol = .002
# @test output[:SW_up_clr] ≈ Float32[401.781, 401.779, 401.775, 401.767, 401.756, 401.741, 401.724, 401.71, 401.703, 401.704, 401.71, 401.716, 401.716, 401.705, 401.675, 401.615, 401.512, 401.347, 401.089, 400.703, 400.152, 399.422, 398.565, 397.656, 396.679, 395.652, 394.593, 393.506, 392.396, 391.291, 390.25, 389.326, 388.521, 387.815, 387.188, 386.625, 386.12, 385.671, 385.295, 384.981, 384.726, 384.533, 384.512, 384.553, 384.756, 384.972, 384.957, 384.888][end:-1:1] atol = .002
# @test output[:SW_dn_clr] ≈ Float32[543.964, 543.947, 543.921, 543.841, 543.64, 543.177, 542.292, 540.988, 539.572, 538.191, 536.841, 535.481, 534.076, 532.595, 531.024, 529.354, 527.569, 525.631, 523.553, 521.353, 519.05, 516.655, 514.191, 511.858, 509.654, 507.477, 505.241, 502.962, 500.659, 498.426, 496.253, 494.137, 492.079, 490.006, 487.861, 485.591, 483.13, 480.434, 477.419, 474.255, 471.005, 467.701, 464.088, 460.727, 457.488, 454.859, 453.333, 452.809][end:-1:1] atol = .002
#
# output = radiation(atmosphere_90S, SW_correction=true, output_type=:profile)
# @test output[:LW_up] ≈ [183.779, 184.637, 188.548, 193.32, 195.981, 195.982, 194.792, 192.826, 190.433, 187.698, 184.991, 182.499, 180.226, 178.055, 176.022, 174.146, 172.448, 170.929, 169.681, 168.771, 168.172, 167.996, 168.173, 168.617, 169.158, 169.827, 170.471, 170.931, 171.31, 171.635, 171.979, 172.344, 172.751, 173.193, 173.683, 174.208, 174.777, 175.382, 175.971, 176.489, 176.955, 177.329, 177.442, 177.373, 177.261, 177.166, 177.12, 177.103] atol=.002
# @test output[:LW_dn] ≈ [112.055, 113.346, 114.987, 113.769, 108.874, 102.472, 94.8578, 87.6185, 80.1781, 72.8776, 65.9497, 59.8909, 54.4063, 49.5301, 45.2257, 41.458, 38.1442, 35.1705, 32.6112, 30.319, 28.1725, 26.3, 24.7902, 23.711, 22.8125, 21.7024, 20.1645, 18.4649, 16.6568, 14.8621, 13.1221, 11.5106, 10.0582, 8.77109, 7.6215, 6.5862, 5.65091, 4.82217, 4.03554, 3.24048, 2.42131, 1.57102, 0.88219, 0.441359, 0.18487, 0.0546009, 0.0216264, 0.0] atol=.002
# @test output[:SW_dn] - output[:SW_up] ≈ Float32[143.736, 143.72, 143.698, 143.625, 143.433, 142.981, 142.103, 140.798, 139.374, 137.976, 136.606, 135.225, 133.805, 132.319, 130.761, 129.134, 127.433, 125.64, 123.801, 121.968, 120.196, 118.513, 116.889, 115.448, 114.208, 113.045, 111.855, 110.651, 109.445, 108.304, 107.16, 105.955, 104.689, 103.307, 101.772, 100.046, 98.0696, 95.7973, 93.1298, 90.249, 87.2209, 84.0762, 80.4451, 77.0054, 73.5265, 70.6504, 69.1229, 68.6629][end:-1:1] atol=.002
# @test output[:LW_up_clr] ≈ [183.779, 184.637, 188.548, 193.32, 195.981, 195.982, 194.792, 192.826, 190.433, 187.698, 184.991, 182.499, 180.226, 178.055, 176.022, 174.146, 172.448, 170.929, 169.681, 168.771, 168.172, 167.996, 168.173, 168.617, 169.158, 169.827, 170.471, 170.931, 171.31, 171.635, 171.979, 172.344, 172.751, 173.193, 173.683, 174.208, 174.777, 175.382, 175.971, 176.489, 176.955, 177.329, 177.442, 177.373, 177.261, 177.166, 177.12, 177.103] atol = .002
# @test output[:LW_dn_clr] ≈ [112.055, 113.346, 114.987, 113.769, 108.874, 102.472, 94.8578, 87.6185, 80.1781, 72.8776, 65.9497, 59.8909, 54.4063, 49.5301, 45.2257, 41.458, 38.1442, 35.1705, 32.6112, 30.319, 28.1725, 26.3, 24.7902, 23.711, 22.8125, 21.7024, 20.1645, 18.4649, 16.6568, 14.8621, 13.1221, 11.5106, 10.0582, 8.77109, 7.6215, 6.5862, 5.65091, 4.82217, 4.03554, 3.24048, 2.42131, 1.57102, 0.88219, 0.441359, 0.18487, 0.0546009, 0.0216264, 0.0] atol = .002
# @test output[:SW_dn_clr] - output[:SW_up_clr] ≈ Float32[143.736, 143.72, 143.698, 143.625, 143.433, 142.981, 142.103, 140.798, 139.374, 137.976, 136.606, 135.225, 133.805, 132.319, 130.761, 129.134, 127.433, 125.64, 123.801, 121.968, 120.196, 118.513, 116.889, 115.448, 114.208, 113.045, 111.855, 110.651, 109.445, 108.304, 107.16, 105.955, 104.689, 103.307, 101.772, 100.046, 98.0696, 95.7973, 93.1298, 90.249, 87.2209, 84.0762, 80.4451, 77.0054, 73.5265, 70.6504, 69.1229, 68.6629][end:-1:1] atol = .002
#
# output = radiation(atmosphere_90S, SW_correction=false, output_type=:flux)
# @test output[:LW_up_toa] ≈ [-177.103] atol=.002
# @test output[:SW_up_toa] ≈ [-401.781] atol=.002
# @test output[:SW_dn_toa] ≈ [543.964] atol=.002
# @test output[:LW_up_clr_toa] ≈ [-177.103] atol=.002
# @test output[:SW_up_clr_toa] ≈ [-401.781] atol=.002
#
output = radiation(atmosphere_90S, SW_correction=true, output_type=:flux)
# 1 - 140.47597f0
# 2 - 140.22006f0
@test output[:LW_up_toa] ≈ [-177.103] atol=.002
@test output[:SW_dn_toa] + output[:SW_up_toa] ≈ [140.22006f0] atol=.002
@test output[:LW_up_clr_toa] ≈ [-177.103] atol=.002
@test output[:SW_dn_toa] + output[:SW_up_clr_toa] ≈ [140.22006f0] atol=.002


### A Pluto.jl notebook ###
# v0.15.1

using Markdown
using InteractiveUtils

# ╔═╡ d7ff772c-9d33-42e7-9df1-3e02ceee79c5
begin
	using PlutoUI
	PlutoUI.TableOfContents()
end

# ╔═╡ 7553b887-a16d-4f3b-a91b-043f89e963d7
md"""
# Control flow

- [Julia docs | control flow](https://docs.julialang.org/en/v1/manual/control-flow/)
- [Julia docs | functions](https://docs.julialang.org/en/v1/manual/functions/)

Julia programs are able to run nonlinearly by controlling its execution flow.
"""

# ╔═╡ 383e7736-dd64-44ce-ac21-60a9a5a7c0db
md"""
## Conditional statements

Compound expressions are already covered in the previous chapter: [intro to Julia](intro-to-julia.html)

### `if`/`else` block:

```julia
result = if cond1
	run_if_cond1_is_true()
elseif cond2
	run_if_cond2_is_true_and_cond1_is_false()
else
	run_if_neither_is_true()
end
```

- The `elseif` and `else` blocks are optional. `if` and `end` are mandatory.
- `if` blocks return a value. Capturing the value is optional.
- `if` blocks are "leaky", i.e. they do not introduce a local scope. (The same as Python)
- Only boolean (true / false) could be evaluated in `if` blocks. Using other types (e.g. Int) will generate an error.

### Ternary operator

`cond ? tvalue : fvalue` is eqialent to:

```julia
if cond
	tvalue
else
	fvalue
end
```

### ifelse function

All the arguments are evaluated first in `ifelse(cond, tvalue, fvalue)`.

### short cicuit evaluation

`&&` (logical and) and `||` (logical or) operators support [short circuit evaluation](
Short-circuit evaluation - Wikipedia
https://en.wikipedia.org › wiki › Short-circuit_evaluation).

- In the expression `a && b`, the subexpression `b` is only evaluated if `a` evaluates to true.
- In the expression `a || b`, the subexpression `b` is only evaluated if `a` evaluates to false.
"""

# ╔═╡ 0335796f-da7d-4acc-be19-a0b45cd6042a
true && 1  # && evaluates and returns the second argument if the first is true

# ╔═╡ 2ee995ac-d9e8-4ded-b6b9-5fd35d564a24
false && 1  # && otherwise returns false

# ╔═╡ ce2cbdb6-637d-4f07-bb91-580621485b66
score = 10

# ╔═╡ 648e6be1-5e8b-4406-bee5-708a93ea20f3
response = if 80 < score <= 100
  "Good"
elseif 60 < score <= 80
  "Okay"
else
  "Uh-Oh"
end

# ╔═╡ 2732609d-86f3-4594-8f02-4f8066d41720
md"""
## Loops

Loops are repeated evaluations.

- `while` loops are often controlled by evaluated conditions.
- `for` loops are often controlled by sequence length.

- `break`: exit the loop immediately.
- `continue`: move on to the next item / evaluation immediately.
"""

# ╔═╡ af291389-2e9c-41fc-880b-28fe1fe70e49
## Hailstone sequence (3n+1 problem) in a while loop
let n = 27
    step = 0
    while n != 1
        if iseven(n)
            n ÷= 2
        else
            n = 3n + 1
        end
        step += 1
    end
    step
end

# ╔═╡ 4bb1e57d-ab16-4c97-ad4b-3db6a76b7e11
let sum = 0, n = 100
	for i in 1:n
		sum += i
	end
	sum
end

# ╔═╡ 0117590e-213b-4a70-a9c8-f44075c58854
with_terminal() do
	for x in 1:9
		if x == 5
			continue # jump to line #2
		elseif x >=8
			break    # jump to line #9
		end
		println(x, "^2 = ", x^2)
	end
end

# ╔═╡ d52dfdce-cd96-4d1b-8aa6-f1137758221b
with_terminal() do
	# Use enumerate(seq) to get a pair of one idx and one element
	for (i, x) in enumerate(10:-1:1)
		println("xs[", i, "] = ", x)
	end
end

# ╔═╡ 81194437-5b15-4ab9-af47-33108dde7751
md"""
Multiple nested for loops can be combined into a single outer loop, forming the cartesian product of its iterables.
"""

# ╔═╡ 21c53be2-3d98-4fb5-87b5-dd53bac7dd76
with_terminal() do
	# Multiple nested for loops can be combined into a single outer loop, forming the cartesian product of its iterables
	for i = 'x':'z', j = '1':'3'
		println(i, j)
	end
end

# ╔═╡ bd4a9500-5b35-4f0a-bd1c-4e42a650308b
md"""
# Functions

> In Julia, a function is an object that maps a tuple of argument values to a return value.
> [Julia docs](https://docs.julialang.org/en/v1/manual/functions/)

Functions facilitate:
- Code reuse and encapsulation.
- Specializations ([Methods](https://docs.julialang.org/en/v1/manual/methods/))

- Functions are first-class objects and can be passed into a higher-order function.
- The arguments are "passed-by-sharing". Modifications to mutable argument values (such as `Arrays`) will be reflected to the caller. (Similar to Python)
- Functions that will update the arguments are named with a bang `!` by convention. (e.g. sort(arr) vs sort!(arr))
- Often only the scalar version of a function is required; for vector element-wise operations, there are broadcast (dot) syntax.
- You can write multiple function with the same name provided they have different parameter lists. Julia will choose the most apporpriate one for you.
"""

# ╔═╡ 0d1252a0-3ce8-4b96-ba08-a6f1895cc0dc
md"""
## Standard form
"""

# ╔═╡ 5d26cdd5-9a6d-4307-89b7-6629997b9132
"Mechaelis-Menton function"  # Function documentations
function mm(x, k)            # function name and parameter list
  result = x / (x +k)
  return result              # return statement is optional
end

# ╔═╡ ce413514-bf5c-4dc8-b2af-42e9f663fa87
md"""
## One-liner form
"""

# ╔═╡ b87e79d8-91b0-4ecb-85b8-e2e8d01da426
# One-liner function
mm(x) = mm(x, one(x))

# ╔═╡ 5d2c7cdc-d34a-4e97-82c4-ac58a9196fd8
mm(0.5, 2)

# ╔═╡ d137d92d-f629-41cf-824c-516391f26f11
mm(1)

# ╔═╡ 65de3953-6a86-4e3f-ba00-b6c352678284
md"""
## Anonymous functions

Often used with high-order functions e.g. `map()`
"""

# ╔═╡ f14ab8cb-db2e-47f7-adaa-d932ed25bb1b
map(x->x^2, 1:3)

# ╔═╡ 26ba95b5-1d1c-4bed-b6dd-e17eba8136e3
md"""
Use [`do` block](https://docs.julialang.org/en/v1/manual/functions/#Do-Block-Syntax-for-Function-Arguments) for long anonymous functions.

`do` block are also useful in opening files.

```julia
open("outfile", "w") do io
    write(io, data)
end
```
"""

# ╔═╡ e2801350-24b7-4453-af27-ee63afbb4087
val = rand(-6:6, 10)

# ╔═╡ 2f07f81c-346a-4f17-872c-f174adf6ff1d
map(val) do x
    if x < 0 && iseven(x)
        return 0
    elseif x == 0
        return 1
    else
        return x
    end
end

# ╔═╡ ea04a83f-74a1-46b0-b686-f125e0972ca2
md"""
## Optional arguments

[Optional (positional) arguments](https://docs.julialang.org/en/v1/manual/functions/#Optional-Arguments) are listed after mandatory ones.

```julia
function func(a, b, c=1)
# content
end
```

And they are called with `func(a, b)` or `func(a, b, 3)`

## Keyword arguments

[Keyword arguments](https://docs.julialang.org/en/v1/manual/functions/#Keyword-Arguments) are listed after `;`

```julia
function plot(x, y; style="solid", width=1, color="black")
    ###
end
```

And they are called with `plot(x, y, width=2)` or `plot(x, y; width=2)`
"""

# ╔═╡ d2e2e668-71f5-444b-98bf-5ea45df81c84
args_kwargs(args...; kwargs...) = (args, kwargs)  # mind the semicolon ;

# ╔═╡ 91e0412a-24ef-469a-9a67-3dcfa155d62a
args_kwargs(1,true, :IAmASymbol, b=4, c="IAmAString")

# ╔═╡ 33a48540-cb59-11eb-0602-8da0ecdcbe4c
md"""
# See also

- [Compositing functions and pipes](https://docs.julialang.org/en/v1/manual/functions/#Function-composition-and-piping)
- [Variable argument (vararg) functions](https://docs.julialang.org/en/v1/manual/functions/#Varargs-Functions)
- [Argument destructuring](https://docs.julialang.org/en/v1/manual/functions/#Argument-destructuring)
- [Scope of variables](https://docs.julialang.org/en/v1/manual/variables-and-scoping/)
"""

# ╔═╡ 00000000-0000-0000-0000-000000000001
PLUTO_PROJECT_TOML_CONTENTS = """
[deps]
PlutoUI = "7f904dfe-b85e-4ff6-b463-dae2292396a8"

[compat]
PlutoUI = "~0.7.9"
"""

# ╔═╡ 00000000-0000-0000-0000-000000000002
PLUTO_MANIFEST_TOML_CONTENTS = """
# This file is machine-generated - editing it directly is not advised

[[Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

[[Dates]]
deps = ["Printf"]
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"

[[InteractiveUtils]]
deps = ["Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"

[[JSON]]
deps = ["Dates", "Mmap", "Parsers", "Unicode"]
git-tree-sha1 = "81690084b6198a2e1da36fcfda16eeca9f9f24e4"
uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
version = "0.21.1"

[[Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"

[[Markdown]]
deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"

[[Mmap]]
uuid = "a63ad114-7e13-5084-954f-fe012c677804"

[[Parsers]]
deps = ["Dates"]
git-tree-sha1 = "c8abc88faa3f7a3950832ac5d6e690881590d6dc"
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
version = "1.1.0"

[[PlutoUI]]
deps = ["Base64", "Dates", "InteractiveUtils", "JSON", "Logging", "Markdown", "Random", "Reexport", "Suppressor"]
git-tree-sha1 = "44e225d5837e2a2345e69a1d1e01ac2443ff9fcb"
uuid = "7f904dfe-b85e-4ff6-b463-dae2292396a8"
version = "0.7.9"

[[Printf]]
deps = ["Unicode"]
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"

[[Random]]
deps = ["Serialization"]
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

[[Reexport]]
git-tree-sha1 = "5f6c21241f0f655da3952fd60aa18477cf96c220"
uuid = "189a3867-3050-52da-a836-e630ba90ab69"
version = "1.1.0"

[[Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"

[[Suppressor]]
git-tree-sha1 = "a819d77f31f83e5792a76081eee1ea6342ab8787"
uuid = "fd094767-a336-5f1f-9728-57cf17d0bbfb"
version = "0.2.0"

[[Unicode]]
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
"""

# ╔═╡ Cell order:
# ╠═d7ff772c-9d33-42e7-9df1-3e02ceee79c5
# ╠═7553b887-a16d-4f3b-a91b-043f89e963d7
# ╠═383e7736-dd64-44ce-ac21-60a9a5a7c0db
# ╠═0335796f-da7d-4acc-be19-a0b45cd6042a
# ╠═2ee995ac-d9e8-4ded-b6b9-5fd35d564a24
# ╠═ce2cbdb6-637d-4f07-bb91-580621485b66
# ╠═648e6be1-5e8b-4406-bee5-708a93ea20f3
# ╠═2732609d-86f3-4594-8f02-4f8066d41720
# ╠═af291389-2e9c-41fc-880b-28fe1fe70e49
# ╠═4bb1e57d-ab16-4c97-ad4b-3db6a76b7e11
# ╠═0117590e-213b-4a70-a9c8-f44075c58854
# ╠═d52dfdce-cd96-4d1b-8aa6-f1137758221b
# ╠═81194437-5b15-4ab9-af47-33108dde7751
# ╠═21c53be2-3d98-4fb5-87b5-dd53bac7dd76
# ╠═bd4a9500-5b35-4f0a-bd1c-4e42a650308b
# ╠═0d1252a0-3ce8-4b96-ba08-a6f1895cc0dc
# ╠═5d26cdd5-9a6d-4307-89b7-6629997b9132
# ╠═ce413514-bf5c-4dc8-b2af-42e9f663fa87
# ╠═b87e79d8-91b0-4ecb-85b8-e2e8d01da426
# ╠═5d2c7cdc-d34a-4e97-82c4-ac58a9196fd8
# ╠═d137d92d-f629-41cf-824c-516391f26f11
# ╠═65de3953-6a86-4e3f-ba00-b6c352678284
# ╠═f14ab8cb-db2e-47f7-adaa-d932ed25bb1b
# ╠═26ba95b5-1d1c-4bed-b6dd-e17eba8136e3
# ╠═e2801350-24b7-4453-af27-ee63afbb4087
# ╠═2f07f81c-346a-4f17-872c-f174adf6ff1d
# ╠═ea04a83f-74a1-46b0-b686-f125e0972ca2
# ╠═d2e2e668-71f5-444b-98bf-5ea45df81c84
# ╠═91e0412a-24ef-469a-9a67-3dcfa155d62a
# ╠═33a48540-cb59-11eb-0602-8da0ecdcbe4c
# ╟─00000000-0000-0000-0000-000000000001
# ╟─00000000-0000-0000-0000-000000000002


let

tpq = 960
p = 0x4f

n = Notes([
Note(p, 100, 0, tpq),
Note(p, 100, tpq, tpq),
Note(p, 100, 2tpq, tpq),
Note(p, 100, 3tpq, tpq),
Note(p, 100, 4tpq, tpq),
Note(p, 100, 5tpq, tpq),
Note(p, 100, 6tpq, tpq),
Note(p, 100, 7tpq, tpq),
Note(p, 100, 8tpq, tpq)
], tpq)

track = MIDITrack()

addnotes!(track, n)

lyrics = [textevent(:lyric, i == 3 ? "lnt" : "l") for i in 1:3]
addevents!(track, [0, tpq, 2tpq], lyrics)

texts = [textevent(:text, i == 3 ? "tnl" : "t") for i in 1:3]
addevents!(track, [0, tpq, 2tpq], texts)

markers = [textevent(:marker, X) for X in ["A", "B"]]
addevents!(track, [0, 4tpq], markers)

midi = MIDIFile(0, tpq, [track])
cd(@__DIR__)
save("texts.mid", midi)

midi = load("texts.mid")
t = midi.tracks[1]

@test findtextevents(:marker, t)[1] == ["A", "B"]
@test findtextevents(:text, t)[1]  == ["t", "t", "tnl"]
@test findtextevents(:lyric, t)[1] == ["l", "l", "lnt"]

rm("texts.mid")

end