update Om3#13
Conversation
rbeucher
left a comment
There was a problem hiding this comment.
Hi @rhaegar325,
Thank you. Can you please add some comments to your code. It would make things easier for us to review and keep track of what is happening.
I also would like to have some tests added.
I need to test the code so I can see that it is working properly.
| data = var.values | ||
| # CMOR 3.10 no longer accept NaN values as missing data. Use 1e20 instead. | ||
| # Fill Nan in data | ||
| var_fixed = var.fillna(1e20) |
There was a problem hiding this comment.
Starting from CMOR 3.10, NaN values are no longer accepted. Therefore, we replace NaN values before calling cmor.variable()
|
|
||
| # Define CMOR variable | ||
| cmorVar = cmor.variable(cmor_name, variable_units, cmor_axes, positive=positive) | ||
| missing = 1e20 |
There was a problem hiding this comment.
identify Missing value for CMOR
| data = var.values | ||
| # CMOR 3.10 no longer accept NaN values as missing data. Use 1e20 instead. | ||
| # Fill Nan in data | ||
| var_fixed = var.fillna(1e20) |
There was a problem hiding this comment.
Replace NaN values before calling cmor.variable()
|
|
||
| # Define CMOR variable | ||
| cmorVar = cmor.variable(cmor_name, variable_units, cmor_axes, positive=positive) | ||
| missing = 1e20 |
There was a problem hiding this comment.
identify Missing value for CMOR
|
|
||
| # Define CMOR variable | ||
| cmorVar = cmor.variable(cmor_name, variable_units, cmor_axes, positive=positive) | ||
| missing = 1e20 |
There was a problem hiding this comment.
identify Missing value for CMOR
| self.supergrid_file = supergrid_file | ||
| self.supergrid = xr.open_dataset(supergrid_file) | ||
| else: | ||
| raise ValueError("Couldn't find supergrid file") |
There was a problem hiding this comment.
Update to adapt to the split test dataset (x.nc, y.nc).
| DATA_DIR / f"om3/2d/access-om3.mom6.2d.{cmor_name}.1mon.mean.1902_01.nc" | ||
| ) | ||
| try: | ||
| model_om3.supergrid = glob.glob(str(DATA_DIR / "om3/supergrid/*.nc")) |
There was a problem hiding this comment.
Because GitHub does not allow files larger than 100 MB, I split the original supergrid file into two smaller files (x.nc and y.nc), each containing only the required variables.
During testing, we now need to load and merge these two files before use.
| DATA_DIR / f"om3/3d/access-om3.mom6.3d.{cmor_name}.1mon.mean.1924_01.nc" | ||
| ) | ||
| try: | ||
| model_om3.supergrid = glob.glob(str(DATA_DIR / "om3/supergrid/*.nc")) |
|
Hi @rhaegar325, I have made some modifications to the code so most of this PR is not relevant anymore. However, I have cherry-picked some of your changes. I still need to implement the OM3 work but that should not be too much of an issue. Anyway, I am closing this now. Let's chat later. |
No description provided.