Purpose: To obtain and merge precipitation data with input file Weather.csv for i-Tree HydroPlus Research Suite
Author: T. Endreny at SUNY ESF, te@esf.edu

Problem: Precipitation data is often: 
1) missing from the NCDC NOAA data for areas outside the US,
2) limited to a single precipitation gage and not representative of larger area

Solution: Two approaches are provided, both using NASA Giovanni data downloads

#Approach P: Generate precipitation csv, to use in in WeatherPrepConfig.xml and create Weather.csv 
#Step 1a: Download WeatherPrep scripts and utility from i-Tree Tools and save as: C:\iTree\WeatherPrep\
#Step 1b: Follow directions in C:\iTree\WeatherPrep\NOAA_data_tool\ReadMe.txt to obtain raw NOAA data 
#Step 1c: Create work folder such as C:\iTree\a_prep_Weather\syr_ny\2022\ to contain the raw NOAA data
#Step 2a: Obtain data at https://giovanni.gsfc.nasa.gov/giovanni/ by: 1) Select Plot Time Series, Area Averaged ...
#Step 2c: ... 3) Select Region (W,S,E,N) based on 0.05 degree distances from city center, 4) Keyword GPM_3IMERGHH, ... 
#Step 2c: ... 5) Select best data option (e.g., Units=mm/hr, Temp.Res=Half-Hourly), 6) Click Plot Data & wait ...
#Step 2d: ... 7) Once plot is generated, expand Downloads left of plot and select CSV, 8, Save to work folder
#Step 2e: Keep original name of GPM_3IMERGHH product, e.g., g4.areaAvgTimeSeries.GPM_3IMERGHH.._precip..12E_42N.csv
#Step 3a: Run this GIOVANNI script and select data output option letter P, for Precipitation.csv
#Step 4a: Either/Or Run WeatherPrep_GUI.exe or WeatherPrep_GUI.py, activating Advanced XML Configuration radio button
#Step 4b: Provide path for GIOVANNI output Precipitation.csv
# 
#Step 5a: Either/Or Modify WeatherPrepConfig.xml element PrecipitationDataCsv to point to Precipitation.csv
#Step 5b: Generate weather.csv file that contains the GIOVANNI precipitation data

#Approach W: Update weather.csv, by combining precipitation csv with existing Weather.csv
#Step 1a: Download WeatherPrep scripts and utility from i-Tree Tools and save as: C:\iTree\WeatherPrep\
#Step 1b: Follow directions in C:\iTree\WeatherPrep\NOAA_data_tool\ReadMe.txt to obtain raw NOAA data 
#Step 1c: Create work folder such as C:\iTree\a_prep_Weather\syr_ny\2022\ to contain the raw NOAA data
#Step 2a: Follow directions in C:\iTree\WeatherPrep\TestCases\ReadMe.txt
#Step 2b: Modify WeatherPrepConfig.xml element PrecipitationDataCsv to be blank
#Step 2c: Generate 1st estimate of weather.csv file that does not yet contain the GIOVANNI precipitation data
#Step 3a: Obtain data at https://giovanni.gsfc.nasa.gov/giovanni/ by: 1) Select Plot Time Series, Area Averaged ...
#Step 3b: ... 2) Select Date Range (UTC), 3) Select Region (E,S,W,N), 4) Keyword GPM_3IMERGHH, ... 
#Step 3c: ... 5) Select best data option (e.g., Units=mm/hr, Temp.Res=Half-Hourly), 6) Click Plot Data & wait ...
#Step 3d: ... 7) Once plot is generated, expand Downloads left of plot and select CSV, 8, Save to work folder
#Step 3e: Keep original name of GPM_3IMERGHH product, e.g., g4.areaAvgTimeSeries.GPM_3IMERGHH.._precip..12E_42N.csv
#Step 4a: Run this GIOVANNI script and select data output option letter W, for Weather.csv
#Step 4b: Update weather.csv file to contain the GIOVANNI precipitation data