-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add salinity restoring file generation #36
base: main
Are you sure you want to change the base?
Conversation
Thanks @ezhilsabareesh8 - I will review soon. I assume this uses the hh5 conda/analysis module ? If you run black on the script and commit the change, then the formatting test should pass. From the Readme: Python scripts are formatted using the black formatter. This is enforced using a github action running on pull requests. You will need to have pre-commit and black installed in your python environment. It is included in the conda/analysis enviornments in hh5, otherwise it can be installed through pip or conda. Then run |
Thanks @anton-seaice, I just reformatted it using black. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ezhilsabareesh8
If you keep the data as an xarray object, it will save having to recreate all the attributes and dimensions etc. See the suggestions
salinity_restoring_generation/make_salt_sfc_restore_from_regridded_woa.py
Outdated
Show resolved
Hide resolved
salinity_restoring_generation/make_salt_sfc_restore_from_regridded_woa.py
Outdated
Show resolved
Hide resolved
|
||
# Create a new NetCDF file using netCDF4 | ||
output_file = f"{output_path}/salt_sfc_restore.nc" | ||
with nc.Dataset(output_file, "w", format="NETCDF4") as ncfile: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you use xarray suggestions above, the only extra attributes you need are these (i think):
salt_var.standard_name = "sea_water_salinity"
salt_var.long_name = "Smoothed sea water salinity at level 0m"
salt_var.units = "1"
you should just be able to set those and then say
salt_smoothed_da.to_netcdf()
Co-authored-by: Anton Steketee <[email protected]>
Have a look now @ezhilsabareesh8 - this should work if we fix the time:units attribute in the source data |
salinity_restoring_generation/make_salt_sfc_restore_from_regridded_woa.py
Outdated
Show resolved
Hide resolved
This change will contribute to COSIMA/access-om3#207 |
Lets park this until
are completed, and then we can finish this review. |
@anton-seaice I noticed that the time variable was changed to match the initial conditions, but the salinity restoring should actually begin at the middle of each month. In my original code, I had overwritten the time variable with:
Could you please revert the changes made to the time variable in this commit 8b0c207? |
This script processes and smooths sea water salinity data from the initial conditions NetCDF files generated using https://github.com/COSIMA/initial_conditions_access-om2 . It applies a uniform smoothing filter to the surface layer (0m depth) of the salinity for each month and concatenates the smoothed data into a single output NetCDF file.