Skip to content

Commit

Permalink
Create arctic_forcing repo to cite in the thesis
Browse files Browse the repository at this point in the history
  • Loading branch information
percurnicus committed Apr 4, 2019
0 parents commit 96055c5
Show file tree
Hide file tree
Showing 11 changed files with 794 additions and 0 deletions.
93 changes: 93 additions & 0 deletions Albedos.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
Cloud Over Bright Sea Ice X,Cloud Over Bright Sea Ice Y,Cloud Over Dark Sea Ice X,Cloud Over Dark Sea Ice Y,Clear Sky Over Bright Ice X,Clear Sky Over Bright Ice Y,Cloud Over Ocean X,Cloud Over Ocean Y,Clear Sky Over Dark Ice X,Clear Sky Over Dark Ice Y,Clear Sky Over Ocean X,Clear Sky Over Ocean Y
0.345596135,0.51345993,0.345596135,0.453633552,0.50334368,0.352090778,0.692640735,0.339404782,0.597992208,0.319019342,1.733774538,0.107468489
1.46560371,0.513527384,1.374110134,0.453613742,1.544477483,0.352119285,1.790563655,0.339294607,1.639126011,0.318999288,2.774908341,0.107448435
2.506737513,0.51350733,2.506737513,0.453680953,2.585611286,0.352099231,2.853782114,0.339719264,2.680259813,0.318979234,3.816042143,0.107428381
3.626745088,0.513396729,3.626745088,0.453570352,3.626745088,0.352079177,3.973789689,0.340231855,3.721393616,0.318716379,4.857175946,0.107408327
5.787886467,0.513355102,4.724668008,0.453549204,4.667878891,0.352301925,5.267319565,0.340474021,4.762527419,0.318939127,5.898309749,0.107388273
6.907894042,0.513422556,5.787886467,0.453528725,5.709012694,0.35349588,6.387327141,0.340986612,5.803661221,0.318919073,6.939443551,0.107368219
7.949027845,0.513402502,6.907894042,0.453596179,6.750146496,0.352019015,7.4505456,0.341535908,6.844795024,0.318899019,7.980577354,0.107348165
9.147909193,0.51337941,7.949027845,0.453576125,7.791280299,0.351998961,8.548468519,0.342102341,7.885928827,0.318878965,9.021711157,0.107328111
10.189043,0.513359356,9.147909193,0.453553033,8.832414102,0.351978907,9.646391438,0.343202937,8.927062629,0.318616109,10.06284496,0.107308058
11.30905057,0.513649379,10.189043,0.453532979,9.873547904,0.351958853,10.80110347,0.343928526,9.968196432,0.318838857,11.10397876,0.107288004
12.37226903,0.513709024,11.30905057,0.453422378,10.91468171,0.351938799,11.82961747,0.344798988,11.00933023,0.318818803,12.14511256,0.10726795
13.47019195,0.513207128,12.37226903,0.453401899,11.95581551,0.351918745,13.11052755,0.345913866,12.05046404,0.318798749,13.18624637,0.107247896
14.59019953,0.513274582,13.47019195,0.453380751,12.99694931,0.351898691,14.24315492,0.347245265,13.09159784,0.318778695,14.22738017,0.107227842
15.62344595,0.515749672,14.59019953,0.453448205,14.03808311,0.351878637,15.30637338,0.348435558,14.13273164,0.318758641,15.26851397,0.107207788
16.67472067,0.514396874,15.63133333,0.453428151,15.07921692,0.351858583,16.46108542,0.349374811,15.17386545,0.318738587,16.30964778,0.107187734
17.87134848,0.51330041,16.7513409,0.453317551,16.12035072,0.351838529,17.01951173,0.349684554,16.21499925,0.318718533,17.35078158,0.10716768
18.99135605,0.513100782,17.87134848,0.453474032,17.16148452,0.351818475,19.18696301,0.354129783,17.25613305,0.318698479,18.39191538,0.107147626
20.01987005,0.513080971,18.99135605,0.453274405,18.20261833,0.351798421,20.28488593,0.354874271,18.29726685,0.318678425,19.43304918,0.107127572
21.15249743,0.513059155,20.01987005,0.453254594,19.24375213,0.351778368,21.40489351,0.356633244,19.33840066,0.318658371,20.47418299,0.107107518
22.27250501,0.513126609,21.15249743,0.453232777,20.28488593,0.351758314,22.53752089,0.358124893,20.37953446,0.318638317,21.51531679,0.107087464
23.31363881,0.513106555,22.27250501,0.453300232,21.32601973,0.35173826,23.81843096,0.360592986,21.42066826,0.318618263,22.55645059,0.10706741
24.43364639,0.512995954,23.31363881,0.453280178,22.36715354,0.351718206,24.93843853,0.36270807,22.46180206,0.31859821,23.59758439,0.107047356
25.55365396,0.513063408,24.43364639,0.453169577,23.40828734,0.351698152,26.00165699,0.364681803,23.50293587,0.318578156,24.6387182,0.107027302
26.59478777,0.513043354,25.55365396,0.453237031,24.44942114,0.351678098,27.15636903,0.366796217,24.54406967,0.318558102,25.679852,0.107007248
27.66747108,0.512933665,26.59478777,0.453216977,25.49055494,0.351658044,28.21958749,0.368965811,25.58520347,0.318538048,26.7209858,0.106987194
28.83480292,0.512911181,27.66747108,0.453107288,26.53168875,0.35163799,29.33959506,0.371437003,26.62633727,0.318517994,27.7621196,0.106967141
29.95481049,0.512978635,28.83480292,0.453084804,27.57282255,0.351617936,30.53847641,0.374173759,27.66747108,0.31849794,28.80325341,0.106947087
30.99594429,0.512958581,29.95481049,0.453152258,28.61395635,0.351597882,31.56699041,0.376326215,28.70860488,0.318477886,29.84438721,0.106927033
32.11595187,0.513026035,31.01802895,0.453042751,29.65509015,0.351577828,32.69961779,0.378939608,29.74973868,0.318457832,30.88552101,0.106906979
33.23595945,0.516476529,32.11595187,0.453199658,30.69622396,0.351557774,33.81962537,0.381677883,30.79087248,0.318437778,31.92665481,0.106886925
34.27709325,0.521352979,33.23595945,0.456561124,31.73735776,0.35153772,34.93963294,0.38468324,31.83200629,0.318417724,32.96778862,0.107740957
35.53682008,0.527357137,34.27709325,0.461259519,32.77849156,0.350255097,36.05964052,0.387421514,32.87314009,0.31839767,34.00892242,0.109080594
36.65908119,0.532524543,35.53682008,0.467072905,33.81962537,0.346058851,37.25852186,0.390603406,33.91427389,0.318377616,35.05005622,0.110468791
37.7813423,0.537997186,36.63203875,0.471782977,34.86075917,0.341668363,38.37852944,0.393786817,34.9554077,0.318357562,36.09119003,0.111759867
38.82022257,0.542721061,37.7813423,0.4780945,35.90189297,0.337374997,39.49853702,0.396970229,35.9965415,0.318337508,37.13232383,0.113196624
39.931216,0.54841013,39.08444971,0.48834252,36.94302677,0.332935949,40.61854459,0.400331695,37.0376753,0.318366015,38.17345763,0.114779062
41.08051955,0.554111179,40.24220402,0.497200697,37.84218778,0.336797389,41.70700266,0.402803495,38.0788091,0.325241533,39.21459143,0.116507182
42.17573822,0.559279106,41.40502878,0.506793253,38.55205174,0.348735638,42.93743352,0.40732019,39.11994291,0.336293244,40.25572524,0.118186741
43.26870336,0.566405678,42.56278309,0.515317578,39.21459143,0.359940322,43.96594751,0.410167059,40.16107671,0.347636317,41.29685904,0.11991486
44.33913314,0.57510974,43.96053903,0.523379425,39.87713113,0.371145006,45.17744867,0.414043122,41.20221051,0.359367873,42.33799284,0.121400178
45.49688745,0.583700835,45.10984258,0.529843566,40.53967082,0.382502308,46.29745624,0.417493615,42.24334431,0.370176782,43.37912664,0.121622926
46.50252805,0.591003964,46.25914612,0.536384016,41.20221051,0.393783302,47.41746382,0.420944108,43.28447812,0.378800474,44.42026045,0.121602872
47.5030982,0.598933562,47.46253455,0.542923424,41.91207447,0.405893245,48.61634517,0.425105301,44.32561192,0.386307277,45.46139425,0.121097214
48.60057041,0.6041396,48.55775322,0.547480877,42.66926269,0.418297976,49.73635274,0.428644822,45.36674572,0.393814081,46.50252805,0.1210286
49.74762042,0.609726228,49.70480323,0.552215387,43.42645091,0.430035001,50.85636032,0.432718507,46.40787952,0.401320884,47.54366185,0.120328701
50.91945934,0.615134325,50.82481081,0.556734209,44.18363913,0.441772026,51.97636789,0.436436082,47.44901333,0.408439205,48.58479566,0.118511913
52.02369216,0.620632751,51.92904363,0.561609443,44.94082735,0.453509051,53.09637547,0.440242685,48.49014713,0.412789585,49.62592946,0.116452323
53.14369973,0.625062545,53.04905121,0.565327019,45.69801557,0.465246076,54.29525682,0.444492905,49.53128093,0.4166058,50.66706326,0.114344174
54.26370731,0.628780121,54.16905878,0.568065293,46.45520379,0.476983101,55.11554406,0.447949172,50.57241474,0.420422015,51.70819707,0.112284584
55.38371488,0.632497696,55.23723502,0.571160676,47.25971627,0.48917177,56.70879427,0.452814987,51.61354854,0.42418967,52.74933087,0.111050521
56.50372246,0.636037217,56.33020016,0.573810444,48.20620155,0.498358428,57.98654939,0.458042989,52.65468234,0.428831412,53.79046467,0.111953114
57.52908151,0.639489533,57.45020773,0.5768158,49.24733535,0.506447956,59.10655697,0.462027646,53.69581614,0.435706931,54.83159847,0.112904267
58.64908908,0.641693644,58.64908908,0.579463528,50.28846915,0.514537484,60.22656454,0.466101331,54.73694995,0.442776691,55.87273228,0.11380686
59.76909666,0.643986782,59.76909666,0.581667639,51.32960296,0.522481331,61.34657212,0.470264043,55.77808375,0.449895012,56.91386608,0.114758014
60.88910423,0.64627992,60.88910423,0.583871749,52.37073676,0.530376617,62.46657969,0.474159673,56.81921755,0.456964772,57.95499988,0.117748703
61.93023804,0.64812944,61.93023804,0.586077379,53.41187056,0.53647517,63.57081251,0.478945881,57.86035135,0.46374317,58.99613368,0.12302173
63.05024561,0.649710359,63.05024561,0.588459544,54.45300436,0.542330921,64.69082009,0.482930538,58.90148516,0.469793162,60.03726749,0.128343316
64.17025319,0.651380305,64.17025319,0.591553928,55.49413817,0.548186672,65.81082766,0.48709325,59.94261896,0.475988836,61.07840129,0.133713464
65.29026076,0.652961224,65.36913454,0.59473582,56.53527197,0.553799621,66.93083524,0.491255962,60.98375276,0.481990268,62.11953509,0.13898649
66.41026834,0.654453116,66.48914211,0.597563122,57.57640577,0.559072647,68.05084282,0.49524062,62.02488656,0.488234502,63.16066889,0.142317102
67.53027591,0.655588898,67.60914969,0.600390424,58.61753957,0.562111897,69.32859794,0.499934457,63.06602037,0.493264726,64.2018027,0.144433704
68.57140972,0.656281063,68.65028349,0.602328972,59.65867338,0.564762663,70.44860551,0.504008142,64.10715417,0.497663666,65.2429365,0.146453186
69.69141729,0.656348517,69.77029107,0.603998918,60.69980718,0.567559111,71.56861309,0.507814745,65.14828797,0.502062606,66.2840703,0.148569788
70.78934021,0.656861534,70.89029864,0.605935947,61.74094098,0.570258438,75.00750959,0.518253733,66.18942177,0.506412985,67.32520411,0.150783511
71.85255867,0.657286191,72.11171535,0.60837975,62.78207478,0.573006325,76.12751716,0.521526172,67.23055558,0.510811925,68.36633791,0.154065563
72.97256625,0.658154891,73.20918757,0.612212223,63.82320859,0.575608531,77.24752474,0.524531528,68.27168938,0.515502227,69.40747171,0.157930338
74.01370005,0.65938122,74.35623758,0.618027779,64.86434239,0.578307858,78.38015212,0.52573829,69.31282318,0.520483892,70.44860551,0.161503752
75.2125814,0.661583812,75.52807649,0.623741112,65.90547619,0.580812943,79.40866612,0.526804612,70.35395699,0.525368435,71.48973932,0.165368528
76.33258897,0.663075703,76.63230931,0.629417593,66.94661,0.583609391,80.68957619,0.527830463,71.39509079,0.530252979,72.48354885,0.170525921
77.37372278,0.664302032,77.75231689,0.634203497,67.9877438,0.585386071,81.82220357,0.528716725,72.43622459,0.535380324,73.28806134,0.183315101
78.49373035,0.665793924,78.87232446,0.638010099,69.0288776,0.586337224,82.88542203,0.528963328,73.47735839,0.542304403,73.95060103,0.195282876
79.61373793,0.666751652,79.99233204,0.641638647,70.0700114,0.587288378,83.98334495,0.529031208,74.5184922,0.549471284,74.61314072,0.207250652
80.65487173,0.667621871,81.11233961,0.645267195,71.11114521,0.588239531,85.10335252,0.529009634,75.559626,0.556783846,75.27568042,0.219294737
81.77487931,0.668757653,82.30333358,0.650296557,72.15227901,0.588996443,86.2359799,0.528898791,76.6007598,0.563999288,75.93822011,0.231186203
83.00136647,0.675455594,83.36136891,0.661274234,73.19341281,0.588976389,87.2644939,0.528968007,77.6418936,0.568543909,76.6007598,0.243230288
84.07799347,0.687320007,84.44607108,0.675887741,74.23454661,0.588033688,88.54540397,0.528854307,78.68302741,0.563862059,77.45259655,0.256352929
85.10861077,0.699912363,85.36521345,0.687562295,75.27568042,0.587285229,89.70958086,0.527630014,79.72416121,0.558354683,78.49373035,0.258518092
86.08138731,0.711229775,86.33904163,0.701016343,76.31681422,0.586536769,73.3105802,0.51386816,80.76529501,0.552798747,79.53486415,0.257769633
87.20139488,0.723850085,87.258184,0.712524713,77.35794802,0.585399827,17.88395904,0.3517897,81.80642881,0.547291371,80.57599796,0.256875492
88.40027623,0.727566141,88.24252869,0.71581757,78.39908182,0.582708952,18.83959044,0.353119607,82.84756262,0.547902602,81.61713176,0.256224153
89.56760807,0.727543656,89.28366249,0.715797516,79.44021563,0.579435353,18.72013652,0.353121908,83.84137216,0.559659349,82.65826556,0.25625266
4.744027304,0.512492235,,,80.48134943,0.576161755,,,84.78785743,0.570965397,83.69939936,0.260068875
,,,,81.52248323,0.572888156,,,85.73434271,0.582431694,84.74053317,0.264176453
,,,,82.56361703,0.572431059,,,86.68082798,0.593897991,85.78166697,0.268089789
,,,,83.51010231,0.583970196,,,87.67463752,0.602925646,86.82280077,0.272197366
,,,,84.36193906,0.596002156,,,88.71577132,0.603633997,87.86393458,0.274605331
,,,,85.21377581,0.607974764,,,89.61493233,0.603616678,88.90506838,0.274585277
,,,,86.06561255,0.619828669,,,,,89.74338391,0.273882347
,,,,86.9174493,0.631801278,,,,,0.682593857,0.108076082
,,,,87.86393458,0.639827881,,,,,0.085324232,0.108087587
,,,,88.90506838,0.639953509,,,,,,
,,,,89.70958086,0.639938012,,,,,,
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Arctic Forcing

