Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CO2 data generation script #139

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
46 changes: 35 additions & 11 deletions 01_drogon_ccs/generate-test-data.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,12 @@ def simulate_containment(
mass = poro * volumes * density * saturation
within = mass[poly_map].sum()
outside = mass[~poly_map].sum()
return within, outside
# Simulate fractions
aqu_within = within * gen.uniform(high=0.1)
gas_within = within - aqu_within
aqu_outside = outside * gen.uniform(high=0.1)
gas_outside = outside - aqu_outside
return aqu_within, gas_within, aqu_outside, gas_outside


def setup_ensemble_folders(ens_root, input_folder, polygons_folder):
Expand All @@ -216,8 +221,7 @@ def setup_ensemble_folders(ens_root, input_folder, polygons_folder):
shutil.copy(f, res_root / "polygons")
shutil.copy(input_folder / "leakage_boundary.csv", res_root / "polygons")
# Write dummy OK and STATUS files
t = datetime.datetime.now()
t = datetime.datetime.strftime(t, "%H:%M:%S")
t = "13:42:37"
with open(ens_root / "iter-0" / "OK", "w") as f:
f.write(f"All jobs complete {t}\n")
with open(ens_root / "iter-0" / "STATUS", "w") as f:
Expand All @@ -226,7 +230,27 @@ def setup_ensemble_folders(ens_root, input_folder, polygons_folder):
return res_root


def main(ens_root, input_folder, polygons_folder):
def generate_date_table_entry(
surface_template: xtgeo.RegularSurface,
saturation: xtgeo.RegularSurface,
boundary: sg.Polygon,
seed: int,
):
ia, ig, oa, og = simulate_containment(surface_template, saturation, boundary, seed)
return {
"total": ia + ig + oa + og,
"total_inside": ia + ig,
"total_outside": oa + og,
"total_gas": ig + og,
"total_aqueous": ia + oa,
"total_gas_inside": ig,
"total_aqueous_inside": ia,
"total_gas_outside": og,
"total_aqueous_outside": oa,
}


def main(ens_root, input_folder, polygons_folder, base_seed):
res_root = setup_ensemble_folders(ens_root, input_folder, polygons_folder)
polys = read_polylines(
res_root / "polygons" / "topvolantis--gl_faultlines_extract_postprocess.csv"
Expand All @@ -245,7 +269,6 @@ def main(ens_root, input_folder, polygons_folder):
"toptherys": 70,
}
containments = []
base_seed = hash(ens_root) % 2**32
for sn, imd in mig_dists.items():
sgas, amfg = generate_maps(
res_root / "maps",
Expand All @@ -262,13 +285,13 @@ def main(ens_root, input_folder, polygons_folder):
seed=base_seed,
)
containments += [
[sn, t, *simulate_containment(tmpl, s, boundary, base_seed - 1)]
dict(
**generate_date_table_entry(tmpl, s, boundary, (base_seed + 1) % 2**32),
date=f"{t[:4]}-{t[4:6]}-{t[6:8]}",
)
for t, s in sgas.items()
]
df = pd.DataFrame.from_records(
containments,
columns=['surface', 'date', 'co2_inside', 'co2_outside'],
)
df = pd.DataFrame.from_records(containments)
df.groupby('date').sum().to_csv(res_root / "tables/co2_volumes.csv")


Expand All @@ -278,6 +301,7 @@ def main(ens_root, input_folder, polygons_folder):
main(
current / f"realization-{i}",
current / "input",
current / "../01_drogon_ahm/realization-0/iter-0/share/results/polygons"
current / "../01_drogon_ahm/realization-0/iter-0/share/results/polygons",
i + 42,
)
print(f"Cache efficiency: {_map_polygons.cache_info()}")
2 changes: 1 addition & 1 deletion 01_drogon_ccs/realization-0/iter-0/OK
Original file line number Diff line number Diff line change
@@ -1 +1 @@
All jobs complete 15:01:28
All jobs complete 13:42:37
2 changes: 1 addition & 1 deletion 01_drogon_ccs/realization-0/iter-0/STATUS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Current host : fake-host
MAKE_DIRECTORY : 15:01:28 .... 15:01:28
MAKE_DIRECTORY : 13:42:37 .... 13:42:37
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
date,co2_inside,co2_outside
20200101,2899574400.826876,203393917.238401
20400101,3088392407.3065677,283295051.0170409
20600101,3266875342.2931423,373310702.3053861
20800101,3436658691.3793783,473462734.4376221
21000101,3598976832.9913793,585443645.9197086
21200101,3754781699.6663804,712232902.9234608
21400101,3904946618.699225,857545511.2494102
21600101,4050401631.505111,1025315075.6815368
21800101,4192159976.0840845,1219303266.212956
22000101,4331281612.097786,1442848607.331028
date,total,total_inside,total_outside,total_gas,total_aqueous,total_gas_inside,total_aqueous_inside,total_gas_outside,total_aqueous_outside
2020-01-01,1883742663.4364176,1815824246.7556562,67918416.68076137,1729513594.6917028,154229068.7447149,1661834525.088866,153989721.66679037,67679069.60283683,239347.0779245281
2040-01-01,2128717771.441608,2007508582.1761463,121209189.26546186,1958045246.2584815,170672525.18312657,1837263202.775947,170245379.40019923,120782043.48253451,427145.78292734374
2060-01-01,2391343980.711609,2194584868.4987636,196759112.21284544,2204540339.4219604,186803641.28964862,2008474613.7876701,186110254.71109328,196065725.6342901,693386.5785553375
2080-01-01,2668669491.6071377,2373712354.920296,294957136.6868411,2466329013.9297266,202340477.67741066,2172411317.386357,201301037.53393954,293917696.54336995,1039440.1434711074
2100-01-01,2957081455.1233997,2542850289.9974246,414231165.1259749,2739977025.4257455,217104429.69765425,2327205626.6459765,215644663.3514482,412771398.7797688,1459766.346206046
2120-01-01,3253247375.061694,2701222532.4708104,552024842.5908833,3022226706.5268145,231020668.53487965,2472147220.4308696,229075312.03994092,550079486.0959445,1945356.4949387503
2140-01-01,3554720118.1839113,2849021491.033891,705698627.1500195,3310623908.754348,244096209.42956302,2607412190.3480587,241609300.68583265,703211718.4062891,2486908.7437303723
2160-01-01,3860166743.4822435,2987086912.461141,873079831.0211022,3603772133.5892596,256394609.89298335,2733769069.0265393,253317843.4346019,870003064.5627207,3076766.4583814475
2180-01-01,4169323360.6266336,3116646424.5315375,1052676936.0950959,3901308638.7416267,268014721.88500687,2852341376.119003,264305048.41253507,1048967262.622624,3709673.472471797
2200-01-01,4482802529.14331,3239127375.4528174,1243675153.6904917,4203727809.8045435,279074719.3387659,2964435414.5538177,274691960.8989998,1239292395.2507255,4382758.439766102
2 changes: 1 addition & 1 deletion 01_drogon_ccs/realization-1/iter-0/OK
Original file line number Diff line number Diff line change
@@ -1 +1 @@
All jobs complete 15:01:33
All jobs complete 13:42:37
2 changes: 1 addition & 1 deletion 01_drogon_ccs/realization-1/iter-0/STATUS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Current host : fake-host
MAKE_DIRECTORY : 15:01:33 .... 15:01:33
MAKE_DIRECTORY : 13:42:37 .... 13:42:37
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
date,co2_inside,co2_outside
20200101,1654561589.375503,12393883.326650523
20400101,1798686037.8203325,25417871.088025052
20600101,1945009265.81648,47499106.93108776
20800101,2093177498.0996132,81885851.83248754
21000101,2242441429.0557323,131681037.73029754
21200101,2391841707.728022,199527960.78088257
21400101,2540419148.0127516,287444014.5624134
21600101,2687378669.417129,396796996.82532215
21800101,2832172273.421074,528381764.8464747
22000101,2974506992.059312,682543095.9651519
date,total,total_inside,total_outside,total_gas,total_aqueous,total_gas_inside,total_aqueous_inside,total_gas_outside,total_aqueous_outside
2020-01-01,1239082991.814162,1233786285.762642,5296706.051520225,1137828975.7177527,101254016.09640937,1132916228.226054,100870057.53658794,4912747.491698791,383958.5598214338
2040-01-01,1353398788.9796295,1342293548.2002492,11105240.77938057,1242852537.0312917,110546251.948338,1232552315.8649776,109741232.33527161,10300221.16631418,805019.6130663906
2060-01-01,1480244528.2394903,1459078741.7088087,21165786.530681625,1359421037.156262,120823491.08322859,1339789559.8424332,119289181.86637561,19631477.313828647,1534309.2168529767
2080-01-01,1621996099.2275898,1584891579.9479804,37104519.27960928,1489731190.1559992,132264909.0715906,1455316379.8477564,129575200.10022406,34414810.30824274,2689708.9713665424
2100-01-01,1780260508.4068093,1719801802.1271255,60458706.27968375,1635272864.2578545,144987644.14895484,1579196813.456126,140604988.67099947,56076050.80172838,4382655.477955366
2120-01-01,1955694462.829931,1863202571.050483,92491891.77944796,1796660785.0010207,159033677.82891035,1710873636.361435,152328934.68904817,85787148.63958578,6704743.139862186
2140-01-01,2148045191.6434417,2013896839.4587379,134148352.18470396,1973671597.2780955,174373594.36534634,1849247667.7074187,164649171.75131926,124423929.57067686,9724422.614027094
2160-01-01,2356363918.513214,2170231614.088563,186132304.42465073,2165440618.9806733,190923299.53254062,1992801057.186628,177430556.90193498,172639561.79404515,13492742.630605597
2180-01-01,2579290924.4052877,2330264412.1734014,249026512.23188666,2370724697.10119,208566227.30409786,2139750132.6390815,190514279.5343199,230974564.4621087,18051947.769777946
2200-01-01,2815312778.1414833,2491942787.1315346,323369991.00994873,2588139128.064489,227173650.07699424,2288210248.3470984,203732538.78443643,299928879.71739095,23441111.292557787
2 changes: 1 addition & 1 deletion 01_drogon_ccs/realization-2/iter-0/OK
Original file line number Diff line number Diff line change
@@ -1 +1 @@
All jobs complete 15:01:36
All jobs complete 13:42:37
2 changes: 1 addition & 1 deletion 01_drogon_ccs/realization-2/iter-0/STATUS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Current host : fake-host
MAKE_DIRECTORY : 15:01:36 .... 15:01:36
MAKE_DIRECTORY : 13:42:37 .... 13:42:37
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
date,co2_inside,co2_outside
20200101,421518031.5819695,42290.44473337169
20400101,484414969.8424783,124500.55898943108
20600101,550373150.9043083,324629.7412591201
20800101,619004973.8429252,764525.8043107464
21000101,690044573.7083853,1651299.1649362976
21200101,763285764.1939903,3310668.102452799
21400101,838531144.7602464,6219996.756957946
21600101,915563897.3833501,11033694.625217088
21800101,994138591.3327402,18591616.37128943
22000101,1073983556.87063,29901323.37368089
date,total,total_inside,total_outside,total_gas,total_aqueous,total_gas_inside,total_aqueous_inside,total_gas_outside,total_aqueous_outside
2020-01-01,2135542026.5014677,2087965638.3737245,47576388.127743416,2050448017.957181,85094008.54428689,2004576140.1635756,83389498.2101489,45871877.79360543,1704510.3341379864
2040-01-01,2327591067.47373,2251678077.2978234,75912990.17590687,2234943475.8132563,92647591.66047361,2161750206.098321,89927871.19950205,73193269.7149353,2719720.4609715706
2060-01-01,2531047883.666432,2415666013.848387,115381869.81804496,2430436872.001064,100611011.6653679,2319188766.7922397,96477247.05614704,111248105.2088241,4133764.6092208647
2080-01-01,2747323764.405325,2579081168.274601,168242596.13072416,2638292421.418202,109031342.9871228,2476077421.2238708,103003747.05073021,162215000.19433156,6027595.936392591
2100-01-01,2977356999.2130494,2741153829.7049084,236203169.50814077,2859417962.210703,117939037.00234649,2631677199.354823,109476630.35008538,227740762.85587963,8462406.652261112
2120-01-01,3221560904.6193676,2901410024.246522,320150880.3728452,3094213951.7642345,127346952.85513285,2785533056.935766,115876967.3107558,308680894.82846814,11469985.54437705
2140-01-01,3479849163.0665483,3059690049.6270003,420159113.43954754,3342597821.5949893,137251341.47155875,2937491669.908592,122198379.7184083,405106151.6863971,15052961.75315046
2160-01-01,3751747432.99113,3216045084.490621,535702348.5005089,3604112013.872724,147635419.11840606,3087602172.936879,128442911.55374205,516509840.93584484,19192507.564664006
2180-01-01,4036569161.394387,3370609022.283971,665960139.1104156,3878094022.1222177,158475139.27216935,3235993112.0098042,134615910.2741669,642100910.1124132,23859228.998002432
2200-01-01,4333612742.470046,3523495224.9857445,810117517.4843016,4163866910.766742,169745831.70330432,3382773321.6376276,140721903.34811714,781093589.1291144,29023928.355187178
2 changes: 1 addition & 1 deletion 01_drogon_ccs/realization-3/iter-0/OK
Original file line number Diff line number Diff line change
@@ -1 +1 @@
All jobs complete 15:01:40
All jobs complete 13:42:37
2 changes: 1 addition & 1 deletion 01_drogon_ccs/realization-3/iter-0/STATUS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Current host : fake-host
MAKE_DIRECTORY : 15:01:40 .... 15:01:40
MAKE_DIRECTORY : 13:42:37 .... 13:42:37
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
date,co2_inside,co2_outside
20200101,2051688867.7318802,167347615.8718896
20400101,2224191301.563737,228736968.5235535
20600101,2392071546.8368616,294789309.0569485
20800101,2555234187.8752093,364857153.2784274
21000101,2713659540.9601793,440136942.523247
21200101,2867336423.486977,523216567.622637
21400101,3016246288.8237247,617309658.3700715
21600101,3160392504.024811,725470542.6749091
21800101,3299854618.257772,850005820.5612388
22000101,3434838330.814,992203062.4412127
date,total,total_inside,total_outside,total_gas,total_aqueous,total_gas_inside,total_aqueous_inside,total_gas_outside,total_aqueous_outside
2020-01-01,2950110403.4945817,2801027529.1930046,149082874.30157697,2866309291.7529664,83801111.74161518,2718499214.7012033,82528314.49180119,147810077.05176297,1272797.2498139942
2040-01-01,3252753410.9915953,3025006819.6235585,227746591.36803725,3161681473.5935507,91071937.3980445,2935879272.1261363,89127547.49742207,225802201.46741483,1944389.9006224293
2060-01-01,3569358740.2511024,3244595115.626811,324763624.62429154,3470988659.9278946,98370080.3232083,3148997709.5641303,95597406.06268091,321990950.3637641,2772674.2605273887
2080-01-01,3899707149.5106745,3460642921.7557564,439064227.754918,3793995683.054861,105711466.45581344,3358679972.654443,101962949.1013137,435315710.4004182,3748517.354499741
2100-01-01,4242510453.9907775,3673190289.6456676,569320164.3451102,4129424517.968217,113085936.02256058,3564964932.9675612,108225356.67810637,564459585.0006559,4860579.344454203
2120-01-01,4595891582.163805,3881796095.669056,714095486.4947494,4475423349.65062,120468232.51318434,3767424463.959774,114371631.70928176,707998885.6908468,6096600.803902592
2140-01-01,4958056020.216461,4085993002.790522,872063017.425939,4830222764.504962,127833255.71149918,3965604998.020448,120388004.77007373,864617766.4845135,7445250.941425454
2160-01-01,5327855716.723956,4285551190.3349085,1042304526.3890476,5192689321.856236,135166394.8677206,4159283485.8155713,126267704.51933748,1033405836.0406644,8898690.348383125
2180-01-01,5705067814.7429,4480513386.085158,1224554428.6577413,5562601173.280897,142466641.4620017,4348501396.214394,132011989.87076503,1214099777.0665045,10454651.591236683
2200-01-01,6090377753.025138,4671114971.708723,1419262781.3164148,5940632979.973846,149744773.0512911,4533487175.696448,137627796.0122739,1407145804.2773976,12116977.039017184
2 changes: 1 addition & 1 deletion 01_drogon_ccs/realization-4/iter-0/OK
Original file line number Diff line number Diff line change
@@ -1 +1 @@
All jobs complete 15:01:43
All jobs complete 13:42:37
2 changes: 1 addition & 1 deletion 01_drogon_ccs/realization-4/iter-0/STATUS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Current host : fake-host
MAKE_DIRECTORY : 15:01:43 .... 15:01:43
MAKE_DIRECTORY : 13:42:37 .... 13:42:37
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading