{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Advanced usage: The `MorphingWorkflow` classes: `MorphingWorkflowGlobal` and `MorphingWorkflowEurope` (v4 Update)\n", "\n", "This notebook demonstrates the advanced, step-by-step approach to morphing EPW files using the specialized `MorphingWorkflow` classes (`MorphingWorkflowGlobal` and `MorphingWorkflowEurope`).\n", "\n", "While the `morph_epw_*` functions are great for direct, one-shot tasks, the workflow classes are designed for complex projects where you need full control over **filename parsing, custom renaming, and process validation**. They enforce a safe, multi-step process that allows you to review and confirm each stage before executing the time-consuming morphing computation.\n", "\n", "This notebook will focus on **`MorphingWorkflowGlobal`**, and will show a quick example using **`MorphingWorkflowEurope`** highlighting the differences.\n", "\n", "**Note:** `pyfwg` now fully supports **FutureWeatherGenerator v4.0.x** (Global) and **v2.0.x** (Europe), which include a new keyword-based CLI, support for string-based parameter options, and additional output formats (like .met or .csv)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## The Three-Step Workflow\n", "\n", "The class is designed to be used as a state machine, guiding you through a logical sequence:\n", "\n", "1. **`map_categories()`**: Analyze the input filenames to extract meaningful data (like city, building type, etc.).\n", "2. **`configure_and_preview()`**: Define all execution parameters, validate them, and generate a \"dry run\" plan of how the final files will be named and organized.\n", "3. **`execute_morphing()`**: Run the final computation, confident that your plan and configuration are correct." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Using `MorphingWorkflowGlobal`" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### General Setup\n", "\n", "First, we'll import the necessary class and set up the paths for our files. \n", "\n", "**Important:** You must change the `jar_path` variable to the correct location of your Future Weather Generator `.jar` file. `pyfwg` will automatically detect the version and adapt the CLI command accordingly." ] }, { "cell_type": "code", "metadata": { "ExecuteTime": { "end_time": "2025-12-30T11:39:49.744576Z", "start_time": "2025-12-30T11:39:49.725570Z" } }, "source": [ "import os\n", "import pandas as pd\n", "from pyfwg import MorphingWorkflowGlobal, DEFAULT_GLOBAL_GCMS\n", "\n", "# --- Configuration ---\n", "# !!! IMPORTANT: Update this path to your V4 JAR !!!\n", "jar_path = r\"D:\\OneDrive - Universidad de Cádiz (uca.es)\\Programas\\FutureWeatherGenerator_v4.0.2.jar\"\n", "\n", "# --- Define file paths for the examples ---\n", "pattern_epw_dir = 'epws/w_pattern'\n", "keyword_epw_dir = 'epws/wo_pattern'" ], "outputs": [], "execution_count": 15 }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Step 1: Map Categories from Filenames\n", "\n", "This is the first and most critical step for organizing your workflow. The `map_categories` method analyzes your source filenames and extracts meaningful data that will be used later for renaming the output files.\n", "\n", "#### `map_categories` Parameters\n", "\n", "The parameters you can use are:\n", "\n", "* `epw_files` (`List[str]`): **Required.** A list of paths to the EPW files you want to process.\n", "* `input_filename_pattern` (`Optional[str]`, default: `None`): A Python regex string with **named capture groups** (e.g., `(?P...)`) to extract structured data from filenames.\n", "* `keyword_mapping` (`Optional[Dict]`, default: `None`): A dictionary of rules. It can be used to normalize values from the pattern or to search the entire filename for keywords to assign categories." ] }, { "cell_type": "code", "metadata": { "ExecuteTime": { "end_time": "2025-12-30T11:39:49.792140Z", "start_time": "2025-12-30T11:39:49.767631Z" } }, "source": [ "# Instantiate a workflow object for this example\n", "workflow = MorphingWorkflowGlobal()\n", "\n", "epw_files_without_pattern = [os.path.join(keyword_epw_dir, f) for f in os.listdir(keyword_epw_dir) if f.endswith('.epw')]\n", "\n", "mapping_rules = {\n", " 'city': {\n", " 'Seville': ['sevilla', 'SVQ'],\n", " 'London': ['london', 'gatwick']\n", " },\n", " 'uhi': {\n", " 'type-1': 'type-1',\n", " 'type-2': 'type-2'\n", " }\n", "}\n", "\n", "workflow.map_categories(\n", " epw_files=epw_files_without_pattern,\n", " input_filename_pattern=None,\n", " keyword_mapping=mapping_rules\n", ")" ], "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "\u001B[32m2025-12-30 12:39:49 - INFO - --- Step 1: Mapping categories from filenames ---\u001B[0m\n", "\u001B[32m2025-12-30 12:39:49 - INFO - Mapped 'epws/wo_pattern\\GBR_London.Gatwick.037760_IWEC_uhi_type-2.epw': {'city': 'London', 'uhi': 'type-2'}\u001B[0m\n", "\u001B[32m2025-12-30 12:39:49 - INFO - Mapped 'epws/wo_pattern\\sevilla_in_this_one_the_uhi_is_type-1.epw': {'city': 'Seville', 'uhi': 'type-1'}\u001B[0m\n", "\u001B[32m2025-12-30 12:39:49 - INFO - Category mapping complete.\u001B[0m\n" ] } ], "execution_count": 16 }, { "metadata": {}, "cell_type": "markdown", "source": [ "### Step 2: Configure and Preview the Plan (V4 Update)\n", "\n", "In V4, you can use descriptive strings for interpolation methods (e.g., `'AVG4P'`) and solar hour adjustments (e.g., `'By_Month'`). You can also specify the `fwg_version` to force the new CLI.\n", "\n", "#### `configure_and_preview` Parameters\n", "\n", "##### Workflow Parameters\n", "* `final_output_dir` (`str`): **Required.** The path for the final output files.\n", "* `output_filename_pattern` (`str`): **Required.** The template for final filenames.\n", "* `scenario_mapping` (`Optional[Dict]`, default: `None`): A dictionary to translate raw scenario names.\n", "* `fwg_jar_path` (`str`): **Required.** Path to the `.jar` file.\n", "* `fwg_version` (`Optional[str]`): Force a specific CLI version (e.g., `'4'`).\n", "* `fwg_output_type` (`str`, default: `'EPW'`): **New in V4/Europe v2.** Format of output files: `'EPW'`, `'SPAIN_MET'`, or `'PORTUGAL_CSV'`." ] }, { "metadata": { "ExecuteTime": { "end_time": "2025-12-30T11:39:49.838830Z", "start_time": "2025-12-30T11:39:49.820260Z" } }, "cell_type": "code", "source": [ "workflow.configure_and_preview(\n", " final_output_dir='./final_results_workflow_global',\n", " output_filename_pattern='{city}_{uhi}_{ssp}_{year}_interp-{fwg_interpolation_method_id}',\n", " scenario_mapping={'ssp245': 'SSP2-4.5', 'ssp585': 'SSP5-8.5'},\n", " \n", " # --- FWG Configuration ---\n", " fwg_jar_path=jar_path,\n", " fwg_gcms=['BCC_CSM2_MR'], \n", " fwg_interpolation_method_id='AVG4P', # V4: Descriptive string\n", " fwg_epw_original_lcz=2, \n", " fwg_target_uhi_lcz=3, \n", " fwg_version='4', # Force V4 syntax\n", " fwg_show_tool_output=True\n", ")" ], "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "\u001B[32m2025-12-30 12:39:49 - INFO - --- Step 2: Configuring and Previewing Morphing Plan ---\u001B[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\n", "============================================================\n", " MORPHING CONFIGURATION & PREVIEW\n", "============================================================\n", " - FWG JAR Path: D:\\OneDrive - Universidad de Cádiz (uca.es)\\Programas\\FutureWeatherGenerator_v4.0.2.jar\n", " - Final Output Directory: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_global\n", " - EPWs to be Morphed (2 files):\n", " - GBR_London.Gatwick.037760_IWEC_uhi_type-2.epw\n", " - sevilla_in_this_one_the_uhi_is_type-1.epw\n", "\n", " For input file: GBR_London.Gatwick.037760_IWEC_uhi_type-2.epw\n", " -> Generated 'ssp126_2050.epw' will be moved to: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_global\\London_type-2_ssp126_2050_interp-AVG4P.epw\n", " -> Generated 'ssp245_2050.epw' will be moved to: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_global\\London_type-2_SSP2-4.5_2050_interp-AVG4P.epw\n", " -> Generated 'ssp370_2050.epw' will be moved to: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_global\\London_type-2_ssp370_2050_interp-AVG4P.epw\n", " -> Generated 'ssp585_2050.epw' will be moved to: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_global\\London_type-2_SSP5-8.5_2050_interp-AVG4P.epw\n", " -> Generated 'ssp126_2080.epw' will be moved to: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_global\\London_type-2_ssp126_2080_interp-AVG4P.epw\n", " -> Generated 'ssp245_2080.epw' will be moved to: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_global\\London_type-2_SSP2-4.5_2080_interp-AVG4P.epw\n", " -> Generated 'ssp370_2080.epw' will be moved to: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_global\\London_type-2_ssp370_2080_interp-AVG4P.epw\n", " -> Generated 'ssp585_2080.epw' will be moved to: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_global\\London_type-2_SSP5-8.5_2080_interp-AVG4P.epw\n", "\n", " For input file: sevilla_in_this_one_the_uhi_is_type-1.epw\n", " -> Generated 'ssp126_2050.epw' will be moved to: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_global\\Seville_type-1_ssp126_2050_interp-AVG4P.epw\n", " -> Generated 'ssp245_2050.epw' will be moved to: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_global\\Seville_type-1_SSP2-4.5_2050_interp-AVG4P.epw\n", " -> Generated 'ssp370_2050.epw' will be moved to: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_global\\Seville_type-1_ssp370_2050_interp-AVG4P.epw\n", " -> Generated 'ssp585_2050.epw' will be moved to: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_global\\Seville_type-1_SSP5-8.5_2050_interp-AVG4P.epw\n", " -> Generated 'ssp126_2080.epw' will be moved to: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_global\\Seville_type-1_ssp126_2080_interp-AVG4P.epw\n", " -> Generated 'ssp245_2080.epw' will be moved to: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_global\\Seville_type-1_SSP2-4.5_2080_interp-AVG4P.epw\n", " -> Generated 'ssp370_2080.epw' will be moved to: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_global\\Seville_type-1_ssp370_2080_interp-AVG4P.epw\n", " -> Generated 'ssp585_2080.epw' will be moved to: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_global\\Seville_type-1_SSP5-8.5_2080_interp-AVG4P.epw\n", "============================================================\n", "Configuration set. Call execute_morphing() to start the process.\n" ] } ], "execution_count": 17 }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Step 3: Execute the Morphing Process\n", "\n", "This is the final step. The `execute_morphing` method runs the computation. With V4, it will use the new keyword-based CLI." ] }, { "metadata": { "ExecuteTime": { "end_time": "2025-12-30T11:41:15.685513Z", "start_time": "2025-12-30T11:39:49.865205Z" } }, "cell_type": "code", "source": "workflow.execute_morphing()", "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "\u001B[32m2025-12-30 12:39:49 - INFO - --- Step 4: Executing morphing workflow ---\u001B[0m\n", "\u001B[32m2025-12-30 12:39:49 - INFO - Validating LCZ availability for GBR_London.Gatwick.037760_IWEC_uhi_type-2.epw...\u001B[0m\n", "\u001B[32m2025-12-30 12:39:49 - INFO - Checking LCZ pair (Original: 2, Target: 3) availability for GBR_London.Gatwick.037760_IWEC_uhi_type-2.epw...\u001B[0m\n", "\u001B[32m2025-12-30 12:39:49 - INFO - --- Applying UHI effect to GBR_London.Gatwick.037760_IWEC_uhi_type-2.epw ---\u001B[0m\n", "\u001B[32m2025-12-30 12:39:49 - INFO - Executing command: java -jar \"D:\\OneDrive - Universidad de Cádiz (uca.es)\\Programas\\FutureWeatherGenerator_v4.0.2.jar\" -u -epw=C:\\Users\\sanga\\AppData\\Local\\Temp\\tmp9ikq7m2w\\GBR_London.Gatwick.037760_IWEC_uhi_type-2.epw -output_folder=C:\\Users\\sanga\\AppData\\Local\\Temp\\tmp9ikq7m2w\\ -uhi=true:2:3 -output_type=EPW\u001B[0m\n", "\u001B[32m2025-12-30 12:40:05 - INFO - UHI effect applied successfully.\u001B[0m\n", "\u001B[32m2025-12-30 12:40:05 - INFO - LCZ pair (Original: 2, Target: 3) is available.\u001B[0m\n", "\u001B[32m2025-12-30 12:40:05 - INFO - Copied input file to temporary directory: ./morphing_temp_results\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_London.Gatwick.037760_IWEC_uhi_type-2.epw\u001B[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\n", "-------------------- Executing FWG for GBR_London.Gatwick.037760_IWEC_uhi_type-2.epw --------------------\n", " Full Command (for reference): java -jar \"D:\\OneDrive - Universidad de Cádiz (uca.es)\\Programas\\FutureWeatherGenerator_v4.0.2.jar\" -epw=D:\\Python\\pyfwg\\pyfwg\\tutorials\\morphing_temp_results\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_London.Gatwick.037760_IWEC_uhi_type-2.epw D:\\Python\\pyfwg\\pyfwg\\tutorials\\epws\\wo_pattern\\GBR_London.Gatwick.037760_IWEC_uhi_type-2.epw -models=BCC_CSM2_MR -ensemble=true -temp_shift_winter=0.0 -temp_shift_summer=0.0 -smooth_hours=72 -multithread=true -grid_interpolation_method=AVG4P -solar_correction=By_Month -diffuse_method=Engerer_2015 -uhi=true:2:3 -output_type=EPW\n", " --- FWG Real-time Output ---\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "\u001B[32m2025-12-30 12:40:32 - INFO - Processing generated files in: ./morphing_temp_results\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\u001B[0m\n", "\u001B[32m2025-12-30 12:40:32 - INFO - Skipping auxiliary file: '00_logs'\u001B[0m\n", "\u001B[32m2025-12-30 12:40:32 - INFO - Skipping auxiliary file: '01_processing_transcripts'\u001B[0m\n", "\u001B[32m2025-12-30 12:40:32 - INFO - Skipping auxiliary file: '02_morphing_errors_and_warnings'\u001B[0m\n", "\u001B[32m2025-12-30 12:40:32 - INFO - Skipping auxiliary file: '03_model_variables'\u001B[0m\n", "\u001B[32m2025-12-30 12:40:32 - INFO - Skipping auxiliary file: '04_epw_comparisons'\u001B[0m\n", "\u001B[32m2025-12-30 12:40:32 - INFO - Moving './morphing_temp_results\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_-_LONDON-GATWICK_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp126_2050.epw' to './final_results_workflow_global\\London_type-2_ssp126_2050_interp-AVG4P.epw'\u001B[0m\n", "\u001B[32m2025-12-30 12:40:32 - INFO - Moving './morphing_temp_results\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_-_LONDON-GATWICK_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp126_2050.stat' to './final_results_workflow_global\\London_type-2_ssp126_2050_interp-AVG4P.stat'\u001B[0m\n", "\u001B[32m2025-12-30 12:40:32 - INFO - Moving './morphing_temp_results\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_-_LONDON-GATWICK_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp126_2080.epw' to './final_results_workflow_global\\London_type-2_ssp126_2080_interp-AVG4P.epw'\u001B[0m\n", "\u001B[32m2025-12-30 12:40:32 - INFO - Moving './morphing_temp_results\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_-_LONDON-GATWICK_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp126_2080.stat' to './final_results_workflow_global\\London_type-2_ssp126_2080_interp-AVG4P.stat'\u001B[0m\n", "\u001B[32m2025-12-30 12:40:32 - INFO - Moving './morphing_temp_results\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_-_LONDON-GATWICK_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp245_2050.epw' to './final_results_workflow_global\\London_type-2_SSP2-4.5_2050_interp-AVG4P.epw'\u001B[0m\n", "\u001B[32m2025-12-30 12:40:32 - INFO - Moving './morphing_temp_results\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_-_LONDON-GATWICK_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp245_2050.stat' to './final_results_workflow_global\\London_type-2_SSP2-4.5_2050_interp-AVG4P.stat'\u001B[0m\n", "\u001B[32m2025-12-30 12:40:32 - INFO - Moving './morphing_temp_results\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_-_LONDON-GATWICK_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp245_2080.epw' to './final_results_workflow_global\\London_type-2_SSP2-4.5_2080_interp-AVG4P.epw'\u001B[0m\n", "\u001B[32m2025-12-30 12:40:32 - INFO - Moving './morphing_temp_results\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_-_LONDON-GATWICK_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp245_2080.stat' to './final_results_workflow_global\\London_type-2_SSP2-4.5_2080_interp-AVG4P.stat'\u001B[0m\n", "\u001B[32m2025-12-30 12:40:32 - INFO - Moving './morphing_temp_results\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_-_LONDON-GATWICK_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp370_2050.epw' to './final_results_workflow_global\\London_type-2_ssp370_2050_interp-AVG4P.epw'\u001B[0m\n", "\u001B[32m2025-12-30 12:40:32 - INFO - Moving './morphing_temp_results\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_-_LONDON-GATWICK_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp370_2050.stat' to './final_results_workflow_global\\London_type-2_ssp370_2050_interp-AVG4P.stat'\u001B[0m\n", "\u001B[32m2025-12-30 12:40:32 - INFO - Moving './morphing_temp_results\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_-_LONDON-GATWICK_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp370_2080.epw' to './final_results_workflow_global\\London_type-2_ssp370_2080_interp-AVG4P.epw'\u001B[0m\n", "\u001B[32m2025-12-30 12:40:32 - INFO - Moving './morphing_temp_results\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_-_LONDON-GATWICK_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp370_2080.stat' to './final_results_workflow_global\\London_type-2_ssp370_2080_interp-AVG4P.stat'\u001B[0m\n", "\u001B[32m2025-12-30 12:40:32 - INFO - Moving './morphing_temp_results\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_-_LONDON-GATWICK_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp585_2050.epw' to './final_results_workflow_global\\London_type-2_SSP5-8.5_2050_interp-AVG4P.epw'\u001B[0m\n", "\u001B[32m2025-12-30 12:40:32 - INFO - Moving './morphing_temp_results\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_-_LONDON-GATWICK_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp585_2050.stat' to './final_results_workflow_global\\London_type-2_SSP5-8.5_2050_interp-AVG4P.stat'\u001B[0m\n", "\u001B[32m2025-12-30 12:40:32 - INFO - Moving './morphing_temp_results\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_-_LONDON-GATWICK_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp585_2080.epw' to './final_results_workflow_global\\London_type-2_SSP5-8.5_2080_interp-AVG4P.epw'\u001B[0m\n", "\u001B[32m2025-12-30 12:40:32 - INFO - Moving './morphing_temp_results\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_-_LONDON-GATWICK_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp585_2080.stat' to './final_results_workflow_global\\London_type-2_SSP5-8.5_2080_interp-AVG4P.stat'\u001B[0m\n", "\u001B[33m2025-12-30 12:40:32 - WARNING - Could not find a rename plan for file 'GBR_-_LONDON-GATWICK_UHI_Target_LCZ-3_Original_LCZ-2_Present-day.epw'. It will be left in the temp directory.\u001B[0m\n", "\u001B[32m2025-12-30 12:40:32 - INFO - Skipping auxiliary file: 'README.html'\u001B[0m\n", "\u001B[32m2025-12-30 12:40:32 - INFO - Skipping auxiliary file: 'UHI_AirTemperature_2500'\u001B[0m\n", "\u001B[32m2025-12-30 12:40:32 - INFO - Deleting temporary directory: ./morphing_temp_results\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\u001B[0m\n", "\u001B[33m2025-12-30 12:40:32 - WARNING - PermissionError deleting ./morphing_temp_results\\GBR_London.Gatwick.037760_IWEC_uhi_type-2. Retrying in 0.5s... (Attempt 1/5)\u001B[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ " --- End of FWG Output ---\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "\u001B[33m2025-12-30 12:40:33 - WARNING - PermissionError deleting ./morphing_temp_results\\GBR_London.Gatwick.037760_IWEC_uhi_type-2. Retrying in 0.5s... (Attempt 2/5)\u001B[0m\n", "\u001B[32m2025-12-30 12:40:33 - INFO - Validating LCZ availability for sevilla_in_this_one_the_uhi_is_type-1.epw...\u001B[0m\n", "\u001B[32m2025-12-30 12:40:33 - INFO - Checking LCZ pair (Original: 2, Target: 3) availability for sevilla_in_this_one_the_uhi_is_type-1.epw...\u001B[0m\n", "\u001B[32m2025-12-30 12:40:33 - INFO - --- Applying UHI effect to sevilla_in_this_one_the_uhi_is_type-1.epw ---\u001B[0m\n", "\u001B[32m2025-12-30 12:40:33 - INFO - Executing command: java -jar \"D:\\OneDrive - Universidad de Cádiz (uca.es)\\Programas\\FutureWeatherGenerator_v4.0.2.jar\" -u -epw=C:\\Users\\sanga\\AppData\\Local\\Temp\\tmpv9l3_d4y\\sevilla_in_this_one_the_uhi_is_type-1.epw -output_folder=C:\\Users\\sanga\\AppData\\Local\\Temp\\tmpv9l3_d4y\\ -uhi=true:2:3 -output_type=EPW\u001B[0m\n", "\u001B[32m2025-12-30 12:40:48 - INFO - UHI effect applied successfully.\u001B[0m\n", "\u001B[32m2025-12-30 12:40:48 - INFO - LCZ pair (Original: 2, Target: 3) is available.\u001B[0m\n", "\u001B[32m2025-12-30 12:40:48 - INFO - Copied input file to temporary directory: ./morphing_temp_results\\sevilla_in_this_one_the_uhi_is_type-1\\sevilla_in_this_one_the_uhi_is_type-1.epw\u001B[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\n", "-------------------- Executing FWG for sevilla_in_this_one_the_uhi_is_type-1.epw --------------------\n", " Full Command (for reference): java -jar \"D:\\OneDrive - Universidad de Cádiz (uca.es)\\Programas\\FutureWeatherGenerator_v4.0.2.jar\" -epw=D:\\Python\\pyfwg\\pyfwg\\tutorials\\morphing_temp_results\\sevilla_in_this_one_the_uhi_is_type-1\\sevilla_in_this_one_the_uhi_is_type-1.epw D:\\Python\\pyfwg\\pyfwg\\tutorials\\epws\\wo_pattern\\sevilla_in_this_one_the_uhi_is_type-1.epw -models=BCC_CSM2_MR -ensemble=true -temp_shift_winter=0.0 -temp_shift_summer=0.0 -smooth_hours=72 -multithread=true -grid_interpolation_method=AVG4P -solar_correction=By_Month -diffuse_method=Engerer_2015 -uhi=true:2:3 -output_type=EPW\n", " --- FWG Real-time Output ---\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "\u001B[32m2025-12-30 12:41:14 - INFO - Processing generated files in: ./morphing_temp_results\\sevilla_in_this_one_the_uhi_is_type-1\u001B[0m\n", "\u001B[32m2025-12-30 12:41:14 - INFO - Skipping auxiliary file: '00_logs'\u001B[0m\n", "\u001B[32m2025-12-30 12:41:14 - INFO - Skipping auxiliary file: '01_processing_transcripts'\u001B[0m\n", "\u001B[32m2025-12-30 12:41:14 - INFO - Skipping auxiliary file: '02_morphing_errors_and_warnings'\u001B[0m\n", "\u001B[32m2025-12-30 12:41:14 - INFO - Skipping auxiliary file: '03_model_variables'\u001B[0m\n", "\u001B[32m2025-12-30 12:41:14 - INFO - Skipping auxiliary file: '04_epw_comparisons'\u001B[0m\n", "\u001B[32m2025-12-30 12:41:14 - INFO - Moving './morphing_temp_results\\sevilla_in_this_one_the_uhi_is_type-1\\ESP_-_SEVILLA_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp126_2050.epw' to './final_results_workflow_global\\Seville_type-1_ssp126_2050_interp-AVG4P.epw'\u001B[0m\n", "\u001B[32m2025-12-30 12:41:14 - INFO - Moving './morphing_temp_results\\sevilla_in_this_one_the_uhi_is_type-1\\ESP_-_SEVILLA_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp126_2050.stat' to './final_results_workflow_global\\Seville_type-1_ssp126_2050_interp-AVG4P.stat'\u001B[0m\n", "\u001B[32m2025-12-30 12:41:15 - INFO - Moving './morphing_temp_results\\sevilla_in_this_one_the_uhi_is_type-1\\ESP_-_SEVILLA_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp126_2080.epw' to './final_results_workflow_global\\Seville_type-1_ssp126_2080_interp-AVG4P.epw'\u001B[0m\n", "\u001B[32m2025-12-30 12:41:15 - INFO - Moving './morphing_temp_results\\sevilla_in_this_one_the_uhi_is_type-1\\ESP_-_SEVILLA_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp126_2080.stat' to './final_results_workflow_global\\Seville_type-1_ssp126_2080_interp-AVG4P.stat'\u001B[0m\n", "\u001B[32m2025-12-30 12:41:15 - INFO - Moving './morphing_temp_results\\sevilla_in_this_one_the_uhi_is_type-1\\ESP_-_SEVILLA_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp245_2050.epw' to './final_results_workflow_global\\Seville_type-1_SSP2-4.5_2050_interp-AVG4P.epw'\u001B[0m\n", "\u001B[32m2025-12-30 12:41:15 - INFO - Moving './morphing_temp_results\\sevilla_in_this_one_the_uhi_is_type-1\\ESP_-_SEVILLA_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp245_2050.stat' to './final_results_workflow_global\\Seville_type-1_SSP2-4.5_2050_interp-AVG4P.stat'\u001B[0m\n", "\u001B[32m2025-12-30 12:41:15 - INFO - Moving './morphing_temp_results\\sevilla_in_this_one_the_uhi_is_type-1\\ESP_-_SEVILLA_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp245_2080.epw' to './final_results_workflow_global\\Seville_type-1_SSP2-4.5_2080_interp-AVG4P.epw'\u001B[0m\n", "\u001B[32m2025-12-30 12:41:15 - INFO - Moving './morphing_temp_results\\sevilla_in_this_one_the_uhi_is_type-1\\ESP_-_SEVILLA_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp245_2080.stat' to './final_results_workflow_global\\Seville_type-1_SSP2-4.5_2080_interp-AVG4P.stat'\u001B[0m\n", "\u001B[32m2025-12-30 12:41:15 - INFO - Moving './morphing_temp_results\\sevilla_in_this_one_the_uhi_is_type-1\\ESP_-_SEVILLA_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp370_2050.epw' to './final_results_workflow_global\\Seville_type-1_ssp370_2050_interp-AVG4P.epw'\u001B[0m\n", "\u001B[32m2025-12-30 12:41:15 - INFO - Moving './morphing_temp_results\\sevilla_in_this_one_the_uhi_is_type-1\\ESP_-_SEVILLA_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp370_2050.stat' to './final_results_workflow_global\\Seville_type-1_ssp370_2050_interp-AVG4P.stat'\u001B[0m\n", "\u001B[32m2025-12-30 12:41:15 - INFO - Moving './morphing_temp_results\\sevilla_in_this_one_the_uhi_is_type-1\\ESP_-_SEVILLA_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp370_2080.epw' to './final_results_workflow_global\\Seville_type-1_ssp370_2080_interp-AVG4P.epw'\u001B[0m\n", "\u001B[32m2025-12-30 12:41:15 - INFO - Moving './morphing_temp_results\\sevilla_in_this_one_the_uhi_is_type-1\\ESP_-_SEVILLA_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp370_2080.stat' to './final_results_workflow_global\\Seville_type-1_ssp370_2080_interp-AVG4P.stat'\u001B[0m\n", "\u001B[32m2025-12-30 12:41:15 - INFO - Moving './morphing_temp_results\\sevilla_in_this_one_the_uhi_is_type-1\\ESP_-_SEVILLA_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp585_2050.epw' to './final_results_workflow_global\\Seville_type-1_SSP5-8.5_2050_interp-AVG4P.epw'\u001B[0m\n", "\u001B[32m2025-12-30 12:41:15 - INFO - Moving './morphing_temp_results\\sevilla_in_this_one_the_uhi_is_type-1\\ESP_-_SEVILLA_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp585_2050.stat' to './final_results_workflow_global\\Seville_type-1_SSP5-8.5_2050_interp-AVG4P.stat'\u001B[0m\n", "\u001B[32m2025-12-30 12:41:15 - INFO - Moving './morphing_temp_results\\sevilla_in_this_one_the_uhi_is_type-1\\ESP_-_SEVILLA_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp585_2080.epw' to './final_results_workflow_global\\Seville_type-1_SSP5-8.5_2080_interp-AVG4P.epw'\u001B[0m\n", "\u001B[32m2025-12-30 12:41:15 - INFO - Moving './morphing_temp_results\\sevilla_in_this_one_the_uhi_is_type-1\\ESP_-_SEVILLA_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_ssp585_2080.stat' to './final_results_workflow_global\\Seville_type-1_SSP5-8.5_2080_interp-AVG4P.stat'\u001B[0m\n", "\u001B[33m2025-12-30 12:41:15 - WARNING - Could not find a rename plan for file 'ESP_-_SEVILLA_UHI_Target_LCZ-3_Original_LCZ-2_Present-day.epw'. It will be left in the temp directory.\u001B[0m\n", "\u001B[32m2025-12-30 12:41:15 - INFO - Skipping auxiliary file: 'README.html'\u001B[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ " --- End of FWG Output ---\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "\u001B[32m2025-12-30 12:41:15 - INFO - Skipping auxiliary file: 'UHI_AirTemperature_10000'\u001B[0m\n", "\u001B[32m2025-12-30 12:41:15 - INFO - Deleting temporary directory: ./morphing_temp_results\\sevilla_in_this_one_the_uhi_is_type-1\u001B[0m\n", "\u001B[33m2025-12-30 12:41:15 - WARNING - PermissionError deleting ./morphing_temp_results\\sevilla_in_this_one_the_uhi_is_type-1. Retrying in 0.5s... (Attempt 1/5)\u001B[0m\n", "\u001B[32m2025-12-30 12:41:15 - INFO - Morphing workflow finished.\u001B[0m\n" ] } ], "execution_count": 18 }, { "metadata": {}, "cell_type": "markdown", "source": "Let's take a look at the files we just generated:" }, { "metadata": { "ExecuteTime": { "end_time": "2025-12-30T11:41:15.762975Z", "start_time": "2025-12-30T11:41:15.743703Z" } }, "cell_type": "code", "source": [ "output_files = [i for i in os.listdir('./final_results_workflow_global')]\n", "output_files" ], "outputs": [ { "data": { "text/plain": [ "['London_type-2_ssp126_2050_interp-AVG4P.epw',\n", " 'London_type-2_ssp126_2050_interp-AVG4P.stat',\n", " 'London_type-2_ssp126_2080_interp-AVG4P.epw',\n", " 'London_type-2_ssp126_2080_interp-AVG4P.stat',\n", " 'London_type-2_SSP2-4.5_2050_interp-AVG4P.epw',\n", " 'London_type-2_SSP2-4.5_2050_interp-AVG4P.stat',\n", " 'London_type-2_SSP2-4.5_2080_interp-AVG4P.epw',\n", " 'London_type-2_SSP2-4.5_2080_interp-AVG4P.stat',\n", " 'London_type-2_ssp370_2050_interp-AVG4P.epw',\n", " 'London_type-2_ssp370_2050_interp-AVG4P.stat',\n", " 'London_type-2_ssp370_2080_interp-AVG4P.epw',\n", " 'London_type-2_ssp370_2080_interp-AVG4P.stat',\n", " 'London_type-2_SSP5-8.5_2050_interp-AVG4P.epw',\n", " 'London_type-2_SSP5-8.5_2050_interp-AVG4P.stat',\n", " 'London_type-2_SSP5-8.5_2080_interp-AVG4P.epw',\n", " 'London_type-2_SSP5-8.5_2080_interp-AVG4P.stat',\n", " 'Seville_type-1_ssp126_2050_interp-AVG4P.epw',\n", " 'Seville_type-1_ssp126_2050_interp-AVG4P.stat',\n", " 'Seville_type-1_ssp126_2080_interp-AVG4P.epw',\n", " 'Seville_type-1_ssp126_2080_interp-AVG4P.stat',\n", " 'Seville_type-1_SSP2-4.5_2050_interp-AVG4P.epw',\n", " 'Seville_type-1_SSP2-4.5_2050_interp-AVG4P.stat',\n", " 'Seville_type-1_SSP2-4.5_2080_interp-AVG4P.epw',\n", " 'Seville_type-1_SSP2-4.5_2080_interp-AVG4P.stat',\n", " 'Seville_type-1_ssp370_2050_interp-AVG4P.epw',\n", " 'Seville_type-1_ssp370_2050_interp-AVG4P.stat',\n", " 'Seville_type-1_ssp370_2080_interp-AVG4P.epw',\n", " 'Seville_type-1_ssp370_2080_interp-AVG4P.stat',\n", " 'Seville_type-1_SSP5-8.5_2050_interp-AVG4P.epw',\n", " 'Seville_type-1_SSP5-8.5_2050_interp-AVG4P.stat',\n", " 'Seville_type-1_SSP5-8.5_2080_interp-AVG4P.epw',\n", " 'Seville_type-1_SSP5-8.5_2080_interp-AVG4P.stat']" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "execution_count": 19 }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Using `MorphingWorkflowEurope`" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Europe v2 Example\n", "\n", "**FutureWeatherGenerator Europe v2** also adopts the keyword-based CLI. Remember to use `fwg_rcm_pairs` instead of `fwg_gcms`, and `{rcp}` instead of `{ssp}` for renaming." ] }, { "metadata": { "ExecuteTime": { "end_time": "2025-12-30T11:43:06.732632Z", "start_time": "2025-12-30T11:41:15.786064Z" } }, "cell_type": "code", "source": [ "from pyfwg import MorphingWorkflowEurope, DEFAULT_EUROPE_RCMS\n", "\n", "# !!! IMPORTANT: Update this path to your Europe v2 JAR !!!\n", "jar_path_europe = r\"D:\\OneDrive - Universidad de Cádiz (uca.es)\\Programas\\FutureWeatherGenerator_Europe_v2.0.2.jar\"\n", "\n", "workflow_eu = MorphingWorkflowEurope()\n", "workflow_eu.map_categories(\n", " epw_files=epw_files_without_pattern,\n", " keyword_mapping=mapping_rules\n", ")\n", "\n", "workflow_eu.configure_and_preview(\n", " delete_temp_files=False,\n", " final_output_dir='./final_results_workflow_europe',\n", " output_filename_pattern='{city}_{uhi}_{rcp}_{year}',\n", " scenario_mapping={'rcp26': 'RCP-2.6'},\n", " fwg_jar_path=jar_path_europe,\n", " fwg_rcm_pairs=[list(DEFAULT_EUROPE_RCMS)[0]],\n", " fwg_epw_original_lcz=2,\n", " fwg_target_uhi_lcz=3,\n", " fwg_version='2', # Europe v2 keyword CLI\n", " fwg_output_type='PORTUGAL_CSV' # New: Generate CSV files\n", ")\n", "\n", "workflow_eu.execute_morphing()" ], "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "\u001B[32m2025-12-30 12:41:15 - INFO - --- Step 1: Mapping categories from filenames ---\u001B[0m\n", "\u001B[32m2025-12-30 12:41:15 - INFO - Mapped 'epws/wo_pattern\\GBR_London.Gatwick.037760_IWEC_uhi_type-2.epw': {'city': 'London', 'uhi': 'type-2'}\u001B[0m\n", "\u001B[32m2025-12-30 12:41:15 - INFO - Mapped 'epws/wo_pattern\\sevilla_in_this_one_the_uhi_is_type-1.epw': {'city': 'Seville', 'uhi': 'type-1'}\u001B[0m\n", "\u001B[32m2025-12-30 12:41:15 - INFO - Category mapping complete.\u001B[0m\n", "\u001B[32m2025-12-30 12:41:15 - INFO - --- Step 2: Configuring and Previewing Morphing Plan ---\u001B[0m\n", "\u001B[32m2025-12-30 12:41:15 - INFO - --- Step 4: Executing morphing workflow ---\u001B[0m\n", "\u001B[32m2025-12-30 12:41:15 - INFO - Validating LCZ availability for GBR_London.Gatwick.037760_IWEC_uhi_type-2.epw...\u001B[0m\n", "\u001B[32m2025-12-30 12:41:15 - INFO - Checking LCZ pair (Original: 2, Target: 3) availability for GBR_London.Gatwick.037760_IWEC_uhi_type-2.epw...\u001B[0m\n", "\u001B[32m2025-12-30 12:41:15 - INFO - --- Applying UHI effect to GBR_London.Gatwick.037760_IWEC_uhi_type-2.epw ---\u001B[0m\n", "\u001B[32m2025-12-30 12:41:15 - INFO - Executing command: java -jar \"D:\\OneDrive - Universidad de Cádiz (uca.es)\\Programas\\FutureWeatherGenerator_Europe_v2.0.2.jar\" -u -epw=C:\\Users\\sanga\\AppData\\Local\\Temp\\tmpjfenobte\\GBR_London.Gatwick.037760_IWEC_uhi_type-2.epw -output_folder=C:\\Users\\sanga\\AppData\\Local\\Temp\\tmpjfenobte\\ -uhi=true:2:3 -output_type=EPW\u001B[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\n", "============================================================\n", " MORPHING CONFIGURATION & PREVIEW\n", "============================================================\n", " - FWG JAR Path: D:\\OneDrive - Universidad de Cádiz (uca.es)\\Programas\\FutureWeatherGenerator_Europe_v2.0.2.jar\n", " - Final Output Directory: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_europe\n", " - EPWs to be Morphed (2 files):\n", " - GBR_London.Gatwick.037760_IWEC_uhi_type-2.epw\n", " - sevilla_in_this_one_the_uhi_is_type-1.epw\n", "\n", " For input file: GBR_London.Gatwick.037760_IWEC_uhi_type-2.epw\n", " -> Generated 'rcp26_2050.epw' will be moved to: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_europe\\London_type-2_RCP-2.6_2050.epw\n", " -> Generated 'rcp45_2050.epw' will be moved to: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_europe\\London_type-2_rcp45_2050.epw\n", " -> Generated 'rcp85_2050.epw' will be moved to: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_europe\\London_type-2_rcp85_2050.epw\n", " -> Generated 'rcp26_2080.epw' will be moved to: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_europe\\London_type-2_RCP-2.6_2080.epw\n", " -> Generated 'rcp45_2080.epw' will be moved to: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_europe\\London_type-2_rcp45_2080.epw\n", " -> Generated 'rcp85_2080.epw' will be moved to: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_europe\\London_type-2_rcp85_2080.epw\n", "\n", " For input file: sevilla_in_this_one_the_uhi_is_type-1.epw\n", " -> Generated 'rcp26_2050.epw' will be moved to: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_europe\\Seville_type-1_RCP-2.6_2050.epw\n", " -> Generated 'rcp45_2050.epw' will be moved to: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_europe\\Seville_type-1_rcp45_2050.epw\n", " -> Generated 'rcp85_2050.epw' will be moved to: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_europe\\Seville_type-1_rcp85_2050.epw\n", " -> Generated 'rcp26_2080.epw' will be moved to: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_europe\\Seville_type-1_RCP-2.6_2080.epw\n", " -> Generated 'rcp45_2080.epw' will be moved to: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_europe\\Seville_type-1_rcp45_2080.epw\n", " -> Generated 'rcp85_2080.epw' will be moved to: D:\\Python\\pyfwg\\pyfwg\\tutorials\\final_results_workflow_europe\\Seville_type-1_rcp85_2080.epw\n", "============================================================\n", "Configuration set. Call execute_morphing() to start the process.\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "\u001B[32m2025-12-30 12:41:32 - INFO - UHI effect applied successfully.\u001B[0m\n", "\u001B[32m2025-12-30 12:41:32 - INFO - LCZ pair (Original: 2, Target: 3) is available.\u001B[0m\n", "\u001B[32m2025-12-30 12:41:32 - INFO - Copied input file to temporary directory: ./morphing_temp_results_europe\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_London.Gatwick.037760_IWEC_uhi_type-2.epw\u001B[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\n", "-------------------- Executing FWG for GBR_London.Gatwick.037760_IWEC_uhi_type-2.epw --------------------\n", " Full Command (for reference): java -jar \"D:\\OneDrive - Universidad de Cádiz (uca.es)\\Programas\\FutureWeatherGenerator_Europe_v2.0.2.jar\" -epw=D:\\Python\\pyfwg\\pyfwg\\tutorials\\morphing_temp_results_europe\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_London.Gatwick.037760_IWEC_uhi_type-2.epw D:\\Python\\pyfwg\\pyfwg\\tutorials\\epws\\wo_pattern\\GBR_London.Gatwick.037760_IWEC_uhi_type-2.epw -models=MOHC_HadGEM2_ES_SMHI_RCA4 -ensemble=true -temp_shift_winter=0.0 -temp_shift_summer=0.0 -smooth_hours=72 -multithread=true -grid_interpolation_method=IDW -solar_correction=By_Month -diffuse_method=Engerer_2015 -uhi=true:2:3 -output_type=PORTUGAL_CSV\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "\u001B[32m2025-12-30 12:42:11 - INFO - Processing generated files in: ./morphing_temp_results_europe\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\u001B[0m\n", "\u001B[32m2025-12-30 12:42:11 - INFO - Skipping auxiliary file: '00_logs'\u001B[0m\n", "\u001B[32m2025-12-30 12:42:11 - INFO - Skipping auxiliary file: '01_processing_transcripts'\u001B[0m\n", "\u001B[32m2025-12-30 12:42:11 - INFO - Skipping auxiliary file: '02_morphing_errors_and_warnings'\u001B[0m\n", "\u001B[32m2025-12-30 12:42:11 - INFO - Skipping auxiliary file: '03_model_variables'\u001B[0m\n", "\u001B[32m2025-12-30 12:42:11 - INFO - Skipping auxiliary file: '04_epw_comparisons'\u001B[0m\n", "\u001B[32m2025-12-30 12:42:11 - INFO - Moving './morphing_temp_results_europe\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_-_LONDON-GATWICK_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_rcp26_2050.csv' to './final_results_workflow_europe\\London_type-2_RCP-2.6_2050.csv'\u001B[0m\n", "\u001B[32m2025-12-30 12:42:11 - INFO - Moving './morphing_temp_results_europe\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_-_LONDON-GATWICK_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_rcp26_2050.stat' to './final_results_workflow_europe\\London_type-2_RCP-2.6_2050.stat'\u001B[0m\n", "\u001B[32m2025-12-30 12:42:11 - INFO - Moving './morphing_temp_results_europe\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_-_LONDON-GATWICK_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_rcp26_2080.csv' to './final_results_workflow_europe\\London_type-2_RCP-2.6_2080.csv'\u001B[0m\n", "\u001B[32m2025-12-30 12:42:11 - INFO - Moving './morphing_temp_results_europe\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_-_LONDON-GATWICK_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_rcp26_2080.stat' to './final_results_workflow_europe\\London_type-2_RCP-2.6_2080.stat'\u001B[0m\n", "\u001B[32m2025-12-30 12:42:11 - INFO - Moving './morphing_temp_results_europe\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_-_LONDON-GATWICK_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_rcp45_2050.csv' to './final_results_workflow_europe\\London_type-2_rcp45_2050.csv'\u001B[0m\n", "\u001B[32m2025-12-30 12:42:11 - INFO - Moving './morphing_temp_results_europe\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_-_LONDON-GATWICK_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_rcp45_2050.stat' to './final_results_workflow_europe\\London_type-2_rcp45_2050.stat'\u001B[0m\n", "\u001B[32m2025-12-30 12:42:11 - INFO - Moving './morphing_temp_results_europe\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_-_LONDON-GATWICK_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_rcp45_2080.csv' to './final_results_workflow_europe\\London_type-2_rcp45_2080.csv'\u001B[0m\n", "\u001B[32m2025-12-30 12:42:11 - INFO - Moving './morphing_temp_results_europe\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_-_LONDON-GATWICK_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_rcp45_2080.stat' to './final_results_workflow_europe\\London_type-2_rcp45_2080.stat'\u001B[0m\n", "\u001B[32m2025-12-30 12:42:11 - INFO - Moving './morphing_temp_results_europe\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_-_LONDON-GATWICK_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_rcp85_2050.csv' to './final_results_workflow_europe\\London_type-2_rcp85_2050.csv'\u001B[0m\n", "\u001B[32m2025-12-30 12:42:11 - INFO - Moving './morphing_temp_results_europe\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_-_LONDON-GATWICK_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_rcp85_2050.stat' to './final_results_workflow_europe\\London_type-2_rcp85_2050.stat'\u001B[0m\n", "\u001B[32m2025-12-30 12:42:11 - INFO - Moving './morphing_temp_results_europe\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_-_LONDON-GATWICK_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_rcp85_2080.csv' to './final_results_workflow_europe\\London_type-2_rcp85_2080.csv'\u001B[0m\n", "\u001B[32m2025-12-30 12:42:11 - INFO - Moving './morphing_temp_results_europe\\GBR_London.Gatwick.037760_IWEC_uhi_type-2\\GBR_-_LONDON-GATWICK_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_rcp85_2080.stat' to './final_results_workflow_europe\\London_type-2_rcp85_2080.stat'\u001B[0m\n", "\u001B[33m2025-12-30 12:42:11 - WARNING - Could not find a rename plan for file 'GBR_-_LONDON-GATWICK_UHI_Target_LCZ-3_Original_LCZ-2_Present-day.csv'. It will be left in the temp directory.\u001B[0m\n", "\u001B[32m2025-12-30 12:42:11 - INFO - Skipping auxiliary file: 'README.html'\u001B[0m\n", "\u001B[32m2025-12-30 12:42:11 - INFO - Skipping auxiliary file: 'UHI_AirTemperature_2500'\u001B[0m\n", "\u001B[32m2025-12-30 12:42:11 - INFO - Validating LCZ availability for sevilla_in_this_one_the_uhi_is_type-1.epw...\u001B[0m\n", "\u001B[32m2025-12-30 12:42:11 - INFO - Checking LCZ pair (Original: 2, Target: 3) availability for sevilla_in_this_one_the_uhi_is_type-1.epw...\u001B[0m\n", "\u001B[32m2025-12-30 12:42:12 - INFO - --- Applying UHI effect to sevilla_in_this_one_the_uhi_is_type-1.epw ---\u001B[0m\n", "\u001B[32m2025-12-30 12:42:12 - INFO - Executing command: java -jar \"D:\\OneDrive - Universidad de Cádiz (uca.es)\\Programas\\FutureWeatherGenerator_Europe_v2.0.2.jar\" -u -epw=C:\\Users\\sanga\\AppData\\Local\\Temp\\tmpxjyhb_jo\\sevilla_in_this_one_the_uhi_is_type-1.epw -output_folder=C:\\Users\\sanga\\AppData\\Local\\Temp\\tmpxjyhb_jo\\ -uhi=true:2:3 -output_type=EPW\u001B[0m\n", "\u001B[32m2025-12-30 12:42:29 - INFO - UHI effect applied successfully.\u001B[0m\n", "\u001B[32m2025-12-30 12:42:29 - INFO - LCZ pair (Original: 2, Target: 3) is available.\u001B[0m\n", "\u001B[32m2025-12-30 12:42:29 - INFO - Copied input file to temporary directory: ./morphing_temp_results_europe\\sevilla_in_this_one_the_uhi_is_type-1\\sevilla_in_this_one_the_uhi_is_type-1.epw\u001B[0m\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\n", "-------------------- Executing FWG for sevilla_in_this_one_the_uhi_is_type-1.epw --------------------\n", " Full Command (for reference): java -jar \"D:\\OneDrive - Universidad de Cádiz (uca.es)\\Programas\\FutureWeatherGenerator_Europe_v2.0.2.jar\" -epw=D:\\Python\\pyfwg\\pyfwg\\tutorials\\morphing_temp_results_europe\\sevilla_in_this_one_the_uhi_is_type-1\\sevilla_in_this_one_the_uhi_is_type-1.epw D:\\Python\\pyfwg\\pyfwg\\tutorials\\epws\\wo_pattern\\sevilla_in_this_one_the_uhi_is_type-1.epw -models=MOHC_HadGEM2_ES_SMHI_RCA4 -ensemble=true -temp_shift_winter=0.0 -temp_shift_summer=0.0 -smooth_hours=72 -multithread=true -grid_interpolation_method=IDW -solar_correction=By_Month -diffuse_method=Engerer_2015 -uhi=true:2:3 -output_type=PORTUGAL_CSV\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "\u001B[32m2025-12-30 12:43:06 - INFO - Processing generated files in: ./morphing_temp_results_europe\\sevilla_in_this_one_the_uhi_is_type-1\u001B[0m\n", "\u001B[32m2025-12-30 12:43:06 - INFO - Skipping auxiliary file: '00_logs'\u001B[0m\n", "\u001B[32m2025-12-30 12:43:06 - INFO - Skipping auxiliary file: '01_processing_transcripts'\u001B[0m\n", "\u001B[32m2025-12-30 12:43:06 - INFO - Skipping auxiliary file: '02_morphing_errors_and_warnings'\u001B[0m\n", "\u001B[32m2025-12-30 12:43:06 - INFO - Skipping auxiliary file: '03_model_variables'\u001B[0m\n", "\u001B[32m2025-12-30 12:43:06 - INFO - Skipping auxiliary file: '04_epw_comparisons'\u001B[0m\n", "\u001B[32m2025-12-30 12:43:06 - INFO - Moving './morphing_temp_results_europe\\sevilla_in_this_one_the_uhi_is_type-1\\ESP_-_SEVILLA_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_rcp26_2050.csv' to './final_results_workflow_europe\\Seville_type-1_RCP-2.6_2050.csv'\u001B[0m\n", "\u001B[32m2025-12-30 12:43:06 - INFO - Moving './morphing_temp_results_europe\\sevilla_in_this_one_the_uhi_is_type-1\\ESP_-_SEVILLA_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_rcp26_2050.stat' to './final_results_workflow_europe\\Seville_type-1_RCP-2.6_2050.stat'\u001B[0m\n", "\u001B[32m2025-12-30 12:43:06 - INFO - Moving './morphing_temp_results_europe\\sevilla_in_this_one_the_uhi_is_type-1\\ESP_-_SEVILLA_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_rcp26_2080.csv' to './final_results_workflow_europe\\Seville_type-1_RCP-2.6_2080.csv'\u001B[0m\n", "\u001B[32m2025-12-30 12:43:06 - INFO - Moving './morphing_temp_results_europe\\sevilla_in_this_one_the_uhi_is_type-1\\ESP_-_SEVILLA_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_rcp26_2080.stat' to './final_results_workflow_europe\\Seville_type-1_RCP-2.6_2080.stat'\u001B[0m\n", "\u001B[32m2025-12-30 12:43:06 - INFO - Moving './morphing_temp_results_europe\\sevilla_in_this_one_the_uhi_is_type-1\\ESP_-_SEVILLA_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_rcp45_2050.csv' to './final_results_workflow_europe\\Seville_type-1_rcp45_2050.csv'\u001B[0m\n", "\u001B[32m2025-12-30 12:43:06 - INFO - Moving './morphing_temp_results_europe\\sevilla_in_this_one_the_uhi_is_type-1\\ESP_-_SEVILLA_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_rcp45_2050.stat' to './final_results_workflow_europe\\Seville_type-1_rcp45_2050.stat'\u001B[0m\n", "\u001B[32m2025-12-30 12:43:06 - INFO - Moving './morphing_temp_results_europe\\sevilla_in_this_one_the_uhi_is_type-1\\ESP_-_SEVILLA_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_rcp45_2080.csv' to './final_results_workflow_europe\\Seville_type-1_rcp45_2080.csv'\u001B[0m\n", "\u001B[32m2025-12-30 12:43:06 - INFO - Moving './morphing_temp_results_europe\\sevilla_in_this_one_the_uhi_is_type-1\\ESP_-_SEVILLA_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_rcp45_2080.stat' to './final_results_workflow_europe\\Seville_type-1_rcp45_2080.stat'\u001B[0m\n", "\u001B[32m2025-12-30 12:43:06 - INFO - Moving './morphing_temp_results_europe\\sevilla_in_this_one_the_uhi_is_type-1\\ESP_-_SEVILLA_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_rcp85_2050.csv' to './final_results_workflow_europe\\Seville_type-1_rcp85_2050.csv'\u001B[0m\n", "\u001B[32m2025-12-30 12:43:06 - INFO - Moving './morphing_temp_results_europe\\sevilla_in_this_one_the_uhi_is_type-1\\ESP_-_SEVILLA_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_rcp85_2050.stat' to './final_results_workflow_europe\\Seville_type-1_rcp85_2050.stat'\u001B[0m\n", "\u001B[32m2025-12-30 12:43:06 - INFO - Moving './morphing_temp_results_europe\\sevilla_in_this_one_the_uhi_is_type-1\\ESP_-_SEVILLA_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_rcp85_2080.csv' to './final_results_workflow_europe\\Seville_type-1_rcp85_2080.csv'\u001B[0m\n", "\u001B[32m2025-12-30 12:43:06 - INFO - Moving './morphing_temp_results_europe\\sevilla_in_this_one_the_uhi_is_type-1\\ESP_-_SEVILLA_Ensemble_UHI_Target_LCZ-3_Original_LCZ-2_rcp85_2080.stat' to './final_results_workflow_europe\\Seville_type-1_rcp85_2080.stat'\u001B[0m\n", "\u001B[33m2025-12-30 12:43:06 - WARNING - Could not find a rename plan for file 'ESP_-_SEVILLA_UHI_Target_LCZ-3_Original_LCZ-2_Present-day.csv'. It will be left in the temp directory.\u001B[0m\n", "\u001B[32m2025-12-30 12:43:06 - INFO - Skipping auxiliary file: 'README.html'\u001B[0m\n", "\u001B[32m2025-12-30 12:43:06 - INFO - Skipping auxiliary file: 'UHI_AirTemperature_10000'\u001B[0m\n", "\u001B[32m2025-12-30 12:43:06 - INFO - Morphing workflow finished.\u001B[0m\n" ] } ], "execution_count": 20 }, { "metadata": {}, "cell_type": "markdown", "source": "Let's take a look at the files we just generated:" }, { "metadata": { "ExecuteTime": { "end_time": "2025-12-30T11:43:06.842318Z", "start_time": "2025-12-30T11:43:06.817641Z" } }, "cell_type": "code", "source": [ "output_files = [i for i in os.listdir('./final_results_workflow_europe')]\n", "output_files" ], "outputs": [ { "data": { "text/plain": [ "['London_type-2_RCP-2.6_2050.csv',\n", " 'London_type-2_RCP-2.6_2050.stat',\n", " 'London_type-2_RCP-2.6_2080.csv',\n", " 'London_type-2_RCP-2.6_2080.stat',\n", " 'London_type-2_rcp45_2050.csv',\n", " 'London_type-2_rcp45_2050.stat',\n", " 'London_type-2_rcp45_2080.csv',\n", " 'London_type-2_rcp45_2080.stat',\n", " 'London_type-2_rcp85_2050.csv',\n", " 'London_type-2_rcp85_2050.stat',\n", " 'London_type-2_rcp85_2080.csv',\n", " 'London_type-2_rcp85_2080.stat',\n", " 'Seville_type-1_RCP-2.6_2050.csv',\n", " 'Seville_type-1_RCP-2.6_2050.stat',\n", " 'Seville_type-1_RCP-2.6_2080.csv',\n", " 'Seville_type-1_RCP-2.6_2080.stat',\n", " 'Seville_type-1_rcp45_2050.csv',\n", " 'Seville_type-1_rcp45_2050.stat',\n", " 'Seville_type-1_rcp45_2080.csv',\n", " 'Seville_type-1_rcp45_2080.stat',\n", " 'Seville_type-1_rcp85_2050.csv',\n", " 'Seville_type-1_rcp85_2050.stat',\n", " 'Seville_type-1_rcp85_2080.csv',\n", " 'Seville_type-1_rcp85_2080.stat']" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "execution_count": 21 }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Cleaning up\n", "\n", "Once the workflow is finished, you can delete the temporary folders created during the process if you don't need them anymore. If you did not enable `delete_temp_files=True` in `configure_and_preview`, you can do it manually.\n", "\n", "**Note on Analysis Files:** In FutureWeatherGenerator v4 (Global) and v2 (Europe), the tool generates several analysis folders (e.g., `00_logs`, `01_processing_transcripts`, etc.) when enabled. These folders are **not** moved to the final output directory; they remain in the temporary directory for inspection. If you delete the temporary directory, these files will be lost." ] }, { "metadata": { "ExecuteTime": { "end_time": "2025-12-30T11:43:06.970164Z", "start_time": "2025-12-30T11:43:06.857240Z" } }, "cell_type": "code", "source": [ "import shutil\n", "import os\n", "\n", "# Clean up the results folders\n", "for folder in ['./morphing_temp_results', './morphing_temp_results_europe', './final_results_workflow_global', './final_results_workflow_europe', './00_logs']:\n", " if os.path.exists(folder):\n", " shutil.rmtree(folder)\n", " print(f\"Deleted: {folder}\")" ], "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Deleted: ./morphing_temp_results\n", "Deleted: ./morphing_temp_results_europe\n", "Deleted: ./final_results_workflow_global\n", "Deleted: ./final_results_workflow_europe\n" ] } ], "execution_count": 22 } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.13" } }, "nbformat": 4, "nbformat_minor": 4 }