This repo was made for Perry Vargas's Senior Thesis for the School of Earth and
Space Exploration at Arizona State University. The point is to simply model the
affect an ice free summer has on the global annual radiative forcing. It was
found that it increased the global annual radiative forcing by $0.41\pm0.04
Wm^{-2}$

![results](ice_free.png)
114 changes: 114 additions & 0 deletions albedos.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import numpy as np
import pandas as pd


class Albedo:

def __init__(self, zeniths, albedos):
zeniths = np.array(zeniths)
albedos = np.array(albedos)
self._zeniths = zeniths[~np.isnan(zeniths)].copy()
self._albedos = albedos[~np.isnan(albedos)].copy()
sort_inds = np.argsort(self._zeniths)
self._zeniths = self._zeniths[sort_inds]
self._albedos = self._albedos[sort_inds]

@property
def zeniths(self):
return self._zeniths.copy()

@property
def albedos(self):
return self._albedos.copy()

def get_albedo(self, zeniths):
mask = zeniths <= 90
albedo = np.zeros(zeniths.shape)
albedo[mask] = np.interp(
x=zeniths[mask],
xp=self._zeniths,
fp=self._albedos,
)
return albedo


class Albedos:

def __init__(self, filepath=None):
if filepath is None:
filepath = 'Albedos.csv'
self._filepath = filepath
self._albedos = pd.read_csv(filepath)
self._clear_ocean = Albedo(
zeniths=self._albedos['Clear Sky Over Ocean X'].values,
albedos=self._albedos['Clear Sky Over Ocean Y'].values
)
self._cloud_bright_ice = Albedo(
zeniths=self._albedos['Cloud Over Bright Sea Ice X'].values,
albedos=self._albedos['Cloud Over Bright Sea Ice Y'].values
)
self._cloud_ocean = Albedo(
zeniths=self._albedos['Cloud Over Ocean X'].values,
albedos=self._albedos['Cloud Over Ocean Y'].values
)
self._cloud_dark_ice = Albedo(
zeniths=self._albedos['Cloud Over Dark Sea Ice X'].values,
albedos=self._albedos['Cloud Over Dark Sea Ice Y'].values)
self._clear_bright_ice = Albedo(
zeniths=self._albedos['Clear Sky Over Bright Ice X'].values,
albedos=self._albedos['Clear Sky Over Bright Ice Y'].values
)
self._clear_dark_ice = Albedo(
zeniths=self._albedos['Clear Sky Over Dark Ice X'].values,
albedos=self._albedos['Clear Sky Over Dark Ice Y'].values,
)

