Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

7 patch extension #52

Merged
merged 18 commits into from
Sep 26, 2024
Merged
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
4 changes: 2 additions & 2 deletions config/example/datamodule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ dataloader:

datasets_spec:
msg:
data_path: /path/to/your/data
data_path: /path/to/msg/data
goes:
data_path: /path/to/your/data
data_path: /path/to/goes/data
load_coords: True
load_cloudmask: True

Expand Down
6 changes: 3 additions & 3 deletions config/example/download.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# PERIOD
period:
start_date: '2020-10-01'
start_date: '2020-01-01'
start_time: '00:00:00'
end_date: '2020-10-31'
end_date: '2020-12-31'
end_time: '23:59:00'

# CLOUD MASK
cloud_mask: True

# PATH FOR SAVING DATA
save_dir: data
save_dir: /path/to/save/data

defaults:
- _self_
Expand Down
4 changes: 2 additions & 2 deletions config/example/geoprocess.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# PATH WITH RAW DATA
read_path: data
read_path: /path/to/donwloaded/data

# PATH FOR SAVING GEOPROCESSED DATA
save_path: data
save_path: /path/to/save/geoprocessed/data

defaults:
- _self_
6 changes: 3 additions & 3 deletions config/example/main.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defaults:
- download
- geoprocess
- patch
- satellite: terra
# - patch
- satellite: msg

stage: patch
stage: geoprocess
6 changes: 3 additions & 3 deletions config/example/patch.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# PATH WITH GEOPROCESSED DATA
read_path: data
read_path: /path/to/geoprocessed/data

# PATH FOR SAVING PATCHES
save_path: data
save_path: /path/to/save/patches

# PATCH PARAMETERS
patch_size: 256
Expand All @@ -11,7 +11,7 @@ stride_size: 256
# NAN CUTOFF
nan_cutoff: 0.5

# FILETYPE TO SAVE [nc = netcdf, np = numpy]
# FILETYPE TO SAVE [nc = netcdf, tif = geotiff, np = numpy, npz = compressed numpy]
save_filetype: nc

defaults:
Expand Down
Empty file removed config/example/preprocess.yaml
Empty file.
2 changes: 0 additions & 2 deletions config/example/satellite/aqua.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ geoprocess:
save_path: ${save_path}/aqua/geoprocessed
satellite: aqua

# preprocess:

patch:
_target_: rs_tools._src.preprocessing.prepatcher.prepatch
read_path: ${read_path}/aqua/geoprocessed
Expand Down
14 changes: 6 additions & 8 deletions config/example/satellite/goes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,18 @@ download:
start_time: ${period.start_time}
end_date: ${period.end_date}
end_time: ${period.end_time}
daily_window_t0: "14:00:00"
daily_window_t1: "20:00:00"
daily_window_t0: "00:00:00"
daily_window_t1: "23:59:00"
time_step: "1:00:00"

geoprocess:
_target_: rs_tools._src.geoprocessing.goes.geoprocessor_goes16.geoprocess
read_path: ${read_path}/goes16/raw
save_path: ${save_path}/goes16/geoprocessed
resolution: null
region: "-130 -15 -90 5"
read_path: ${read_path}/goes-data/2020/split_${split}
save_path: ${save_path}/goes-geoprocessed/goes
resolution: null # MSG resolution = 3000.40
region: null
resample_method: bilinear

# preprocess:

patch:
_target_: rs_tools._src.preprocessing.prepatcher.prepatch
read_path: ${read_path}/goes16/geoprocessed
Expand Down
12 changes: 5 additions & 7 deletions config/example/satellite/msg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,18 @@ download:
start_time: ${period.start_time}
end_date: ${period.end_date}
end_time: ${period.end_time}
daily_window_t0: "9:00:00"
daily_window_t1: "17:00:00"
daily_window_t0: "00:00:00"
daily_window_t1: "23:59:00"
time_step: "1:00:00"

geoprocess:
_target_: rs_tools._src.geoprocessing.msg.geoprocessor_msg.geoprocess
read_path: ${read_path}/msg/raw
save_path: ${save_path}/msg/geoprocessed
read_path: ${read_path}/msg-data/msg
save_path: ${save_path}/msg-geoprocessed/msg
resolution: null
region: "-70 -15 20 5"
region: null
resample_method: bilinear

# preprocess:

patch:
_target_: rs_tools._src.preprocessing.prepatcher.prepatch
read_path: ${read_path}/msg/geoprocessed
Expand Down
2 changes: 0 additions & 2 deletions config/example/satellite/terra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ geoprocess:
save_path: ${save_path}/terra/geoprocessed
satellite: terra

# preprocess:

patch:
_target_: rs_tools._src.preprocessing.prepatcher.prepatch
read_path: ${read_path}/terra/geoprocessed
Expand Down
3 changes: 3 additions & 0 deletions environments/environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ dependencies:
- typer
- einops
- cartopy
- google-cloud-storage
- gcsfs
- xrpatcher
# formatting
- rasterio
- black
Expand Down
103 changes: 103 additions & 0 deletions notebooks/dev/goes/1.6-additional-download.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import glob\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [],
"source": [
"path = '/mnt/disks/goes-data/2020/CM/'"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [],
"source": [
"def get_list_filenames(data_path: str=\"./\", ext: str=\"*\"):\n",
" \"\"\"\n",
" Loads a list of file names within a directory.\n",
"\n",
" Args:\n",
" data_path (str, optional): The directory path to search for files. Defaults to \"./\".\n",
" ext (str, optional): The file extension to filter the search. Defaults to \"*\".\n",
"\n",
" Returns:\n",
" List[str]: A sorted list of file names matching the given extension within the directory.\n",
" \"\"\"\n",
" pattern = f\"*{ext}\"\n",
" return sorted(glob.glob(os.path.join(data_path, \"**\", pattern), recursive=True))"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {},
"outputs": [],
"source": [
"files = get_list_filenames(path, ext=\"nc\")"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"8733"
]
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(files)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "rs_tools",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading
Loading