73 water vapor notebook - #74
Conversation
|
Hi @SarahAlidoost , while working on #73, I got an error in the notebook. This notebooks is adapted from the SST hourly one. It fails on |
|
Hi @SarahAlidoost , can you review this notwbook when you have time? The error was caused by an empty dataset. I added a check to predict, and initiated loss as an zero Tensor. Another thing maybe we need to pay attention, is the water wapor data is downsampled by the factor of 2 comparing to SST. This requires some attention to lsm data. In the notebook I used an average window to downsample the lsm, and set <0.5 to 0, and >=0.5 to 1. We can discuss if this makes sense. |
SarahAlidoost
left a comment
There was a problem hiding this comment.
@rogerkuou Thanks! 👍 I added one comment on the changed code. Levante is not available today and I dont have data locally. I will check the notebook later. About the spatial resolution of water vapor, I expected era5 data have the same spatial resolution; this is something to check in our next update meeting. I couldnot also check the era5 data as CDS is also on maintenance.
Indeed there are a few things about water vapor data to check:
|
During the meeting in July 24, we discussed the issues with Axel:
@SarahAlidoost shall we consider merging this PR for now? My motivation is that this PR also renames example notebooks to distinguish sst and water vapor. It can set good templates for other PRs. |
|
Updated on 20260814 About the masking, I found CDS always provide 0.25 degrees. If using esemble mean to download, the downloaded mask are floating values. I check with xel he is fine with thresholding the floating mask with 0.5 values. Maybe let's do that and create another mask file matching the Water vapor data? What do you think @SarahAlidoost and @meiertgrootes ? |
|
Hi @SarahAlidoost, in this PR I made example notebooks for watervapor. I executed the daily one locally and the hourly one on Levante. I observed that the validation loss does not reduce, and the training stops with early stops. This is especially significant in the hourly training. I have tried using different month (I started with Jan, then switched to April. It the same as SST setting, three identical month from 2020-2022 for training, validation and testing), and reduced the learning rate to half (just in case if we are missing optimal). The validation loss curve stays flat. I hope for a full training with multiple month can help. But I will wait till your test with #92 (Updated on SEP 10) I merged your fix in #92 to this PR, to include your fix for the bug. So it will make sense to review this after merging #92. |
|
Hi @SarahAlidoost , I brought this branch up to date. See my previous comment for details. Meanwhile, following our discussion today, I will make another test on the training dataset to see if the training is able to overfit on the training data. This can validate if the problem is actually training on one month |
| <<<<<<< HEAD:notebooks/sst/training_hourly_sst.ipynb | ||
| "monthly_data_test = xr.open_mfdataset(data_folder / f\"202001_mon_ERA5dc_full_{var_name}.nc\")\n", | ||
| ======= | ||
| "monthly_data_test = xr.open_mfdataset(data_folder / f\"202201_mon_ERA5dc_full_{var_name}.nc\")\n", | ||
| >>>>>>> main:notebooks/example_hourly.ipynb |
There was a problem hiding this comment.
these are leftover from merging. Could you fix them?
| <<<<<<< HEAD:notebooks/sst/training_hourly_sst.ipynb | ||
| "spatial_patch_size = monthly_da.shape[1:] # the whole dataset \n", | ||
| ======= | ||
| "spatial_crop_size = monthly_da.shape[1:] # the whole dataset \n", | ||
| >>>>>>> main:notebooks/example_hourly.ipynb |
* implement lsm convertion func from sst to wv * add unit test; fix linting issue * update notebooks with lsm conversion func * linting * rerun daily notebook * Apply batched suggestions from code review Co-authored-by: SarahAlidoost <55081872+SarahAlidoost@users.noreply.github.com> * rename function * update variable name --------- Co-authored-by: SarahAlidoost <55081872+SarahAlidoost@users.noreply.github.com>
Co-authored-by: SarahAlidoost <55081872+SarahAlidoost@users.noreply.github.com>
|
@SarahAlidoost thanks! I addressed your comments. shall we merge this PR now? Or do you want to wait till we perform a training with multiple months of watervapor? |
There was a problem hiding this comment.
@rogerkuou thanks for addressing the comments. I'm reviewing the results. Meanwhile, there are several issues in the notebooks that should be fixed before merging. I couldn't comment directly on the notebooks, so I wrote them here:
- In daily notebooks, under section "Prepare the test data", (in sst notebook see cell 20 and in watervapor notebook see cell 21), the variable
spatial_patch_sizeshould be replaced withspatial_crop_size. - In hourly watervapor notebook, the cell containing
prediction_config = PredictionConfig(...)is duplicated. - There is an unused import
add_month_day_dimsin hourly notebooks. - For comparison purposes, we want same data in daily and hourly notebook. Please use month 01 in hourly notebook.
- The variable name
lsm_mask_sstis confusing as land-sea mask is not related to the climate variable like sst or water vapour. Please rename it. - Some training configs are changed in hourly notebook, like
optimizer_lr. Could you fix them so notebooks are consistent.
Oh, it seems that I missed the update in your comment. |
|
Hi @SarahAlidoost , thanks! I addressed your new comments:
|
The dropping loss and the comparison with the baseline are good signs that the model is learning from the data. But the train loss is still quite high (0.049759 after 100 epochs). My guess is that the training subset is small compared to the model size. For the validation set, maybe using the full training dataset could help with the fitting issue. So for now, I’d say the results in the notebook are mainly for experimentation, and we probably shouldn’t draw any conclusions about the final error yet. |
SarahAlidoost
left a comment
There was a problem hiding this comment.
@rogerkuou thanks for addressing the comments 👍 . Feel free to merge.
One small thing for future PRs: please run Ruff only on the files changed for the PR. For example, I don’t think we need to fix tuning.py as part of this PR.
Thanks and noted! Do you know a practical way to do this? My formatting is done by pre-commit hooks. Maybe I will turn it off next time if I see irrelevant files. This time the formatting is introduced in the process of fixing conflicts. Will merge this PR. |
Fix #73 .
Should be merged after #96, since PR #96 contains improvement for this PR.
Should be merged after #92Contains changes in #92 to fix gem embedding bug.(#92 already merged on Sep 9)
Changes in code
Added check for empty dataset
Init loss in predict as a tensor
Changes in notebooks:
separated notebooks to sst and watervapor folder
added daily watervapor training notebook with local execution results
added hourly watervapor traning notebook with Levante execution results