<jupyter_start><jupyter_text>Geothermal Power Capacity Reserve Estimation<jupyter_code>from platform import python_version
print(python_version())
# Import libraries
import numpy as np
import scipy
from scipy.stats import norm, lognorm
import matplotlib.pyplot as plt<jupyter_output><empty_output><jupyter_text>Appraisal and Development: *Assuming it's there, how big is it?*<jupyter_code># USER INPUT REQUIRED
Tmax = 280 #startup averages temperature for P90 reserves (degrees C)
Tmin = 250 #minimum temperature for the P10 reservoir (degrees C)
# USER INPUT REQUIRED
# Area in km2 above the minimum temperature
Area_P90 = 1
Area_P10 = 10
# USER INPUT REQUIRED
# Power Density in (MWe/km2) within the P90 and P10 temperatures (Tmin and Tmax as specified by user)
PowerDens_P90 = 10
PowerDens_P10 = 24
def Expected_development_size(area_p90, area_p10, powerdens_p90, powerdens_p10):
    
    ''' Calculate and plot the cumulative distribution function for expected development size'''

    #### Calculate nu and sigma (the mean and variance in log units required for specifying lognormal distributions) ####
    
    # nu and sigma for area
    area_nu = ((np.log(area_p90)+np.log(area_p10))/2)
    area_sigma = (np.log(area_p10)-np.log(area_p90))/((norm.ppf(0.9)-(norm.ppf(0.1))))
    
    # nu and sigma for power density
    powerdens_nu = ((np.log(powerdens_p90)+np.log(powerdens_p10))/2)
    powerdens_sigma = (np.log(powerdens_p10)-np.log(powerdens_p90))/((norm.ppf(0.9)-(norm.ppf(0.1))))
    
    # nu and sigma for MWe Capacity
    capacity_nu = area_nu + powerdens_nu
    capacity_sigma = ((area_sigma**2)+(powerdens_sigma**2))**0.5
    
    
    #### Calculate cumulative confidence curve for expected development size ####

    prob = [0.1]
    prob_desc = []
    expected_development_size_cdf=[]

    # Specify probability range
    for i in range(1,100):
        prob.append(i)

    for j in prob:
    
        # Calculate 100-prob for plotting descending cumulative probability
        desc = 100-j
        prob_desc.append(desc)   
    
        # Calculate expected development size distribution
        eds_cdf = lognorm.ppf(j/100, capacity_sigma, loc=0, scale=np.exp(capacity_nu))
        expected_development_size_cdf.append(eds_cdf)
        
        
    #### Plot expected development size cumulative distribution ####

    plt.plot(expected_development_size_cdf, prob_desc)
    plt.xlabel("Expected Development Size (MW)")
    plt.ylabel("Cumulative Confidence %")
    plt.title("Cumulative Confidence in Developed Reservoir Size")
    #axs[0].set_xlim([0, 350])
    plt.ylim([10, 100]) 

Expected_development_size(Area_P90, Area_P10, PowerDens_P90, PowerDens_P10)<jupyter_output><empty_output><jupyter_text>Exploration: *Is it there?*<jupyter_code># USER INPUT REQUIRED
Ptemp = 0.8
Pperm = 0.4
Pchem = 0.5
POSexpl = Ptemp * Pperm * Pchem
print("Probability of exploration success = {:.0f}%".format(POSexpl*100))
# Could potentially code in user option to adjust number of decimal places for POS<jupyter_output>Probability of exploration success = 16%<jupyter_text>Expected Power CapacityExpected power capacity = expected development size * POSexpl<jupyter_code>def Expected_power_capacity(area_p90, area_p10, powerdens_p90, powerdens_p10, posexpl):
    
    ''' Calculate and plot the cumulative distribution function for expected power capacity
    
    Expected power capacity = expected development size * POSexpl
    '''

    #### Calculate nu and sigma (the mean and variance in log units required for specifying lognormal distributions) ####
    
    # nu and sigma for area
    area_nu = ((np.log(area_p90)+np.log(area_p10))/2)
    area_sigma = (np.log(area_p10)-np.log(area_p90))/((norm.ppf(0.9)-(norm.ppf(0.1))))
    
    # nu and sigma for power density
    powerdens_nu = ((np.log(powerdens_p90)+np.log(powerdens_p10))/2)
    powerdens_sigma = (np.log(powerdens_p10)-np.log(powerdens_p90))/((norm.ppf(0.9)-(norm.ppf(0.1))))
    
    # nu and sigma for MWe Capacity
    capacity_nu = area_nu + powerdens_nu
    capacity_sigma = ((area_sigma**2)+(powerdens_sigma**2))**0.5
    
    
    #### Calculate cumulative confidence curve for expected power capacity ####

    prob = [0.1]
    prob_desc = []
    expected_development_size_cdf=[]

    # Specify probability range
    for i in range(1,100):
        prob.append(i)

    for j in prob:
    
        # Calculate 100-prob for plotting descending cumulative probability
        desc = 100-j
        prob_desc.append(desc)   
    
        # Calculate expected power capacity
        eds_cdf = lognorm.ppf(j/100, capacity_sigma, loc=0, scale=np.exp(capacity_nu))*posexpl
        expected_development_size_cdf.append(eds_cdf)
        

    # Plot power capacity cumulative distribution
    plt.plot(expected_power_capacity, prob_desc)
    plt.xlabel("Expected Power Capacity (MWe potential reserves)")
    plt.ylabel("Cumulative Confidence %")
    plt.title("Cumulative Confidence in Power Capacity")
    #axs[0].set_xlim([0, 350])
    plt.ylim([10, 100]) 

Expected_power_capacity(Area_P90, Area_P10, PowerDens_P90, PowerDens_P10, POSexpl)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10504854368932039, 'fraction_numerical': 0.036310679611650486, 'mean_word_length': 3.972007722007722, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '665399', 'license': 'Apache-2.0', 'n_tokens_mistral': 1863, 'n_tokens_neox': 1661, 'n_words': 420, 'path': 'notebooks/Resource_estimator_Hannah.ipynb', 'repo_name': 'Geothermal-Resource-Capacity/Power-Density', 'size': '5150'}