def get_ice_albedo(self, zeniths, ice_thickness, temperature,
clear_sky=True, sea_albedo=None):
if clear_sky:
bright_ice = self._clear_bright_ice
dark_ice = self._clear_dark_ice
else:
bright_ice = self._cloud_bright_ice
dark_ice = self._cloud_dark_ice

if sea_albedo is None:
sea_albedo = self.get_sea_albedo(zeniths, clear_sky)

bright_albedo = bright_ice.get_albedo(zeniths)
dark_albedo = dark_ice.get_albedo(zeniths)

albedo = np.zeros(zeniths.shape)

has_melt = temperature >= (-1 + 273.15)
is_thin_ice = ice_thickness < 0.5

thin_dry = ~has_melt & is_thin_ice
thin_melt = has_melt & is_thin_ice
thick_dry = ~has_melt & ~is_thin_ice
thick_melt = has_melt & ~is_thin_ice

fh = np.arctan(4 * ice_thickness) / np.arctan(4 * .5)
fh[fh > 1] = 1

albedo[thick_melt] = dark_albedo[thick_melt]
albedo[thick_dry] = bright_albedo[thick_dry]

albedo[thin_dry] = (
sea_albedo[thin_dry] * (1 - fh[thin_dry]) +
bright_albedo[thin_dry] * fh[thin_dry]
)
albedo[thin_melt] = (
sea_albedo[thin_melt] * (1 - fh[thin_melt]) +
bright_albedo[thin_melt] * fh[thin_melt]
)

