Skip to content

Instantly share code, notes, and snippets.

@robertjwilson
Last active April 1, 2021 11:31
Show Gist options
  • Save robertjwilson/058e8e3ec985150641b9ecf9ee9341a1 to your computer and use it in GitHub Desktop.
Save robertjwilson/058e8e3ec985150641b9ecf9ee9341a1 to your computer and use it in GitHub Desktop.
import nctoolkit as nc
ds = nc.open_data("IASI_METOPA_L2_CO_20190921_ULB-LATMOS_V6.4.0.nc")
ds.assign(mask = lambda x: x.longitude > 0 and x.longitude < 180 and x.latitude > 77 and x.latitude < 80, drop = True)
# ds.set_missing(0)
time_steps = list(ds.to_dataframe().reset_index().reset_index(drop = True).query("mask == 1").index)
time_steps = [x for x in time_steps]
ds.select(time = time_steps)
ds.to_nc("cropped.nc")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment