From da651d75600a87b66bf139eb0f6999a4ac2c781a Mon Sep 17 00:00:00 2001
From: lb584 <lb584@cam.ac.uk>
Date: Thu, 4 Jan 2024 12:20:21 +0000
Subject: [PATCH] changes to docs to include how to add a new sub-region

---
 docs/_source/deployment_notes.rst | 105 ++++++++++++++++++++++++++++++
 1 file changed, 105 insertions(+)

diff --git a/docs/_source/deployment_notes.rst b/docs/_source/deployment_notes.rst
index 7b0daea..c25abaf 100644
--- a/docs/_source/deployment_notes.rst
+++ b/docs/_source/deployment_notes.rst
@@ -113,3 +113,108 @@ edit "MET_DATA_TYPE": "NAME", field in the /regions/EastAfrica/resources/met_ext
 regions/EastAfrica/resources/met_extractor/configs/FIELD_NAME_CONSTANTS.csv
 
 this ensures the correct Met nc files are located
+
+Adding a new sub-region:
+========================
+
+You should be able to add a new sub-region (country) without needing to midify the source code.
+
+Add assets and config files
+---------------------------
+
+Add the following files to the **<resources_dir>/plotting/assets/gis_data/<country_name>**  directory:
+
+You can use other countries as a template, you will need:
+
+shape files  - both main country boundary and up to 2 admin boundary levels
+a map tile (optional geotiff file), if not specified open street maps are used
+landpoints mask file. Instructions on creating these are in the section above "creating the grid files"
+
+make a copy of a pre-existing chart_config.json file in
+
+**<resources_dir>/plotting/configs/chart**
+
+modify the paths to point at the new assets files you added. Also change the bounding box and the image size as required
+
+Modify the main config json
+----------------------------
+
+To make the new sub-region be run by the coordinator, edit the coordinator config json, e.g.
+
+*<resources_dir>/coordinator/configs/config_EastAfrica_fc_live.json*
+
+Add the new sub-region name to the list at the top of the file
+
+.. code-block:: json
+
+    "SubRegionNames" : ["EastAfrica","Ethiopia","<new_region>"]
+
+Also add the new region to the EWS-Plotting sections for env_suit and deposition:
+
+.. code-block:: json
+
+        "EWS-Plotting" : {
+            "<new_region>" : {
+                "ChartConfig" : "<install_location>/regions/EastAfrica/resources/plotting/configs/chart/CHART_CONFIG_EAST_AFRICA_PINE.json",
+                "FilterForCountry" : "False"
+            }
+
+.. code-block:: json
+
+        "EWS-Plotting" : {
+        "<new_region>" : {
+                "ChartConfig" : "<install_location>/regions/EastAfrica/resources/plotting/configs/chart/CHART_CONFIG_EAST_AFRICA_PINE.json",
+                "Normalize" : "False"
+            },
+
+
+Testing the code
+----------------
+
+When adding a new sub region, it helps to be able to run the post-processing and plotting quickly, locally as the
+plotting parameters are varied. If you have a pre-run outout for depo and env suit, you can call these functins with the
+relevant parameters set to run the plotting and post-processing directly:
+
+<post_processing_location>/ews_postprocessing/runners/ews_processing_depo_main.py
+<post_processing_location>/ews_postprocessing/runners/ews_processing_env_main.py
+
+there are a lot of parameters, here are example calls from the command line:
+
+ews_processing_depo_main.py
+
+--name_file_wildcard
+<install_location>/regions/EastAfrica/workspace/DEPOSITION_20240103/WR_NAME_Ethiopia_20240103_fc/deposition_srcs_allregions_*.nc
+--wheat_sources_dir
+<install_location>/regions/EastAfrica/workspace/DEPOSITION_20240103/WR_NAME_Ethiopia_20240113_fc
+--output_dir
+<install_location>/regions/EastAfrica/workspace/DEPOSITION_20240103/plotting/ethiopia
+--issue_date
+20240103
+--sys_config_file
+<install_location>/regions/EastAfrica/resources/plotting/configs/sys/SYS_CONFIG_PINE.json
+--chart_config_file
+<install_location>/regions/EastAfrica/resources/plotting/configs/chart/CHART_CONFIG_ZAMBIA_PINE.json
+--name_extraction_config_file
+<install_location>/regions/EastAfrica/resources/plotting/configs/name_extraction/NAME_EXTRACTION_CONFIG.json
+--name_extraction_file_prefix
+deposition_ethiopia
+--depo_plotting_run_config_file
+<install_location>/regions/EastAfrica/resources/plotting/configs/deposition/RUN_CONFIG_DEPO.json
+--depo_normalized_plotting_run_config_file
+<install_location>/regions/EastAfrica/resources/plotting/configs/deposition/RUN_CONFIG_DEPO_NORMALIZED.json
+
+ews_processing_env_main.py
+
+--sys_config_file
+<install_location>/regions/EastAfrica/resources/plotting/configs/sys/SYS_CONFIG_PINE.json
+--run_config_file
+<install_location>/regions/EastAfrica/resources/plotting/configs/env_suit/RUN_CONFIG_ENV.json
+--chart_config_file
+<install_location>/regions/EastAfrica/resources/plotting/configs/chart/CHART_CONFIG_ZAMBIA_PINE.json
+--csv_template
+<install_location>/regions/EastAfrica/workspace/ENVIRONMENT_2.0_{TIMESTAMP_SHORT}/processed/EastAfrica/{DISEASE_DIR}/RIE_value.csv
+--filter_for_country
+--issue_date
+20231116
+--env_suitability_output_dir
+<deployment_root>/regions/EastAfrica/workspace/ENVIRONMENT_2.0_20231116/plotting/zambia/
\ No newline at end of file
-- 
GitLab