Created
May 8, 2025 13:51
-
-
Save ashiklom/3dd89652eefdd12393c8243c053cbc4a to your computer and use it in GitHub Desktop.
GiOcean constant variables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import xarray as xr | |
ds = xr.open_dataset("GiOCEAN_e1.sfc_tavg_3hr_glo_L720x361_sfc.20241101_0730z.nc4") | |
coord_vars = list(ds.coords) | |
stdev = ds.std() | |
var_names_all = list(stdev.variables) | |
var_names = list(set(var_names_all) - {"lon", "lat", "lev", "time"}) | |
# Print variables for which standard deviation is zero | |
constant_vars = [var for var in var_names if stdev[var] == 0] | |
print(constant_vars) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment