<jupyter_start><jupyter_text>Tutorial 3: Heavy Rainfall AnalysisThis tutorial shows how to identify and count heavy rainfall intervals exceeding a specified threshold and export the results to ArcGIS.  Example 1: Identification of Heavy Rainfall Intervals  1. Import radproc<jupyter_code>import radproc as rp<jupyter_output><empty_output><jupyter_text>2. Identify Heavy Rainfall IntervalsTo identify and select all intervals exceeding a rainfall threshold x at least y times in season z, you can use the function    find_heavy_rainfalls(HDFFile, year_start, year_end, thresholdValue, minArea, season)    The following code will extract all intervals, in which an hourly precipitation of 30 mm is exceeded in at least five cells (these don't need to be adjacent cells!) in May 2016 in Hesse.<jupyter_code>HDF = r"O:\Data\RW.h5"

hr = rp.find_heavy_rainfalls(HDFFile=HDF, year_start=2016, year_end=2016, thresholdValue=30, minArea=5, season='May')
hr<jupyter_output><empty_output><jupyter_text>3. Export Results into ArcGIS GeodatabaseThe following function exports all rows from the resampled daily DataFrame calculated above into raster datasets in an ArcGIS File Geodatabase. Optionally, different statistics rasters can be created, in this case the sum and the maximum value of each cell.<jupyter_code>idRaster = r"O:\Data\idras"
outGDBPath = r"O:\Data"
GDBName = "May16_30mm5c.gdb"
statistics = ["sum", "max"]

rp.export_dfrows_to_gdb(dataDF=hr, idRaster=idRaster, outGDBPath=outGDBPath, GDBName=GDBName, statistics=statistics)<jupyter_output><empty_output><jupyter_text>The new Geodatabase looks like this in ArcGIS:![HR_GDB](img/HR_GDB.png) **Side Note**In this example, eight intervals meeting the given criteria have been identified at four days. The following code can be used as a simple approach to obtain daily sums for these events.(Of course this does not take into account that the interval at May 30th is most likely part of the same precipitation event as the ones from May 29th...this is a more complicated topic to be adressed in future versions of radproc)<jupyter_code>hr_daily = hr.resample('D').sum()
hr_daily<jupyter_output><empty_output><jupyter_text>For example, the resulting raster dataset for the sum of the two intervals on May 27th looks like this:![HR_20160527](img/HR_Event_Wiesbaden.png)  Example 2: Counting Heavy Rainfall Intervals  1. Identify and Count Heavy Rainfall IntervalsTo count the number of times in which a rainfall threshold x is exceeded at every cell in season z, you can use the function    count_heavy_rainfall_intervals(HDFFile, year_start, year_end, thresholdValue, minArea, season)    *If you specify a minimum area a > 1, only intervals in which the threshold x is exceeded in at least y cells are taken into account.*The following code will count how many times an hourly precipitation of 10 mm is exceeded at every cell in May 2016 in Hesse.<jupyter_code>HDF = r"O:\Data\RW.h5"

hr_count = rp.count_heavy_rainfall_intervals(HDFFile=HDF, year_start=2016, year_end=2016, thresholdValue=10, minArea=1, season='May')
hr_count
# print the maximum value
hr_count.max(axis=1)<jupyter_output><empty_output><jupyter_text>2. Export to RasterAs the output DataFrame only has one row (because we only analyzed one month), it can be exported directly with          export_to_raster(series, idRaster, outRaster)<jupyter_code>rp.export_to_raster(series=hr_count, idRaster=r"O:\Data\idras", outRaster=r"O:\Data\hrcount10mm")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.06922196796338673, 'fraction_numerical': 0.01916475972540046, 'mean_word_length': 6.225206611570248, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '344743', 'license': 'MIT', 'n_tokens_mistral': 1125, 'n_tokens_neox': 1040, 'n_words': 404, 'path': 'docs/source/notebooks/Tutorial_Identification_of_Heavy_Rainfall.ipynb', 'repo_name': 'katrinleinweber/radproc', 'size': '3496'}