Search for a command to run...
# Global Compression and Reorganization of Lake Thermal Habitats ## 1. Introduction This repository contains the necessary data and code to reproduce the core results and figures of the manuscript "**Global compression and reorganization of lake thermal habitats**" (currently under review). Due to the massive volume of original daily meteorological input data and high-resolution process-based model simulation outputs (spanning 1,427,688 lakes globally), the raw daily simulation results are not included in this archive. Instead, this repository provides comprehensively processed, lake-level, and gridded datasets required to seamlessly reproduce all the main figures. The source data provided here includes: * Long-term temperature trends. * Thermal habitat shifts ($S_{\mathrm{habitat}}$, $S_{\mathrm{isotherm}}$, $S_{\mathrm{temperature}}$) caused long-term warming and extreme heatwave scenarios. * Necessary geospatial data. --- ## 2. System Requirements The scripts are written in **Python 3.13.5**. A standard desktop or laptop with at least **64 GB of RAM** is sufficient. Please ensure you have installed the following required Python packages: ```bash pip install numpy pandas scipy matplotlib cartopy h5py geopandas ``` The code was developed and tested in the following environment. If you encounter issues with other versions, please refer to these details: | **Component** | **Version** | |:--------------|:------------------| | OS | Windows 11 (AMD64)| | Python | 3.13.5 | | numpy | 2.3.2 | | pandas | 2.3.2 | | scipy | 1.16.1 | | matplotlib | 3.10.6 | | cartopy | 0.24.1 | | h5py | 3.15.1 | | geopandas | 1.1.1 | --- ## 3. Directory Structure & Data Preparation To ensure the relative paths in the Python scripts work correctly (e.g., `pd.read_csv('../Data/lake_center.csv')`), please set up your working environment strictly following this two-level directory structure: 1. Download all files and create a main project folder. 2. Inside the root folder, create two sibling sub-folders: **Data** and **Code**. 3. Place all data files (`.csv`, `.nc`, `.npz`, and shapefiles) into the **Data** folder. 4. Place all Python plotting scripts into the **Code** folder. ### Directory Tree ```text Project_Root/ │ ├── Data/ │ ├── lake_center.csv │ ├── lake_thermal_regions.nc │ ├── temp_trend_global_lakes.csv │ ├── global_mean_trend.csv │ ├── global_mean_temperature_list.csv │ ├── daily_nonoverlap_results.npz │ ├── background_results.npz │ ├── heatwave_nonoverlap_results.npz │ ├── GLOBathy_hAV_relationships.nc │ └── BasinATLAS_Data_v10_shp/ # Folder containing the .shp file │ └── Code/ ├── Figure_2.py ├── Figure_3.py ├── Figure_4.py └── Figure_5.py ``` --- ## 4. Data Dictionary The input source data provided in the **Data** folder includes: ### 4.1 Geospatial Data * **lake_center.csv**: Contains the HydroLake ID, latitude (`lat`), and longitude (`lon`) for center of each simulated lake. Used for mapping lakes to the 0.5° × 0.5° global grid. * **lake_thermal_regions.nc**: Global lake thermal region classification data. * **GLOBathy_hAV_relationships.nc**: Lake bathymetry dataset from GLOBathy, utilized to extract the maximum depth of lakes for calculating absolute vertical temperature gradients. * **BasinATLAS_Data_v10_shp/**: Shapefile containing HydroSHEDS Level-06 major river basins and human population counts (`pop_ct_ssu`), used for calculating cumulative population exposure to habitat shifts. ### 4.2 Temperature Trends Data (For Figure 2) * **temp_trend_global_lakes.csv**: Long-term arming trends for each lake, including `profile_mean`, `surface_mean`, `bottom_mean`, `profile_summer`, `surface_summer`, and `bottom_summer`. * **global_mean_temperature_list.csv**: Global mean temperature time series from 2000 to 2023. * **global_mean_trend.csv**: Depth-resolved intra-annual heatmap matrix showing temperature trends across 50 relative depths over 365 days averaged across global lakes. ### 4.3 Thermal Habitat Shift Data (.npz) * **daily_nonoverlap_results.npz**: Stores daily thermal habitat shift metrics driven by long-term warming: * $S_{\mathrm{habitat}}$ (`non_overlap_compound_all`) * $S_{\mathrm{isotherm}}$ (`non_overlap_depth_all`) * $S_{\mathrm{temperature}}$ (`non_overlap_temp_all`) * **background_results.npz**: Background physical drivers (`data_all` array), including vertical temperature gradients, historical inter-annual temperature variability, and long-term warming magnitude. * **heatwave_nonoverlap_results.npz**: Thermal habitat shift metrics during extreme heatwave events for all lakes (`non_overlap_heatwave_lake_compound`, etc.). --- ## 5. Code Description & Usage You can directly run the Python scripts from within the **Code** folder. All scripts will automatically read from the `../Data/` directory and output high-resolution `.png` figures and print the main results. ### Example Usage ```bash cd Code python Figure_2.py ``` ### Script Functions * **Figure_2.py**: **Spatiotemporal and vertical patterns of global lake warming.** * Generates maps of annual and summer profile-averaged water temperature trends. * Plots latitude-trend profiles, depth-resolved seasonal heatmaps, and violin plots. * **Figure_3.py**: **Global lake thermal habitat shifts driven by long-term warming.** * Visualizes global spatial distributions of $S_{\mathrm{habitat}}$, $S_{\mathrm{isotherm}}$, and $S_{\mathrm{temperature}}$. * Creates boxplots by thermal regions and plots the Cumulative Distribution Function (CDF) of human population exposure. * **Figure_4.py**: **Global physical drivers and intra-annual evolution of lake thermal habitat shifts.** * Plots global maps of absolute vertical temperature gradients and inter-annual temperature variability. * Generates intra-annual temporal curves demonstrating seasonal peaks of ecological vulnerability. * **Figure_5.py**: **Heatwave-driven thermal habitat shifts relative to long-term warming.** * Maps the ratio of heatwave-induced habitat shifts to long-term shifts ($S_{\mathrm{heatwave}} / S_{\mathrm{long-term}}$). * Utilizes pie charts and regional vertical boxplots to highlight regions where acute thermal disruptions dominate. > **Note:** Minor modifications (e.g., adding figure panel labels or adjusting legends) may have been applied to the final manuscript figures using Adobe Illustrator.