hydrology module¶
Access hydroclimatology datasets: ERA5, SNODAS, UCLA reanalysis, basin geometries, and more.
get_era5(bbox_input=None, version='ERA5', cadence='HOURLY', source='auto', start_date=None, end_date=None, variables=None, initialize_ee=True)
¶
Retrieves ERA5 reanalysis data using optimal source selection.
By default, this function uses Google Earth Engine for most requests, but automatically switches to the high-resolution ARCO-ERA5 Zarr dataset from Google Cloud Storage for hourly ERA5 data due to its superior performance and coverage for that specific combination. Please note, these datasets may be different from the original ERA5 data hosted on the Copernicus Climate Data Store (CDS).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bbox_input
|
GeoDataFrame or tuple or Geometry
|
The spatial bounding box for subsetting. If None, returns global data. |
None
|
version
|
str
|
Version of ERA5 data. Options are 'ERA5' or 'ERA5_LAND'. Default is 'ERA5'. |
'ERA5'
|
cadence
|
str
|
Temporal resolution. Options are 'HOURLY', 'DAILY', or 'MONTHLY'. Default is 'HOURLY'. |
'HOURLY'
|
source
|
str
|
Data source to use: "auto" (smart selection), "GEE" (Google Earth Engine), or "GCS" (Google Cloud Storage). Default is "auto", which uses GCS for ERA5 hourly data and GEE for everything else. |
'auto'
|
start_date
|
str
|
Start date in 'YYYY-MM-DD' format. If None, uses earliest available date. |
None
|
end_date
|
str
|
End date in 'YYYY-MM-DD' format. If None, uses latest available date. |
None
|
variables
|
str or list
|
Variable(s) to select. If None, returns all variables. Only applicable for GEE source. |
None
|
initialize_ee
|
bool
|
Whether to initialize Earth Engine. Default is True. Only applicable for GEE source. |
True
|
Returns:
| Type | Description |
|---|---|
Dataset
|
An xarray Dataset containing ERA5 reanalysis data for the specified region. |
Examples:
Get hourly ERA5 data (automatically uses ARCO-ERA5 from GCS):
1 2 3 | |
Get monthly ERA5 data (uses Google Earth Engine):
1 2 3 4 5 6 7 8 | |
Force using GEE for hourly ERA5 data:
1 2 3 4 5 6 | |
Notes
When source is "GEE" or "auto" selects GEE (all combinations except hourly ERA5),
Google Earth Engine authentication is required. Run ee.Authenticate() /
ee.Initialize() once, or call easysnowdata.authenticate_all().
When source is "GCS" (or "auto" selects GCS for hourly ERA5), no credentials
are needed.
- The function automatically selects the optimal data source based on your request
- Hourly ERA5 data comes from ARCO-ERA5 on Google Cloud Storage by default
- All other combinations use Google Earth Engine
- You can override the automatic source selection by explicitly setting the source parameter
- Please note, these data are not the original ERA5 data but have been processed and optimized for cloud access. Each dataset will also have an assosciated latency different from the original dataset. The most up-to-date information can be found at: https://cds.climate.copernicus.eu/datasets
Data citations: - GEE+GCS: Hersbach, H., Bell, B., Berrisford, P., et al. (2020). The ERA5 global reanalysis. Quarterly Journal of the Royal Meteorological Society, 146(730), 1999-2049. - GCS: Carver, Robert W, and Merose, Alex. (2023): ARCO-ERA5: An Analysis-Ready Cloud-Optimized Reanalysis Dataset. 22nd Conf. on AI for Env. Science, Denver, CO, Amer. Meteo. Soc, 4A.1, https://ams.confex.com/ams/103ANNUAL/meetingapp.cgi/Paper/415842
Source code in easysnowdata/hydroclimatology.py
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 | |
get_grdc_major_river_basins_of_the_world(bbox_input=None)
¶
Retrieves GRDC Major River Basins of the World dataset.
This function downloads and loads the Global Runoff Data Centre's (GRDC) Major River Basins dataset, which contains 520 river/lake basins considered major in size or hydro-political importance. The basins include both exorheic drainage (flowing to oceans) and endorheic drainage (inland sinks/lakes) systems.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bbox_input
|
geopandas.GeoDataFrame, tuple, or Shapely Geometry
|
The bounding box for spatial subsetting. If None, the entire global dataset is returned. |
None
|
Returns:
| Type | Description |
|---|---|
GeoDataFrame
|
A GeoDataFrame containing the GRDC major river basins with associated attributes. |
Examples:
Get all major river basins...
1 2 | |
Get basins for a specific region...
1 2 3 | |
Notes
This dataset incorporates data from HydroSHEDS database which is © World Wildlife Fund, Inc. (2006-2013) and has been used under license.
Data citation: GRDC (2020): GRDC Major River Basins. Global Runoff Data Centre. 2nd, rev. ed. Koblenz: Federal Institute of Hydrology (BfG).
Source code in easysnowdata/hydroclimatology.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | |
get_grdc_wmo_basins(bbox_input=None)
¶
Retrieves WMO Basins and Sub-Basins dataset.
This function downloads and loads the Global Runoff Data Centre's (GRDC) WMO Basins and Sub-Basins dataset. It contains 515 WMO Basins representing hydrographic regions including river/lake basins with both exorheic drainage (flowing to oceans) and endorheic drainage (inland sinks/lakes).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bbox_input
|
geopandas.GeoDataFrame, tuple, or Shapely Geometry
|
The bounding box for spatial subsetting. If None, the entire global dataset is returned. |
None
|
Returns:
| Type | Description |
|---|---|
GeoDataFrame
|
A GeoDataFrame containing the WMO Basins and Sub-Basins with associated attributes. |
Examples:
Get all WMO basins...
1 2 | |
Get basins for a specific region...
1 2 3 | |
Notes
This dataset incorporates data from the HydroSHEDS database which is © World Wildlife Fund, Inc. (2006-2013) and has been used under license.
WMO basins and sub-basins are attributed with: - WMOBB: identifier of hydrographic region - WMOBB_NAME: name of hydrographic region - WMOBB_BASIN: name of river/lake basin, coastal region or island - WMOBB_SUBBASIN: name of river/lake basin forming a separate sub-basin - WMOBB_DESCRIPTION: description of hydrographic region - REGNUM: number of the WMO Region (Regional Association) - REGNAME: name of the WMO Region (Regional Association) - WMO306_MoC_NUM: reference to Manual on Codes, 2-digit basin code - WMO306_MoC_REFERENCE: reference to Manual on Codes, name of basin/sub-basin - SUMSUBAREA: approximate of drainage area (in square km)
Data citation: GRDC (2020): WMO Basins and Sub-Basins / Global Runoff Data Centre, GRDC. 3rd, rev. ext. ed. Koblenz, Germany: Federal Institute of Hydrology (BfG).
Source code in easysnowdata/hydroclimatology.py
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | |
get_huc_geometries(bbox_input=None, huc_level='02')
¶
Retrieves Hydrologic Unit Code (HUC) geometries within a specified bounding box and HUC level.
This function queries the USGS Water Boundary Dataset (WBD) for HUC geometries. It can retrieve HUC geometries at different levels for a specified region defined by a bounding box. If no bounding box is provided, it retrieves HUC geometries for the entire United States.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bbox_input
|
geopandas.GeoDataFrame, tuple, or Shapely Geometry
|
The bounding box for spatial subsetting. If None, the entire US dataset is returned. |
None
|
huc_level
|
str
|
The HUC level to retrieve geometries for. Valid levels are '02', '04', '06', '08', '10', '12'. Default is '02'. |
'02'
|
Returns:
| Type | Description |
|---|---|
GeoDataFrame
|
A GeoDataFrame containing the retrieved HUC geometries along with associated attributes such as name, area in square kilometers, states, TNMID, and geometry. |
Examples:
Get HUC geometries for a specific region at HUC level 08...
1 2 | |
Notes
Requires Google Earth Engine authentication. Run ee.Authenticate() and
ee.Initialize() once, or call easysnowdata.authenticate_all().
Data citation: Jones, K.A., Niknami, L.S., Buto, S.G., and Decker, D., 2022, Federal standards and procedures for the national Watershed Boundary Dataset (WBD) (5 ed.): U.S. Geological Survey Techniques and Methods 11-A3, 54 p., https://doi.org/10.3133/tm11A3
Source code in easysnowdata/hydroclimatology.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | |
get_hydroBASINS(bbox_input=None, level=5)
¶
Retrieves HydroATLAS sub-basin boundaries at specified hierarchical level.
This function downloads and loads vectorized polygon layers depicting sub-basin boundaries from the HydroATLAS database via figshare. It provides consistently sized and hierarchically nested sub-basins at different scales, supported by Pfafstetter coding for catchment topology analysis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bbox_input
|
geopandas.GeoDataFrame, tuple, or Shapely Geometry
|
The bounding box for spatial subsetting. If None, the entire global dataset is returned. |
None
|
level
|
int
|
The hierarchical level (1-12) of sub-basin delineation. Higher levels represent finer subdivisions. Default is 5. |
5
|
Returns:
| Type | Description |
|---|---|
GeoDataFrame
|
A GeoDataFrame containing the HydroATLAS sub-basin boundaries with associated attributes. |
Examples:
Get level 5 sub-basins for all regions...
1 2 | |
Get level 6 sub-basins for a specific region...
1 2 3 | |
Notes
This function uses the HydroATLAS dataset which provides global coverage in a single file, making it more efficient than downloading individual regional HydroBASINS files.
Data citation: Linke, S., Lehner, B., Ouellet Dallaire, C., Ariwi, J., Grill, G., Anand, M., Beames, P., Burchard-Levine, V., Maxwell, S., Moidu, H., Tan, F., Thieme, M. (2019). Global hydro- environmental sub-basin and river reach characteristics at high spatial resolution. Scientific Data 6: 283. doi: 10.1038/s41597-019-0300-6
Source code in easysnowdata/hydroclimatology.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | |
get_koppen_geiger_classes(bbox_input=None, resolution='0.1 degree')
¶
Retrieves Köppen-Geiger climate classification data for a given bounding box and resolution.
This function fetches global Köppen-Geiger climate classification data from a high-resolution dataset based on constrained CMIP6 projections. It allows for optional spatial subsetting and provides multiple resolution options. The returned DataArray includes a custom plotting function as an attribute.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bbox_input
|
GeoDataFrame | tuple | BaseGeometry | None
|
The bounding box for spatial subsetting. If None, the entire global dataset is returned. |
None
|
resolution
|
str
|
The spatial resolution of the data. Options are "1 degree", "0.5 degree", "0.1 degree", or "1 km". Default is "0.1 degree". |
'0.1 degree'
|
Returns:
| Type | Description |
|---|---|
DataArray
|
A DataArray containing the Köppen-Geiger climate classification data, with class information, color map, data citation, and a custom plotting function included as attributes. |
Examples:
Get Köppen-Geiger climate classification data for the entire globe with a 1-degree resolution, use custom plotting function:
1 2 3 4 5 | |
Notes
Data citation:
Beck, H.E., McVicar, T.R., Vergopolan, N. et al. High-resolution (1 km) Köppen-Geiger maps for 1901–2099 based on constrained CMIP6 projections. Sci Data 10, 724 (2023). https://doi.org/10.1038/s41597-023-02549-6
Source code in easysnowdata/hydroclimatology.py
922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 | |
get_snodas(bbox_input=None, start_date='2003-10-01', end_date=None, variables=None, initialize_ee=True)
¶
Retrieves SNODAS (Snow Data Assimilation System) data for a given bounding box and time range.
The Snow Data Assimilation System (SNODAS) is a modeling and data assimilation system developed by NOHRSC that provides accurate estimations of snow cover and associated parameters at 1 km spatial resolution and daily temporal resolution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bbox_input
|
geopandas.GeoDataFrame or tuple or Shapely Geometry
|
GeoDataFrame containing the bounding box, or a tuple of (xmin, ymin, xmax, ymax), or a Shapely geometry. If None, returns data for the entire dataset extent. |
None
|
start_date
|
str
|
The start date for the data in the format 'YYYY-MM-DD'. Default is '2003-10-01'. |
'2003-10-01'
|
end_date
|
str
|
The end date for the data in the format 'YYYY-MM-DD'. Default is today's date. |
None
|
variables
|
str or list
|
Variable(s) to select. Options are 'Snow_Depth' and 'SWE' (Snow Water Equivalent). If None, returns all variables. |
None
|
initialize_ee
|
bool
|
Whether to initialize Earth Engine. Default is True. |
True
|
Returns:
| Type | Description |
|---|---|
Dataset
|
An xarray Dataset containing SNODAS data for the specified region and time period. |
Examples:
Get SNODAS data for a specific region:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
Get only snow depth data:
1 2 3 4 5 6 7 | |
Notes
Requires Google Earth Engine authentication. Run ee.Authenticate() and
ee.Initialize() once, or call easysnowdata.authenticate_all().
- SNODAS covers the continental United States, Alaska, and Hawaii
- Data is available from 2003-10-01 to present with daily updates
- Spatial resolution is 1 km (1/120-degree)
Data citations: Barrett, Andrew. 2003. National Operational Hydrologic Remote Sensing Center Snow Data Assimilation System (SNODAS) Products at NSIDC. NSIDC Special Report 11. Boulder, CO USA: National Snow and Ice Data Center. 19 pp.
Barrett, A. P., R. L. Armstrong, and J. L. Smith. 2001. The Snow Data Assimilation System (SNODAS): An overview. Journal of Hydrometeorology 2(3):288-306.
Source code in easysnowdata/hydroclimatology.py
619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 | |
get_ucla_snow_reanalysis(bbox_input=None, variable='SWE_Post', stats='mean', start_date='1984-10-01', end_date='2021-09-30')
¶
Fetches the Margulis UCLA snow reanalysis product for a specified bounding box and time range.
This function retrieves snow reanalysis data from the UCLA dataset, allowing users to specify the type of snow data variable, statistical measure, and the temporal range for the data retrieval. The data is then clipped to the specified bounding box and returned as an xarray DataArray.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bbox_input
|
geopandas.GeoDataFrame, tuple, or Shapely Geometry
|
The bounding box for spatial subsetting. If None, the entire dataset is returned. |
None
|
variable
|
str
|
The type of snow data variable to retrieve. Options include 'SWE_Post' (Snow Water Equivalent), 'SCA_Post' (Snow Cover Area), and 'SD_Post' (Snow Depth). Default is 'SWE_Post'. |
'SWE_Post'
|
stats
|
str
|
The ensemble statistic. Options are 'mean', 'std' (standard deviation), 'median', '25pct' (25th percentile), and '75pct' (75th percentile). Default is 'mean'. |
'mean'
|
start_date
|
str
|
The start date for the data retrieval in 'YYYY-MM-DD' format. Default is '1984-10-01'. |
'1984-10-01'
|
end_date
|
str
|
The end date for the data retrieval in 'YYYY-MM-DD' format. Default is '2021-09-30'. |
'2021-09-30'
|
Returns:
| Type | Description |
|---|---|
DataArray
|
An xarray DataArray containing the requested snow reanalysis data, clipped to the specified bounding box. |
Examples:
Get mean Snow Water Equivalent data for a specific region and time period...
1 2 3 4 5 | |
Notes
Requires NASA EarthData authentication. Run earthaccess.login(persist=True)
once, or call easysnowdata.authenticate_all().
Data citation:
Fang, Y., Liu, Y. & Margulis, S. A. (2022). Western United States UCLA Daily Snow Reanalysis. (WUS_UCLA_SR, Version 1). [Data Set]. Boulder, Colorado USA. NASA National Snow and Ice Data Center Distributed Active Archive Center. https://doi.org/10.5067/PP7T2GBI52I2
Source code in easysnowdata/hydroclimatology.py
819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 | |