return albedo

def get_sea_albedo(self, zeniths, clear_sky=True):
if clear_sky:
ocean = self._clear_ocean
else:
ocean = self._cloud_ocean
albedo = ocean.get_albedo(zeniths)
return albedo
54 changes: 54 additions & 0 deletions baseline.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import json
from datetime import datetime

import dateutil
import numpy as np

from albedos import Albedos
from data_set import DataSet
from net_forcing import get_radiative_forcing

SIC_PATH = 'sic_day_GFDL-CM3_historical*'
SIT_PATH = 'sit_day_GFDL-CM3_historical*'
TAS_PATH = 'tas_3hr_GFDL-CM3_historical_r1i1p1_*.nc'
CLT_PATH = 'tcdc.eatm.gauss.19[89]*.nc'

BEGIN_DATE = datetime(1979, 1, 1, 0, 0, 0)
NUM_YEARS = 20

DELTA_T = 150


if __name__ == '__main__':
print('Creating DataSet')
data_set = DataSet(
sic_path=SIC_PATH,
sit_path=SIT_PATH,
tas_path=TAS_PATH,
clt_path=CLT_PATH,
sic_scale=.01,
clt_scale=.01,
)
print('Getting Albedos')
albedos = Albedos()
year = dateutil.relativedelta.relativedelta(years=1)
rad_start_dates = [BEGIN_DATE + year * n for n in range(NUM_YEARS)]
forcings = []
for rad_start_date in rad_start_dates:
forcing = get_radiative_forcing(
start_date=rad_start_date,
delta_t=DELTA_T,
data_set=data_set,
albedos=albedos,
)
print(rad_start_date, forcing)
forcings.append(forcing)

