This repository contains codes and data for performing Weather Type (WT) analysis, streamflow prediction, and evaluation using Google Colab Notebooks and R scripts.
Note: The required input data files are available on Google Drive and will be pulled from the drive within the notebooks.
If you prefer to work in the R environment without any interactions with the notebooks, use the R scripts and data files in Rscripts_and_Data. In this case, other data files in this repository (e.g., Input_Data) are not required.
Contains the Hindcast and reanalysis WT data file 2.WT_combined_data.csv. Download the Input_Data content and store them in your work directory (e.g., Google Drive). This data has been created using the ECMWF and SMYLE model and will pulled from the drive, so it is optional to create it using this notebook.
ERA_tclw_regional.csvERA_q_regional.csvERA_tcwv_regional.csv5_combined_forecast_variables.csv: Contains pre-processed regional hindcast data from 1984 to 2023.Shapefiles.zip: contains shapefiles of the AZ-West and Az-East regions.
This notebook calculates regional ERA reanalysis climate variables (q, tclw, tcwv, tprate). The data is ready to be used and will be pulled from the drive. It extract Shapefiles.zip and pulls ERA5_singleLevel_1940_2024_mon.nc and ERA5_SH_1940_2024_mon.nc from the drive within the notebook.
- Outputs:
ERA_tclw_regional.csvERA_q_regional.csvERA_tcwv_regional.csv
This notebook uses the k-Nearest Neighbors (kNN) algorithm to identify analog years based on hydroclimate condition and streamflow data and creates metrics plots. The notebook requires:
ERA_tclw_regional.csvERA_q_regional.csvERA_tcwv_regional.csv2.WT_combined_data.csv5_combined_forecast_variables.csv./obs/BORInterveningFlowsData1971-2022_NFDextensionv2.xlsxIt should be noted that the above data files are ready to be used and will be pulled from the drive within the notebook.
This notebook downloads sub-daily Q850 data and generates WTs. The R scripts at the bottom of the notebook append new WTs to 2.WT_combined_data.csv. The updated data file can be used in 2.LCRB_Analog_streamflow_prediction_BOR.ipynb to re-predict streamfloe if streamflow data is available for that period in ./obs/BORInterveningFlowsData1971-2022_NFDextensionv2.xlsx. Note: Analog prediction does not forecast streamflow beyond the target years (hindcast WTs).
If the notebook runs successfully, you will see the output files appear in the "Files" dropdown menu, as shown in the figure below. The figure displays the output files generated for the "ECMWF" model, and any files that were downloaded during running the notebook. Based on the configuration setups you may get slightly different output files.
- Notebook:
2.LCRB_Analog_streamflow_prediction_BOR.ipynb- Open the notebook in Google Colab.
- Ensure that the notebook kernel is set to R. To do this, click on “Runtime” > “Change runtime type” > “R”.
- Notebook:
Read_ERA5_v2_BOR.ipynb- Ensure that the runtime type is set to "Python". Go to “Runtime” > “Change runtime type” > "Python 3".
- Notebook:
1.AZ-NAM-Precipitation-S2S-forecast_BOR.ipynb - Ensure that the runtime type is set to "Python". Go to “Runtime” > “Change runtime type” > "Python 3".
- Open the Colab notebook you want to edit.
- Go to "File" > "Save a copy in Drive..." to create a copy of the notebook in your personal Google Drive.
- You will now be working on your copy, so any changes will not affect the original notebook.
-
In the notebook, run the following cell to connect to your personal Google Drive.
-
This will prompt you to authorize access to your Google Drive. Follow the instructions to grant access.
- After mounting, navigate to the copied notebook in your Google Drive (usually located under
My Drive). - Make any necessary edits directly in the notebook.
- Once the notebook is in your drive, you can run, edit, and save your changes.
- Note: If you don't need to edit the notebooks, you can skip these steps and run the notebooks as they are, using the original versions.



