TNO Intern

Commit 71a6276a authored by Hen Brett's avatar Hen Brett 🐔
Browse files

my first commit

parent 428346d4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
<module type="PYTHON_MODULE" version="4">
  <component name="NewModuleRootManager">
    <content url="file://$MODULE_DIR$">
      <sourceFolder url="file://$MODULE_DIR$/tests/tests" isTestSource="true" />
      <excludeFolder url="file://$MODULE_DIR$/.venv" />
    </content>
    <orderEntry type="jdk" jdkName="Python 3.13 (pythermogis)" jdkType="Python SDK" />
+17 −2
Original line number Diff line number Diff line
import sys

import yaml

from src.thermogis.TechnoEconomicWrapper import edit_wp5_configuration_file, run_wp5_docker_image
from src.datamodels.configuration import Config


def run(config_file):
    print(config_file)
    with open(config_file, "r") as f:
        config_dict = yaml.load(f,Loader=yaml.FullLoader)
    config = Config(**config_dict)
    xml_file = config.model_path / "xml" / "doublet.xml"

    # edit the xml file that the ThermoGIS docker image will be run on
    edit_wp5_configuration_file(config, xml_file)

    # run the ThermoGIS docker image
    run_wp5_docker_image(config)


if __name__ == '__main__':
    run(sys.argv[2])
 No newline at end of file
    run(sys.argv[1])
 No newline at end of file
