nctoolkit.DataSet.crop

DataSet.crop(lon=[-180, 180], lat=[-90, 90], nco=False, nco_vars=None)

crop: Crop to a rectangular longitude and latitude box

Parameters:
  • lon (list) – The longitude range to select. This must be two variables, between -180 and 180 when nco = False.

  • lat (list) – The latitude range to select. This must be two variables, between -90 and 90 when nco = False.

  • nco (boolean) – Do you want this to use NCO for cropping? Defaults to False, and uses CDO. Set to True if you want to call NCO. NCO is typically better at handling very large horizontal grids.

  • nco_vars (str or list) – If using NCO, the variables you want to select

Examples

If you wanted to crop a dataset to longitudes between -40 and 30 and latitudes between -10 and 40, you would do the following:

>>> ds.crop(lon = [-40, 30], lat = [-10, 40])

If you wanted to select only the northern hemisphere, the following will work:

>>> ds.crop(lat = [0, 90])