Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .gitignore
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,4 +3,23 @@ Map_Contouring_Matplotlib/Contouring_Tutorial/maxele_contouring.63.nc.1
Map_Contouring_Matplotlib/Contouring_Tutorial/maxele_contouring.63.nc.2
/NetCDF_quality check_png/*.nc
/Analyzing_NetCDF/NetCDF_Tutorial/data/*.nc
/Analyzing_NetCDF/NetCDF_Tutorial/maxele.63.nc
/Analyzing_NetCDF/NetCDF_Tutorial/maxele.63.nc.*
/Map_Contouring_Matplotlib/Contouring_Tutorial/*.nc
/Cartopy/water_level_stations.csv

# Python generated files
__pycache__/
*.py[cod]
.ipynb_checkpoints/

# Local environments
.venv/
venv/
.env

# Tutorial generated files
.cartopy_test/
Cartopy/station_map.png
Cartopy/*_map.png
Analyzing_NetCDF/NetCDF_Tutorial/output_*.txt
39 changes: 32 additions & 7 deletions Analyzing_NetCDF/NetCDF_Tutorial/netCDF4.ipynb
Original file line numberDiff line numberDiff line change
Expand Up@@ -142,8 +142,14 @@
"metadata": {},
"outputs": [],
"source": [
"pip install numpy\n",
"pip install netCDF4"
"# Recommended local setup: create the shared repository environment from the repository root.\n",
"# conda env create -f environment.yml\n",
"# conda activate cera-tutorials\n",
"# python -m ipykernel install --user --name cera-tutorials --display-name \"Python (cera-tutorials)\"\n",
"#\n",
"# Then open this notebook with the Python (cera-tutorials) kernel.\n",
"# Pip fallback only if you are not using the Conda environment:\n",
"# %pip install -r ../../requirements.txt"
]
},
{
Expand DownExpand Up@@ -180,11 +186,30 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 23,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"maxele.63.nc already exists; skipping download.\n"
]
}
],
"source": [
"!wget https://cloud.cera.lsu.edu/s/7PfqfzWDj285Afw/download/maxele.63.nc"
"from pathlib import Path\n",
"from urllib.request import urlretrieve\n",
"\n",
"netcdf_file = Path(\"maxele.63.nc\")\n",
"if netcdf_file.exists():\n",
" print(f\"{netcdf_file} already exists; skipping download.\")\n",
"else:\n",
" urlretrieve(\n",
" \"https://cloud.cera.lsu.edu/s/7PfqfzWDj285Afw/download/maxele.63.nc\",\n",
" netcdf_file,\n",
" )\n",
" print(f\"Downloaded {netcdf_file}.\")"
]
},
{
Expand DownExpand Up@@ -974,7 +999,7 @@
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"display_name": "cera-tutorials",
"language": "python",
"name": "python3"
},
Expand All@@ -988,7 +1013,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
"version": "3.12.13"
},
"orig_nbformat": 4
},
Expand Down
24 changes: 21 additions & 3 deletions Analyzing_NetCDF/README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,18 +15,36 @@ Scientific geospatial datasets like climatological or oceanographic model result

## Getting Started

### Jupiter Notebook
### Jupyter Notebook

[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/CERA-GROUP/Tutorials/blob/main/Analyzing_NetCDF/NetCDF_Tutorial/netCDF4.ipynb)

### Python standalone

* Direct python script [file](https://github.com/CERA-GROUP/CERA_Tutorials/blob/main/Notebook/net_CDF4.py).
* Direct python script [file](NetCDF_Tutorial/net_CDF4.py).

* Check the tutorial [instructions](https://github.com/CERA-GROUP/CERA_Tutorials/blob/main/Notebook/netCDF4.ipynb).
* Check the tutorial [instructions](NetCDF_Tutorial/netCDF4.ipynb).

* Example ADCIRC NetCDF file [input file](https://cloud.cera.lsu.edu/s/7PfqfzWDj285Afw/download/maxele.63.nc).

## Running the tutorial

From the repository root:

```bash
conda env create -f environment.yml
conda activate cera-tutorials
```

Then download the example data and run the notebook or standalone script:

```bash
cd Analyzing_NetCDF/NetCDF_Tutorial
wget -O maxele.63.nc https://cloud.cera.lsu.edu/s/7PfqfzWDj285Afw/download/maxele.63.nc
jupyter lab netCDF4.ipynb
python3 net_CDF4.py
```

---
### Contact Us
If you have any questions, suggestions, or would like to get in touch with our team, please feel free to reach out to us. Together, we can make a significant impact in enhancing our preparedness and resilience to storm-related challenges.
Expand Down
32 changes: 22 additions & 10 deletions Cartopy/Cartopy.ipynb
Original file line numberDiff line numberDiff line change
Expand Up@@ -142,13 +142,14 @@
"metadata": {},
"outputs": [],
"source": [
"#First, we need to install the Python libraries\n",
"!pip install cartopy\n",
"!pip install matplotlib\n",
"!pip install numpy\n",
"!pip install pandas\n",
"#optional only for the last part of the notebook\n",
"!pip install ipywidgets"
"# Recommended local setup: create the shared repository environment from the repository root.\n",
"# conda env create -f environment.yml\n",
"# conda activate cera-tutorials\n",
"# python -m ipykernel install --user --name cera-tutorials --display-name \"Python (cera-tutorials)\"\n",
"#\n",
"# Then open this notebook with the Python (cera-tutorials) kernel.\n",
"# Pip fallback only if you are not using the Conda environment:\n",
"# %pip install -r ../requirements.txt"
]
},
{
Expand All@@ -166,7 +167,18 @@
"metadata": {},
"outputs": [],
"source": [
"!wget https://cloud.cera.lsu.edu/s/6qamYSWn2FarbLP/download/water_level_stations.csv"
"from pathlib import Path\n",
"from urllib.request import urlretrieve\n",
"\n",
"csv_file = Path(\"water_level_stations.csv\")\n",
"if csv_file.exists():\n",
" print(f\"{csv_file} already exists; skipping download.\")\n",
"else:\n",
" urlretrieve(\n",
" \"https://cloud.cera.lsu.edu/s/6qamYSWn2FarbLP/download/water_level_stations.csv\",\n",
" csv_file,\n",
" )\n",
" print(f\"Downloaded {csv_file}.\")"
]
},
{
Expand DownExpand Up@@ -844,9 +856,9 @@
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"display_name": "Python (cera-tutorials)",
"language": "python",
"name": "python3"
"name": "cera-tutorials"
},
"language_info": {
"codemirror_mode": {
Expand Down
24 changes: 15 additions & 9 deletions Cartopy/README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,13 @@ This tutorial is an integral part of the CERA Storm Analysis Tutorials Repositor

## Getting Started

Create and activate the shared environment from the repository root before running the notebook or standalone script:

```bash
conda env create -f environment.yml
conda activate cera-tutorials
```

### Jupyter Notebook

[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/CERA-GROUP/Tutorials/blob/main/Cartopy/Cartopy.ipynb)
Expand All@@ -29,18 +36,17 @@ Given the relative path to the repository and the name of the Python script, you

```bash
cd Cartopy
python3 cera_cartopy.py
wget -O water_level_stations.csv https://cloud.cera.lsu.edu/s/6qamYSWn2FarbLP/download/water_level_stations.csv
python3 cera_cartopy.py water_level_stations.csv
python3 cera_cartopy.py water_level_stations.csv --output station_map.png
python3 cera_cartopy.py water_level_stations.csv --output station_map.png --no-show
python3 cera_cartopy.py water_level_stations.csv --title "Water level stations"
```

If your script requires a CSV file as an argument, you can provide it like this:
The input CSV file must contain these columns:

```bash
python3 cera_cartopy.py data.csv
```

Replace `data.csv` with the name of your CSV file or for the case of the example 'water_level_stations.csv'.
```bash
python3 cera_cartopy.py water_level_stations.csv
```text
station_id, lat, lon
```

---
Expand Down
Loading