out = {
date.isoformat(): forcing for date, forcing
in zip(rad_start_dates, forcings)
}
out['mean'] = np.mean(forcings)
out['std'] = np.std(forcings)
with open(f'baseline_delta_t_{DELTA_T}.json', 'w') as stream:
json.dump(out, stream, indent=4)
24 changes: 24 additions & 0 deletions baseline_delta_t_150.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"1979-01-01T00:00:00": 2.626554012824042,
"1980-01-01T00:00:00": 2.637702032013413,
"1981-01-01T00:00:00": 2.670209941207299,
"1982-01-01T00:00:00": 2.6661356616010035,
"1983-01-01T00:00:00": 2.6157039161827953,
"1984-01-01T00:00:00": 2.5831371748325216,
"1985-01-01T00:00:00": 2.5715710441032873,
"1986-01-01T00:00:00": 2.6195439435319443,
"1987-01-01T00:00:00": 2.690760220332738,
"1988-01-01T00:00:00": 2.6981319543326383,
"1989-01-01T00:00:00": 2.696278090722977,
"1990-01-01T00:00:00": 2.6797325158619607,
"1991-01-01T00:00:00": 2.680042391514541,
"1992-01-01T00:00:00": 2.6721925880527713,
"1993-01-01T00:00:00": 2.6739578414839777,
"1994-01-01T00:00:00": 2.6462272576530164,
"1995-01-01T00:00:00": 2.657076583093866,
"1996-01-01T00:00:00": 2.6602427708709993,
"1997-01-01T00:00:00": 2.6732931864751706,
"1998-01-01T00:00:00": 2.651039782597768,
"mean": 2.653476645464437,
"std": 0.03430686844697131
}

0 comments on commit 96055c5

Please sign in to comment.