+198 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<project ATES="false">
	<application_version>1.6.0</application_version>
	<application_name>ThermoGIS</application_name>
	<input_data_directory>/data/InputData</input_data_directory>
	<maps_prefix__can_be_empty_></maps_prefix__can_be_empty_>
	<results_directory>/data/Results</results_directory>
	<compare_results>0.0</compare_results>
	<comparison_directory></comparison_directory>
	<output_maps_for_petrel>0</output_maps_for_petrel>
	<max_number_of_processors_for_calculations>10</max_number_of_processors_for_calculations>
	<aquifer_list__comma_separated__excluding_stacked_aquifers_>test, </aquifer_list__comma_separated__excluding_stacked_aquifers_>
	<property_grids__in_input_data_directory__stacked_grids_will_be_created_>
		<row_1>Permeability;no;_perm.zmap</row_1>
		<row_2>PermeabilityLNSD;no;_ln_perm_sd.zmap</row_2>
		<row_3>Porosity;no;_poro.zmap</row_3>
		<row_4>Thickness;no;_thick.zmap</row_4>
		<row_5>ThicknessSD;no;_thick_sd.zmap</row_5>
		<row_6>Depth;no;_top.zmap</row_6>
		<row_7>NetToGross;no;_ntg.zmap</row_7>
		<row_8>Temperature;yes;__temperature.zmap</row_8>
		<row_9>HCAccum;yes;_hc_accum.zmap</row_9>
		<row_10>BoundaryShapefile;yes;__BoundaryShapefile.shp</row_10>
	</property_grids__in_input_data_directory__stacked_grids_will_be_created_>
	<calculate_stacked_aquifers>0</calculate_stacked_aquifers>
	<thickness_correlation_factor___1_to_1__0__no_corr_>0.0</thickness_correlation_factor___1_to_1__0__no_corr_>
	<permeability_correlation_factor___1_to_1__0__no_corr_>0.0</permeability_correlation_factor___1_to_1__0__no_corr_>
	<stacked_aquifers></stacked_aquifers>
	<copy_aquifer_files>0</copy_aquifer_files>
	<aquifer_files__in_input_data_directory_>
		<row_1>__ntg_points.shp;__ntg_points.shp</row_1>
		<row_2>__poro_points.shp;__poro_points.shp</row_2>
		<row_3>__perm_points.shp;__perm_points.shp</row_3>
	</aquifer_files__in_input_data_directory_>
	<output_scenario_name>BaseCase</output_scenario_name>
	<aquifers_to_calculate>test, </aquifers_to_calculate>
	<pvalues_to_calculate>50</pvalues_to_calculate>
	<xy_grid_size_factor_for_thickness_grid__integer_>1</xy_grid_size_factor_for_thickness_grid__integer_>
	<max_undefined_cells__of_surrounding_4__for_interp>3.0</max_undefined_cells__of_surrounding_4__for_interp>
	<scale_factor_for_h_and_lnk_standard_deviations>1.0</scale_factor_for_h_and_lnk_standard_deviations>
	<minimum_production_temperature>20.0</minimum_production_temperature>
	<heating_return_temperature>30.0</heating_return_temperature>
	<maximum_cooling_temperature_range>100.0</maximum_cooling_temperature_range>
	<exclude_hydrocarbon_areas>1.0</exclude_hydrocarbon_areas>
	<use_boundary_shapefile>0.0</use_boundary_shapefile>
	<validate_input_grids>0</validate_input_grids>
	<validate_output_grids>0</validate_output_grids>
	<optimize_well_distance>1.0</optimize_well_distance>
	<minimum_well_distance>100.0</minimum_well_distance>
	<maximum_well_distance>3000.0</maximum_well_distance>
	<lifetime>50.0</lifetime>
	<max_tvd_stepout_factor>1.0</max_tvd_stepout_factor>
	<rock_density>2700.0</rock_density>
	<rock_heat_capacity>1000.0</rock_heat_capacity>
	<allowed_temperature_drop_as_fraction_of_deltat>0.1</allowed_temperature_drop_as_fraction_of_deltat>
	<maximum_flow>500.0</maximum_flow>
	<well_distance>1500.0</well_distance>
	<hydraulic_gradient_injection_water__sodm_max_inj_pres_>0.105</hydraulic_gradient_injection_water__sodm_max_inj_pres_>
	<minimum_pump_pressure>1.0</minimum_pump_pressure>
	<maximum_pump_pressure>300.0</maximum_pump_pressure>
	<tolerance_of_utc_increase___bar_>0.0</tolerance_of_utc_increase___bar_>
	<temperature_from_input_grids>0.0</temperature_from_input_grids>
	<use_3d_temperature_voxet_model>1.0</use_3d_temperature_voxet_model>
	<temperature_voxet_file>/data/InputTemperatureModel/restart.vo</temperature_voxet_file>
	<temp_gradient__surface_temp__below__also_used_>31.0</temp_gradient__surface_temp__below__also_used_>
	<surface_temperature>10.0</surface_temperature>
	<kh_cutoff__speed_up_calculation_>1.0</kh_cutoff__speed_up_calculation_>
	<anistropy__kv_kh__for_doubletcalc1d>3.0</anistropy__kv_kh__for_doubletcalc1d>
	<salinity_at_surface__ppm_>0.0</salinity_at_surface__ppm_>
	<salinity_gradient__ppm_m_>46.67</salinity_gradient__ppm_m_>
	<pump_efficiency>0.6</pump_efficiency>
	<pump_depth>300.0</pump_depth>
	<calculation_segment_length>50.0</calculation_segment_length>
	<outer_diameter__open_aquifer_section_>8.5</outer_diameter__open_aquifer_section_>
	<inner_diameter__cased_surface_top_aquifer_section_>8.5</inner_diameter__cased_surface_top_aquifer_section_>
	<casing_roughness>1.38</casing_roughness>
	<well_trajectory_curvature_scaling_factor__0__vert_wells_>1.1</well_trajectory_curvature_scaling_factor__0__vert_wells_>
	<injector_skin>-1.0</injector_skin>
	<producer_skin>-1.0</producer_skin>
	<economic_lifetime>30.0</economic_lifetime>
	<drilling_time>2.0</drilling_time>
	<annual_load_hours>6000.0</annual_load_hours>
	<annual_opex_base>0.0</annual_opex_base>
	<annual_opex_per_unit_power>100.0</annual_opex_per_unit_power>
	<annual_opex_per_unit_energy_produced>0.19</annual_opex_per_unit_energy_produced>
	<annual_opex_based_on_capex>0.0</annual_opex_based_on_capex>
	<opex_electricity_purchase_price_for_operations>8.0</opex_electricity_purchase_price_for_operations>
	<well_costs_base>0.25</well_costs_base>
	<well_costs_depth__along_hole__factor>700.0</well_costs_depth__along_hole__factor>
	<well_costs_depth_2__along_hole__factor>0.2</well_costs_depth_2__along_hole__factor>
	<well_costs_scaling>1.3</well_costs_scaling>
	<capex_base_expenses__excl_wells_>3.0</capex_base_expenses__excl_wells_>
	<capex_variable_expenses__excl_wells_>300.0</capex_variable_expenses__excl_wells_>
	<capex_contingency>15.0</capex_contingency>
	<tax_rate>25.0</tax_rate>
	<interest_on_loan>5.0</interest_on_loan>
	<inflation>1.5</inflation>
	<required_return_on_equity>14.5</required_return_on_equity>
	<debt_equity>80.0</debt_equity>
	<use_orc>0.0</use_orc>
	<heat_conversion_efficiency>1.0</heat_conversion_efficiency>
	<parasitic_power_fraction_of_net_power>0.0</parasitic_power_fraction_of_net_power>
	<base_temperature>10.0</base_temperature>
	<use_kestin_viscosity>0.0</use_kestin_viscosity>
	<maximum_depth_for_calculations>6000.0</maximum_depth_for_calculations>
	<stimulate_well_s_>0.0</stimulate_well_s_>
	<added_skin_injector__negative_increases_flow_>-3.0</added_skin_injector__negative_increases_flow_>
	<added_skin_producer__negative_increases_flow_>-3.0</added_skin_producer__negative_increases_flow_>
	<maximum_kh_value_for_stimulation>20.0</maximum_kh_value_for_stimulation>
	<stimulation_capex__for_both_wells_>0.5</stimulation_capex__for_both_wells_>
	<use_heat_pump>0.0</use_heat_pump>
	<calculate_cop>1.0</calculate_cop>
	<_minimum__injection_temperature>20.0</_minimum__injection_temperature>
	<goal_temperature>70.0</goal_temperature>
	<coefficient_of_performance>4.0</coefficient_of_performance>
	<heat_pump_capex>200.0</heat_pump_capex>
	<heat_pump_annual_opex>10.0</heat_pump_annual_opex>
	<include__non_sde__electric_power_in_output>0.0</include__non_sde__electric_power_in_output>
	<alternative_heating_price>2.8</alternative_heating_price>
	<application_mode>0.0</application_mode>
	<rosim_settings_file__must_contain__aquifer__layer_></rosim_settings_file__must_contain__aquifer__layer_>
	<ates_aquifer_anisotropy>5.0</ates_aquifer_anisotropy>
	<thermal_radius_factor>2.0</thermal_radius_factor>
	<ates_charge_temperature>80.0</ates_charge_temperature>
	<ates_injection_production_period__max_182_days_>120.0</ates_injection_production_period__max_182_days_>
	<rosim_simulation_time__constant_power_after_>5.0</rosim_simulation_time__constant_power_after_>
	<use_power_from_last_rosim_year_for_all_years>0.0</use_power_from_last_rosim_year_for_all_years>
	<ates_minimum_flow_rate__speed_up_calculation_>0.0</ates_minimum_flow_rate__speed_up_calculation_>
	<ates_minimum_depth__speed_up_calculation_>0.0</ates_minimum_depth__speed_up_calculation_>
	<ates_maximum_depth__speed_up_calculation_>500.0</ates_maximum_depth__speed_up_calculation_>
	<ates_filter_fraction__of_aquifer_thickness_>0.8</ates_filter_fraction__of_aquifer_thickness_>
	<ates_clogging_velocity>0.3</ates_clogging_velocity>
	<ates_membrane_filter_index>1.0</ates_membrane_filter_index>
	<ates_depth_multiplication_factor>0.01</ates_depth_multiplication_factor>
	<input__power_utc__scenario_name__must_exist_>BaseCase</input__power_utc__scenario_name__must_exist_>
	<aquifers_for_potential_calculation>test, </aquifers_for_potential_calculation>
	<probability_maps__basename__treshold_value_>npv:0, utc:5, power:1, cop:10, kh:5, flowr:100, h:20</probability_maps__basename__treshold_value_>
	<unit_technical_cost_cutoff>5.1</unit_technical_cost_cutoff>
	<unit_technical_cost_cutoff_deep>6.5</unit_technical_cost_cutoff_deep>
	<depth_for_deep_unit_technical_cost_cutoff>4000.0</depth_for_deep_unit_technical_cost_cutoff>
	<p_value_potential_category_1>50.0</p_value_potential_category_1>
	<p_value_potential_category_2__0__not_used_>30.0</p_value_potential_category_2__0__not_used_>
	<p_value_potential_category_3__0__not_used_>10.0</p_value_potential_category_3__0__not_used_>
	<p_value_potential_category_4__0__not_used_>0.0</p_value_potential_category_4__0__not_used_>
	<additional_p_values_for_the_power_probability_map_and_the_recoverable_heat_maps>90</additional_p_values_for_the_power_probability_map_and_the_recoverable_heat_maps>
	<power_value_for_power_probability_map>10.0</power_value_for_power_probability_map>
	<surface_temperature_hip>10.0</surface_temperature_hip>
	<rock_density_hip>2700.0</rock_density_hip>
	<rock_heat_capacity_hip>1000.0</rock_heat_capacity_hip>
	<exclude_hc_areas_for_recov_heat>1.0</exclude_hc_areas_for_recov_heat>
	<min_prod_temperature__potential__recoverable_heat>0.0</min_prod_temperature__potential__recoverable_heat>
	<aquifer_identifier_for_overview_resources__empty__all_>stacked</aquifer_identifier_for_overview_resources__empty__all_>
	<well_distance__0__from__calc_power_utc_>0.0</well_distance__0__from__calc_power_utc_>
	<doublet_geographical_sorting_factor>1.0</doublet_geographical_sorting_factor>
	<annual_resource_load_hours>6000.0</annual_resource_load_hours>
	<doublet_lifetime>30.0</doublet_lifetime>
	<delete_resources_within_shapefile_s___per_aquifer_>0.0</delete_resources_within_shapefile_s___per_aquifer_>
	<delete_shapefiles__in_input_grids_directory_>
		<row_1>shapefile.shp;license header;aquifer name header</row_1>
	</delete_shapefiles__in_input_grids_directory_>
	<classify_resources_by_shapefile_s_>0.0</classify_resources_by_shapefile_s_>
	<classify_shapefiles__in_input_grids_directory_>
		<row_1>shapefile.shp;output name</row_1>
	</classify_shapefiles__in_input_grids_directory_>
	<stochastic_resources__p90_p50_p10_needed_>0.0</stochastic_resources__p90_p50_p10_needed_>
	<number_of_stochastic_realisations>1000.0</number_of_stochastic_realisations>
	<minimum_unit_technical_cost_cutoff>3.0</minimum_unit_technical_cost_cutoff>
	<maximum_unit_technical_cost_cutoff>8.0</maximum_unit_technical_cost_cutoff>
	<minimum_unit_technical_cost_cutoff_deep>4.0</minimum_unit_technical_cost_cutoff_deep>
	<maximum_unit_technical_cost_cutoff_deep>10.0</maximum_unit_technical_cost_cutoff_deep>
	<stochastic_calculation_parameters>
		<row_1>aquiferName;10;0;1</row_1>
	</stochastic_calculation_parameters>
	<input__calc_potential__scenario_name__must_exist_>BaseCase</input__calc_potential__scenario_name__must_exist_>
	<aquifers_to_use_in_overview_calculation></aquifers_to_use_in_overview_calculation>
	<mask_file__for_output_geometry_>/data/InputData/ahn2_250m_filled.nc</mask_file__for_output_geometry_>
	<xy_grid_size_factor_for_mask_grid>1</xy_grid_size_factor_for_mask_grid>
	<max_undefined_cells__of_surrounding_4__for_interp_overview>3.0</max_undefined_cells__of_surrounding_4__for_interp_overview>
	<p_value_overview_potential_category_1>50.0</p_value_overview_potential_category_1>
	<p_value_overview_potential_category_2__0__not_used_>30.0</p_value_overview_potential_category_2__0__not_used_>
	<p_value_overview_potential_category_3__0__not_used_>10.0</p_value_overview_potential_category_3__0__not_used_>
	<p_value_overview_potential_category_4__0__not_used_>0.0</p_value_overview_potential_category_4__0__not_used_>
	<power_category_1>5.0</power_category_1>
	<power_category_2__0__not_used_>7.5</power_category_2__0__not_used_>
	<power_category_3__0__not_used_>10.0</power_category_3__0__not_used_>
	<power_category_4__0__not_used_>20.0</power_category_4__0__not_used_>
	<additional_p_values_for_the_overview_power_probability_map_and_recoverable_heat_maps>90</additional_p_values_for_the_overview_power_probability_map_and_recoverable_heat_maps>
	<power_value_for_overview_power_probability_map>10.0</power_value_for_overview_power_probability_map>
	<input_scenario_name>BaseCase</input_scenario_name>
	<aquifers_to_use_in_voi_calculation>RO_STACKED</aquifers_to_use_in_voi_calculation>
	<minimum_npv_for_portfolio_repeat>1.0</minimum_npv_for_portfolio_repeat>
	<upward_and_downward_change_of_pos>15.0</upward_and_downward_change_of_pos>
	<general_upward_change_of_pos>5.0</general_upward_change_of_pos>
	<maximum_number_of_failures>2.0</maximum_number_of_failures>
	<repeat_potential_in_portfolio>10.0</repeat_potential_in_portfolio>
	<output_grid_file_type___zmap___asc___nc__beta__>.zmap</output_grid_file_type___zmap___asc___nc__beta__>
	<remove_padding_from_input_grids>0</remove_padding_from_input_grids>
</project>
 No newline at end of file
+0 −0

Empty file added.

+26 −0
Original line number Diff line number Diff line
import os
from pathlib import Path
from git import Repo
from pydantic import BaseModel, model_validator



class WP5Parameters(BaseModel):
    aquifers: list[str]
    stacked_aquifers: list[str]
    data_path: Path | None = None
    docker_image_tag: str


class Config(BaseModel):
    model_path: Path | None
    model_name: str
    grid_extension: str
    WP5: WP5Parameters

    @model_validator(mode="after")
    def set_paths(self):
        if not self.model_path:
            repo_path = Path(Repo(".", search_parent_directories=True).working_tree_dir)
            self.model_path = repo_path / "models" / self.model_name
        return self
Loading