Skip to content

Instantly share code, notes, and snippets.

@jklymak
Created July 7, 2023 23:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jklymak/126a7b9a01c09590550c73fca79eef54 to your computer and use it in GitHub Desktop.
Save jklymak/126a7b9a01c09590550c73fca79eef54 to your computer and use it in GitHub Desktop.
import xarray as xr
# https://oceandata.sci.gsfc.nasa.gov/ob/getfile/AQUA_MODIS.20230606T215500.L2.SST.NRT.nc
with xr.open_dataset('/Users/jklymak/Downloads/AQUA_MODIS.20230606T215500.L2.OC.NRT.nc',group='geophysical_data') as ds, xr.open_dataset('/Users/jklymak/Downloads/AQUA_MODIS.20230606T215500.L2.OC.NRT.nc',group='navigation_data') as nav:
print(nav)
ds['lon'] = (('number_of_lines', 'pixels_per_line'), nav['longitude'].values)
ds['lat'] = (('number_of_lines', 'pixels_per_line'), nav['latitude'].values)
for j in range(0, 2030):
if np.any(~np.isfinite(ds.lat[j, :])):
print(j)
ds = ds.sel(number_of_lines=slice(0, 2019))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment