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

[IMPA] Changing process satelllite file to optimize ram. #10

Merged
merged 33 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
205e217
.
patriciacatandi Nov 25, 2024
55d0104
adding new process_satelite.py
patriciacatandi Nov 25, 2024
0556c13
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 25, 2024
412f138
reducing cpu_request to 500m
patriciacatandi Nov 25, 2024
5d975ea
Merge branch 'staging/impa_poetry_try_libs' of github.com:prefeitura-…
patriciacatandi Nov 25, 2024
14f46e4
removing parallel operation
patriciacatandi Nov 26, 2024
dd267b9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 26, 2024
373ee01
trying to solve: 'Cannot install pysteps.'
patriciacatandi Nov 26, 2024
5da870c
Merge branch 'staging/impa_poetry_try_libs' of github.com:prefeitura-…
patriciacatandi Nov 26, 2024
3486941
trying to solve: 'Cannot install pysteps.': install pysteps on docker…
patriciacatandi Nov 26, 2024
d396683
changing dockerfile to try to fix pystep problem on instalation
patriciacatandi Dec 2, 2024
0cf7a50
trying new way to install pysteps
patriciacatandi Dec 2, 2024
473b732
trying new way to install pysteps
patriciacatandi Dec 2, 2024
69ab651
trying new way to install pysteps changing pyproject
patriciacatandi Dec 2, 2024
122d12e
trying new way to install pysteps changing pyproject
patriciacatandi Dec 2, 2024
25898d1
removing pysteps
patriciacatandi Dec 2, 2024
a407eaf
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 2, 2024
f54b709
bugfix
patriciacatandi Dec 2, 2024
6e332d5
Merge branch 'staging/impa_poetry_try_libs' of github.com:prefeitura-…
patriciacatandi Dec 2, 2024
d8170c0
adding grid
patriciacatandi Dec 3, 2024
87a0df6
creating folder
patriciacatandi Dec 3, 2024
dc2236f
changing Dask executor
patriciacatandi Dec 3, 2024
76c4ed1
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 3, 2024
cecf703
adding models params.json
patriciacatandi Dec 3, 2024
32c1e32
Merge branch 'staging/impa_poetry_try_libs' of github.com:prefeitura-…
patriciacatandi Dec 3, 2024
53b2273
adding models
patriciacatandi Dec 4, 2024
af7bb2b
Adicionando .ckpt ao rastreamento do Git LFS
patriciacatandi Dec 4, 2024
006dfd5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 4, 2024
9de1c38
downloading and treating only files from 6h ago
patriciacatandi Dec 4, 2024
87f5820
Merge branch 'staging/impa_poetry_try_libs' of github.com:prefeitura-…
patriciacatandi Dec 4, 2024
4541f60
chore: force prefect in deps
gabriel-milan Dec 5, 2024
7f5f19e
removing scheduler on LocalDaskExecutor
patriciacatandi Dec 5, 2024
2b398de
Merge branch 'staging/impa_poetry_try_libs' of github.com:prefeitura-…
patriciacatandi Dec 5, 2024
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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.ckpt filter=lfs diff=lfs merge=lfs -text
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Folders that Git should ignore
*.ipynb_checkpoints/
pipelines/precipitation_model/impa/data/
pipelines/precipitation_model/impa/data/raw/
pipelines/precipitation_model/impa/data/processed/satellite/
pipelines/precipitation_model/impa/models/data/
pipelines/precipitation_model/impa/models/docs/
pipelines/precipitation_model/impa/models/eval/
Expand Down Expand Up @@ -48,7 +49,6 @@ setup.py
*.csv
*.xls
*.pkl
*.npy
*.Rdata
*.Rds
*.hdf
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
16 changes: 12 additions & 4 deletions pipelines/precipitation_model/impa/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,22 +100,27 @@
#########################

# Input arguments (These can be passed via Prefect Parameters or CLI)
n_historical_days = 1
dt = get_start_datetime(start_datetime=start_datetime)
relevant_dts, days_of_year, years = get_relevant_dates_informations(dt=dt)
relevant_dts, days_of_year, years, relevant_times = get_relevant_dates_informations(
dt=dt, n_historical_days=n_historical_days
)

# Download data from s3
downloaded_files_rr = download_files_from_s3(
product="ABI-L2-RRQPEF",
relevant_dts=relevant_dts,
days_of_year=days_of_year,
years=years,
relevant_times=relevant_times,
download_base_path=download_base_path,
)
downloaded_files_achaf = download_files_from_s3(
product="ABI-L2-ACHAF",
relevant_dts=relevant_dts,
days_of_year=days_of_year,
years=years,
relevant_times=relevant_times,
download_base_path=download_base_path,
)

Expand All @@ -124,14 +129,17 @@
day_of_year=days_of_year[0],
num_workers=num_workers,
product="ABI-L2-RRQPEF",
n_historical_days=n_historical_days,
wait=downloaded_files_rr,
)
data_processed_achaf = process_satellite_task(
year=years[0],
day_of_year=days_of_year[0],
num_workers=num_workers,
product="ABI-L2-ACHAF",
wait=[downloaded_files_achaf, data_processed_rr],
n_historical_days=n_historical_days,
wait=[downloaded_files_achaf],
# wait=[downloaded_files_achaf, data_processed_rr],
)
dfr = build_dataframe_task(num_workers, dt, wait=[data_processed_rr, data_processed_achaf])
output_predict_filepaths = get_predictions(num_workers=num_workers, cuda=cuda, wait=dfr)
Expand Down Expand Up @@ -201,9 +209,9 @@
labels=[
constants.WEATHER_FORECAST_AGENT_LABEL.value,
],
cpu_request="1",
cpu_request="500m",
memory_limit="30Gi",
memory_request="15Gi",
)
prediction_previsao_chuva_impa.schedule = prediction_schedule
prediction_previsao_chuva_impa.executor = LocalDaskExecutor(num_workers=2) # 10
prediction_previsao_chuva_impa.executor = LocalDaskExecutor(num_workers=50)
Git LFS file not shown
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"normalized": 3, "batch": 16, "loss": 2, "weights": 2, "data_modification": null, "n_after": 18, "n_before": 12, "n_epochs": 50, "predict_dataset": null, "lambda_": 0.1, "learning_rate": 0.0002, "model_name": "Evolution_Network"}
Git LFS file not shown
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"normalized": 2, "learning_rate": 0.00027, "n_after": 20, "n_before": 10, "std_fac": 10.0, "n_epoch": 100, "weight_bool": 1, "data_modification": null, "model_name": "Mamba"}
Git LFS file not shown
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"normalized": 3, "batch": 4, "loss": 2, "weights": 2, "data_modification": null, "n_after": 18, "n_before": 12, "n_epochs": 25, "predict_dataset": null, "learning_rate": 0.0001, "weight_decay": 0.01, "depth": 8, "dim": 128, "lead_time_dim_embedding": null, "resnet_block_depth": 2, "correct_context": true, "model_name": "Metnet3"}
Git LFS file not shown
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"normalized": 3, "batch": 16, "loss": 2, "weights": 2, "data_modification": null, "n_after": 18, "n_before": 4, "n_epochs": 30, "predict_dataset": null, "discriminator_learning_rate": 0.0002, "generator_learning_rate": 0.0002, "alpha": 6, "beta": 20, "generation_steps": 4, "predictions": 2, "predictions_option": 2, "ckpt_file_predictions": "1--best-epoch=3", "model_name": "NowcastNet"}
Git LFS file not shown
3 changes: 3 additions & 0 deletions pipelines/precipitation_model/impa/models/UNET/params.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{"normalized": 3, "batch": 16, "loss": 2, "weights": 2, "data_modification": null, "n_after": 18, "n_before": 12, "n_epochs": 50, "predict_dataset": null, "learning_rate": 0.0002, "weight_decay": 0.01, "bilinear": true, "dimension_division": null, "model_name": "UNET"}


Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import h5py
import numpy as np
from prefeitura_rio.pipelines_utils.logging import log # pylint: disable=E0611, E0401
from tqdm import tqdm

from pipelines.precipitation_model.impa.src.data.process.SatelliteData import (
Expand Down Expand Up @@ -109,14 +110,18 @@ def build_dataframe(
)
exit(0)

log("Loading grids")
grid_small = np.load(
f"pipelines/precipitation_model/impa/data/dataframe_grids/{location}-res=2km-256x256.npy"
)
grid_large = np.load(
f"pipelines/precipitation_model/impa/data/dataframe_grids/{location}-res=4km-256x256.npy"
)
log(f"grid_small.shape: {grid_small.shape}, grid_large.shape: {grid_large.shape}")
assert grid_small.shape == grid_large.shape
ni, nj = grid_small.shape[:2]

log("Start saving files as h5")
with h5py.File(output_filepath, "w") as f:
what = f.create_group("what")
what.attrs["feature"] = product
Expand Down
Loading
Loading