In [1]:
import xarray as xr

ds = xr.open_mfdataset("local_folder/oscar_vel2022.nc")
In [2]:
# pull out data for all of 2022-June
ds.sel(time="2022-06")
Out[2]:
<xarray.Dataset>
Dimensions:    (time: 6, year: 72, depth: 1, latitude: 481, longitude: 1201)
Coordinates:
  * time       (time) datetime64[ns] 2022-06-02 2022-06-07 ... 2022-06-27
  * year       (year) float32 2.022e+03 2.022e+03 ... 2.023e+03 2.023e+03
  * depth      (depth) float32 15.0
  * latitude   (latitude) float64 80.0 79.67 79.33 79.0 ... -79.33 -79.67 -80.0
  * longitude  (longitude) float64 20.0 20.33 20.67 21.0 ... 419.3 419.7 420.0
Data variables:
    u          (time, depth, latitude, longitude) float64 dask.array<chunksize=(6, 1, 481, 1201), meta=np.ndarray>
    v          (time, depth, latitude, longitude) float64 dask.array<chunksize=(6, 1, 481, 1201), meta=np.ndarray>
    um         (time, depth, latitude, longitude) float64 dask.array<chunksize=(6, 1, 481, 1201), meta=np.ndarray>
    vm         (time, depth, latitude, longitude) float64 dask.array<chunksize=(6, 1, 481, 1201), meta=np.ndarray>
Attributes: (12/15)
    VARIABLE:       Ocean Surface Currents
    DATATYPE:       1/72 YEAR Interval
    DATASUBTYPE:    unfiltered
    GEORANGE:       20 to 420 -80 to 80
    PERIOD:         Jan.01,2022 to Dec.26,2022
    year:           2022
    ...             ...
    source:         Gary Lagerloef, ESR ([email protected]) and Kathleen Dohan, E...
    contact:        Kathleen Dohan ([email protected]) or John T. Gunn (gunn@esr...
    company:        Earth & Space Research, Seattle, WA
    reference:      Bonjean F. and G.S.E. Lagerloef, 2002 ,Diagnostic model a...
    note1:          Maximum Mask velocity is the geostrophic component at all...
    note2:          Longitude extends from 20 E to 420 E to avoid a break in ...
xarray.Dataset
    • time: 6
    • year: 72
    • depth: 1
    • latitude: 481
    • longitude: 1201
    • time
      (time)
      datetime64[ns]
      2022-06-02 ... 2022-06-27
      long_name :
      Day since 1992-10-05 00:00:00
      array(['2022-06-02T00:00:00.000000000', '2022-06-07T00:00:00.000000000',
             '2022-06-12T00:00:00.000000000', '2022-06-17T00:00:00.000000000',
             '2022-06-22T00:00:00.000000000', '2022-06-27T00:00:00.000000000'],
            dtype='datetime64[ns]')
    • year
      (year)
      float32
      2.022e+03 2.022e+03 ... 2.023e+03
      units :
      time in years
      long_name :
      Time in fractional year
      array([2022.    , 2022.0139, 2022.0278, 2022.0416, 2022.0555, 2022.0695,
             2022.0834, 2022.0972, 2022.1111, 2022.125 , 2022.1389, 2022.1528,
             2022.1666, 2022.1805, 2022.1945, 2022.2084, 2022.2222, 2022.2361,
             2022.25  , 2022.2639, 2022.2778, 2022.2916, 2022.3055, 2022.3195,
             2022.3334, 2022.3472, 2022.3611, 2022.375 , 2022.3889, 2022.4028,
             2022.4166, 2022.4305, 2022.4445, 2022.4584, 2022.4722, 2022.4861,
             2022.5   , 2022.5139, 2022.5278, 2022.5416, 2022.5555, 2022.5695,
             2022.5834, 2022.5972, 2022.6111, 2022.625 , 2022.6389, 2022.6528,
             2022.6666, 2022.6805, 2022.6945, 2022.7084, 2022.7222, 2022.7361,
             2022.75  , 2022.7639, 2022.7778, 2022.7916, 2022.8055, 2022.8195,
             2022.8334, 2022.8472, 2022.8611, 2022.875 , 2022.8889, 2022.9028,
             2022.9166, 2022.9305, 2022.9445, 2022.9584, 2022.9722, 2022.9861],
            dtype=float32)
    • depth
      (depth)
      float32
      15.0
      units :
      meter
      long_name :
      Depth
      array([15.], dtype=float32)
    • latitude
      (latitude)
      float64
      80.0 79.67 79.33 ... -79.67 -80.0
      units :
      degrees-north
      long_name :
      Latitude
      array([ 80.      ,  79.666667,  79.333333, ..., -79.333333, -79.666667,
             -80.      ])
    • longitude
      (longitude)
      float64
      20.0 20.33 20.67 ... 419.7 420.0
      units :
      degrees-east
      long_name :
      Longitude
      array([ 20.      ,  20.333333,  20.666667, ..., 419.333333, 419.666667,
             420.      ])
    • u
      (time, depth, latitude, longitude)
      float64
      dask.array<chunksize=(6, 1, 481, 1201), meta=np.ndarray>
      units :
      meter/sec
      long_name :
      Ocean Surface Zonal Currents
      Array Chunk
      Bytes 26.44 MiB 26.44 MiB
      Shape (6, 1, 481, 1201) (6, 1, 481, 1201)
      Dask graph 1 chunks in 3 graph layers
      Data type float64 numpy.ndarray
      6 1 1201 481 1
    • v
      (time, depth, latitude, longitude)
      float64
      dask.array<chunksize=(6, 1, 481, 1201), meta=np.ndarray>
      units :
      meter/sec
      long_name :
      Ocean Surface Meridional Currents
      Array Chunk
      Bytes 26.44 MiB 26.44 MiB
      Shape (6, 1, 481, 1201) (6, 1, 481, 1201)
      Dask graph 1 chunks in 3 graph layers
      Data type float64 numpy.ndarray
      6 1 1201 481 1
    • um
      (time, depth, latitude, longitude)
      float64
      dask.array<chunksize=(6, 1, 481, 1201), meta=np.ndarray>
      units :
      meter/sec
      long_name :
      Ocean Surface Zonal Currents Maximum Mask
      Array Chunk
      Bytes 26.44 MiB 26.44 MiB
      Shape (6, 1, 481, 1201) (6, 1, 481, 1201)
      Dask graph 1 chunks in 3 graph layers
      Data type float64 numpy.ndarray
      6 1 1201 481 1
    • vm
      (time, depth, latitude, longitude)
      float64
      dask.array<chunksize=(6, 1, 481, 1201), meta=np.ndarray>
      units :
      meter/sec
      long_name :
      Ocean Surface Meridional Currents Maximum Mask
      Array Chunk
      Bytes 26.44 MiB 26.44 MiB
      Shape (6, 1, 481, 1201) (6, 1, 481, 1201)
      Dask graph 1 chunks in 3 graph layers
      Data type float64 numpy.ndarray
      6 1 1201 481 1
    • time
      PandasIndex
      PandasIndex(DatetimeIndex(['2022-06-02', '2022-06-07', '2022-06-12', '2022-06-17',
                     '2022-06-22', '2022-06-27'],
                    dtype='datetime64[ns]', name='time', freq=None))
    • year
      PandasIndex
      PandasIndex(Index([            2022.0,  2022.013916015625,   2022.02783203125,
             2022.0416259765625, 2022.0555419921875, 2022.0694580078125,
             2022.0833740234375,   2022.09716796875,  2022.111083984375,
                       2022.125,  2022.138916015625,   2022.15283203125,
             2022.1666259765625, 2022.1805419921875, 2022.1944580078125,
             2022.2083740234375,   2022.22216796875,  2022.236083984375,
                        2022.25,  2022.263916015625,   2022.27783203125,
             2022.2916259765625, 2022.3055419921875, 2022.3194580078125,
             2022.3333740234375,   2022.34716796875,  2022.361083984375,
                       2022.375,  2022.388916015625,   2022.40283203125,
             2022.4166259765625, 2022.4305419921875, 2022.4444580078125,
             2022.4583740234375,   2022.47216796875,  2022.486083984375,
                         2022.5,  2022.513916015625,   2022.52783203125,
             2022.5416259765625, 2022.5555419921875, 2022.5694580078125,
             2022.5833740234375,   2022.59716796875,  2022.611083984375,
                       2022.625,  2022.638916015625,   2022.65283203125,
             2022.6666259765625, 2022.6805419921875, 2022.6944580078125,
             2022.7083740234375,   2022.72216796875,  2022.736083984375,
                        2022.75,  2022.763916015625,   2022.77783203125,
             2022.7916259765625, 2022.8055419921875, 2022.8194580078125,
             2022.8333740234375,   2022.84716796875,  2022.861083984375,
                       2022.875,  2022.888916015625,   2022.90283203125,
             2022.9166259765625, 2022.9305419921875, 2022.9444580078125,
             2022.9583740234375,   2022.97216796875,  2022.986083984375],
            dtype='float32', name='year'))
    • depth
      PandasIndex
      PandasIndex(Index([15.0], dtype='float32', name='depth'))
    • latitude
      PandasIndex
      PandasIndex(Index([              80.0,  79.66666666666667,  79.33333333333333,
                           79.0,  78.66666666666667,  78.33333333333333,
                           78.0,  77.66666666666667,  77.33333333333333,
                           77.0,
             ...
                          -77.0, -77.33333333333333, -77.66666666666667,
                          -78.0, -78.33333333333333, -78.66666666666667,
                          -79.0, -79.33333333333333, -79.66666666666667,
                          -80.0],
            dtype='float64', name='latitude', length=481))
    • longitude
      PandasIndex
      PandasIndex(Index([              20.0, 20.333333333333332, 20.666666666666664,
                           21.0, 21.333333333333332, 21.666666666666664,
                           22.0, 22.333333333333332, 22.666666666666664,
                           23.0,
             ...
                          417.0,  417.3333333333333,  417.6666666666667,
                          418.0,  418.3333333333333,  418.6666666666667,
                          419.0,  419.3333333333333,  419.6666666666667,
                          420.0],
            dtype='float64', name='longitude', length=1201))
  • VARIABLE :
    Ocean Surface Currents
    DATATYPE :
    1/72 YEAR Interval
    DATASUBTYPE :
    unfiltered
    GEORANGE :
    20 to 420 -80 to 80
    PERIOD :
    Jan.01,2022 to Dec.26,2022
    year :
    2022
    description :
    OSCAR Third Degree Sea Surface Velocity
    CREATION_DATE :
    02:21 06-Feb-2023
    version :
    2009.0
    source :
    Gary Lagerloef, ESR ([email protected]) and Kathleen Dohan, ESR ([email protected])
    contact :
    Kathleen Dohan ([email protected]) or John T. Gunn ([email protected])
    company :
    Earth & Space Research, Seattle, WA
    reference :
    Bonjean F. and G.S.E. Lagerloef, 2002 ,Diagnostic model and analysis of the surface currents in the tropical Pacific ocean, J. Phys. Oceanogr., 32, 2,938-2,954
    note1 :
    Maximum Mask velocity is the geostrophic component at all points + any concurrent Ekman and buoyancy components
    note2 :
    Longitude extends from 20 E to 420 E to avoid a break in major ocean basins. Data repeats in overlap region.
In [3]:
# demonstrate "nearest" indexing
ds.sel(longitude=240.2, method="nearest")
Out[3]:
<xarray.Dataset>
Dimensions:    (time: 72, year: 72, depth: 1, latitude: 481)
Coordinates:
  * time       (time) datetime64[ns] 2022-01-01 2022-01-06 ... 2022-12-26
  * year       (year) float32 2.022e+03 2.022e+03 ... 2.023e+03 2.023e+03
  * depth      (depth) float32 15.0
  * latitude   (latitude) float64 80.0 79.67 79.33 79.0 ... -79.33 -79.67 -80.0
    longitude  float64 240.3
Data variables:
    u          (time, depth, latitude) float64 dask.array<chunksize=(72, 1, 481), meta=np.ndarray>
    v          (time, depth, latitude) float64 dask.array<chunksize=(72, 1, 481), meta=np.ndarray>
    um         (time, depth, latitude) float64 dask.array<chunksize=(72, 1, 481), meta=np.ndarray>
    vm         (time, depth, latitude) float64 dask.array<chunksize=(72, 1, 481), meta=np.ndarray>
Attributes: (12/15)
    VARIABLE:       Ocean Surface Currents
    DATATYPE:       1/72 YEAR Interval
    DATASUBTYPE:    unfiltered
    GEORANGE:       20 to 420 -80 to 80
    PERIOD:         Jan.01,2022 to Dec.26,2022
    year:           2022
    ...             ...
    source:         Gary Lagerloef, ESR ([email protected]) and Kathleen Dohan, E...
    contact:        Kathleen Dohan ([email protected]) or John T. Gunn (gunn@esr...
    company:        Earth & Space Research, Seattle, WA
    reference:      Bonjean F. and G.S.E. Lagerloef, 2002 ,Diagnostic model a...
    note1:          Maximum Mask velocity is the geostrophic component at all...
    note2:          Longitude extends from 20 E to 420 E to avoid a break in ...
xarray.Dataset
    • time: 72
    • year: 72
    • depth: 1
    • latitude: 481
    • time
      (time)
      datetime64[ns]
      2022-01-01 ... 2022-12-26
      long_name :
      Day since 1992-10-05 00:00:00
      array(['2022-01-01T00:00:00.000000000', '2022-01-06T00:00:00.000000000',
             '2022-01-11T00:00:00.000000000', '2022-01-16T00:00:00.000000000',
             '2022-01-21T00:00:00.000000000', '2022-01-26T00:00:00.000000000',
             '2022-01-31T00:00:00.000000000', '2022-02-05T00:00:00.000000000',
             '2022-02-10T00:00:00.000000000', '2022-02-15T00:00:00.000000000',
             '2022-02-20T00:00:00.000000000', '2022-02-25T00:00:00.000000000',
             '2022-03-02T00:00:00.000000000', '2022-03-07T00:00:00.000000000',
             '2022-03-12T00:00:00.000000000', '2022-03-18T00:00:00.000000000',
             '2022-03-23T00:00:00.000000000', '2022-03-28T00:00:00.000000000',
             '2022-04-02T00:00:00.000000000', '2022-04-07T00:00:00.000000000',
             '2022-04-12T00:00:00.000000000', '2022-04-17T00:00:00.000000000',
             '2022-04-22T00:00:00.000000000', '2022-04-27T00:00:00.000000000',
             '2022-05-02T00:00:00.000000000', '2022-05-07T00:00:00.000000000',
             '2022-05-12T00:00:00.000000000', '2022-05-17T00:00:00.000000000',
             '2022-05-22T00:00:00.000000000', '2022-05-28T00:00:00.000000000',
             '2022-06-02T00:00:00.000000000', '2022-06-07T00:00:00.000000000',
             '2022-06-12T00:00:00.000000000', '2022-06-17T00:00:00.000000000',
             '2022-06-22T00:00:00.000000000', '2022-06-27T00:00:00.000000000',
             '2022-07-02T00:00:00.000000000', '2022-07-07T00:00:00.000000000',
             '2022-07-12T00:00:00.000000000', '2022-07-17T00:00:00.000000000',
             '2022-07-22T00:00:00.000000000', '2022-07-27T00:00:00.000000000',
             '2022-08-01T00:00:00.000000000', '2022-08-06T00:00:00.000000000',
             '2022-08-12T00:00:00.000000000', '2022-08-17T00:00:00.000000000',
             '2022-08-22T00:00:00.000000000', '2022-08-27T00:00:00.000000000',
             '2022-09-01T00:00:00.000000000', '2022-09-06T00:00:00.000000000',
             '2022-09-11T00:00:00.000000000', '2022-09-16T00:00:00.000000000',
             '2022-09-21T00:00:00.000000000', '2022-09-26T00:00:00.000000000',
             '2022-10-01T00:00:00.000000000', '2022-10-06T00:00:00.000000000',
             '2022-10-11T00:00:00.000000000', '2022-10-16T00:00:00.000000000',
             '2022-10-22T00:00:00.000000000', '2022-10-27T00:00:00.000000000',
             '2022-11-01T00:00:00.000000000', '2022-11-06T00:00:00.000000000',
             '2022-11-11T00:00:00.000000000', '2022-11-16T00:00:00.000000000',
             '2022-11-21T00:00:00.000000000', '2022-11-26T00:00:00.000000000',
             '2022-12-01T00:00:00.000000000', '2022-12-06T00:00:00.000000000',
             '2022-12-11T00:00:00.000000000', '2022-12-16T00:00:00.000000000',
             '2022-12-21T00:00:00.000000000', '2022-12-26T00:00:00.000000000'],
            dtype='datetime64[ns]')
    • year
      (year)
      float32
      2.022e+03 2.022e+03 ... 2.023e+03
      units :
      time in years
      long_name :
      Time in fractional year
      array([2022.    , 2022.0139, 2022.0278, 2022.0416, 2022.0555, 2022.0695,
             2022.0834, 2022.0972, 2022.1111, 2022.125 , 2022.1389, 2022.1528,
             2022.1666, 2022.1805, 2022.1945, 2022.2084, 2022.2222, 2022.2361,
             2022.25  , 2022.2639, 2022.2778, 2022.2916, 2022.3055, 2022.3195,
             2022.3334, 2022.3472, 2022.3611, 2022.375 , 2022.3889, 2022.4028,
             2022.4166, 2022.4305, 2022.4445, 2022.4584, 2022.4722, 2022.4861,
             2022.5   , 2022.5139, 2022.5278, 2022.5416, 2022.5555, 2022.5695,
             2022.5834, 2022.5972, 2022.6111, 2022.625 , 2022.6389, 2022.6528,
             2022.6666, 2022.6805, 2022.6945, 2022.7084, 2022.7222, 2022.7361,
             2022.75  , 2022.7639, 2022.7778, 2022.7916, 2022.8055, 2022.8195,
             2022.8334, 2022.8472, 2022.8611, 2022.875 , 2022.8889, 2022.9028,
             2022.9166, 2022.9305, 2022.9445, 2022.9584, 2022.9722, 2022.9861],
            dtype=float32)
    • depth
      (depth)
      float32
      15.0
      units :
      meter
      long_name :
      Depth
      array([15.], dtype=float32)
    • latitude
      (latitude)
      float64
      80.0 79.67 79.33 ... -79.67 -80.0
      units :
      degrees-north
      long_name :
      Latitude
      array([ 80.      ,  79.666667,  79.333333, ..., -79.333333, -79.666667,
             -80.      ])
    • longitude
      ()
      float64
      240.3
      units :
      degrees-east
      long_name :
      Longitude
      array(240.33333333)
    • u
      (time, depth, latitude)
      float64
      dask.array<chunksize=(72, 1, 481), meta=np.ndarray>
      units :
      meter/sec
      long_name :
      Ocean Surface Zonal Currents
      Array Chunk
      Bytes 270.56 kiB 270.56 kiB
      Shape (72, 1, 481) (72, 1, 481)
      Dask graph 1 chunks in 3 graph layers
      Data type float64 numpy.ndarray
      481 1 72
    • v
      (time, depth, latitude)
      float64
      dask.array<chunksize=(72, 1, 481), meta=np.ndarray>
      units :
      meter/sec
      long_name :
      Ocean Surface Meridional Currents
      Array Chunk
      Bytes 270.56 kiB 270.56 kiB
      Shape (72, 1, 481) (72, 1, 481)
      Dask graph 1 chunks in 3 graph layers
      Data type float64 numpy.ndarray
      481 1 72
    • um
      (time, depth, latitude)
      float64
      dask.array<chunksize=(72, 1, 481), meta=np.ndarray>
      units :
      meter/sec
      long_name :
      Ocean Surface Zonal Currents Maximum Mask
      Array Chunk
      Bytes 270.56 kiB 270.56 kiB
      Shape (72, 1, 481) (72, 1, 481)
      Dask graph 1 chunks in 3 graph layers
      Data type float64 numpy.ndarray
      481 1 72
    • vm
      (time, depth, latitude)
      float64
      dask.array<chunksize=(72, 1, 481), meta=np.ndarray>
      units :
      meter/sec
      long_name :
      Ocean Surface Meridional Currents Maximum Mask
      Array Chunk
      Bytes 270.56 kiB 270.56 kiB
      Shape (72, 1, 481) (72, 1, 481)
      Dask graph 1 chunks in 3 graph layers
      Data type float64 numpy.ndarray
      481 1 72
    • time
      PandasIndex
      PandasIndex(DatetimeIndex(['2022-01-01', '2022-01-06', '2022-01-11', '2022-01-16',
                     '2022-01-21', '2022-01-26', '2022-01-31', '2022-02-05',
                     '2022-02-10', '2022-02-15', '2022-02-20', '2022-02-25',
                     '2022-03-02', '2022-03-07', '2022-03-12', '2022-03-18',
                     '2022-03-23', '2022-03-28', '2022-04-02', '2022-04-07',
                     '2022-04-12', '2022-04-17', '2022-04-22', '2022-04-27',
                     '2022-05-02', '2022-05-07', '2022-05-12', '2022-05-17',
                     '2022-05-22', '2022-05-28', '2022-06-02', '2022-06-07',
                     '2022-06-12', '2022-06-17', '2022-06-22', '2022-06-27',
                     '2022-07-02', '2022-07-07', '2022-07-12', '2022-07-17',
                     '2022-07-22', '2022-07-27', '2022-08-01', '2022-08-06',
                     '2022-08-12', '2022-08-17', '2022-08-22', '2022-08-27',
                     '2022-09-01', '2022-09-06', '2022-09-11', '2022-09-16',
                     '2022-09-21', '2022-09-26', '2022-10-01', '2022-10-06',
                     '2022-10-11', '2022-10-16', '2022-10-22', '2022-10-27',
                     '2022-11-01', '2022-11-06', '2022-11-11', '2022-11-16',
                     '2022-11-21', '2022-11-26', '2022-12-01', '2022-12-06',
                     '2022-12-11', '2022-12-16', '2022-12-21', '2022-12-26'],
                    dtype='datetime64[ns]', name='time', freq=None))
    • year
      PandasIndex
      PandasIndex(Index([            2022.0,  2022.013916015625,   2022.02783203125,
             2022.0416259765625, 2022.0555419921875, 2022.0694580078125,
             2022.0833740234375,   2022.09716796875,  2022.111083984375,
                       2022.125,  2022.138916015625,   2022.15283203125,
             2022.1666259765625, 2022.1805419921875, 2022.1944580078125,
             2022.2083740234375,   2022.22216796875,  2022.236083984375,
                        2022.25,  2022.263916015625,   2022.27783203125,
             2022.2916259765625, 2022.3055419921875, 2022.3194580078125,
             2022.3333740234375,   2022.34716796875,  2022.361083984375,
                       2022.375,  2022.388916015625,   2022.40283203125,
             2022.4166259765625, 2022.4305419921875, 2022.4444580078125,
             2022.4583740234375,   2022.47216796875,  2022.486083984375,
                         2022.5,  2022.513916015625,   2022.52783203125,
             2022.5416259765625, 2022.5555419921875, 2022.5694580078125,
             2022.5833740234375,   2022.59716796875,  2022.611083984375,
                       2022.625,  2022.638916015625,   2022.65283203125,
             2022.6666259765625, 2022.6805419921875, 2022.6944580078125,
             2022.7083740234375,   2022.72216796875,  2022.736083984375,
                        2022.75,  2022.763916015625,   2022.77783203125,
             2022.7916259765625, 2022.8055419921875, 2022.8194580078125,
             2022.8333740234375,   2022.84716796875,  2022.861083984375,
                       2022.875,  2022.888916015625,   2022.90283203125,
             2022.9166259765625, 2022.9305419921875, 2022.9444580078125,
             2022.9583740234375,   2022.97216796875,  2022.986083984375],
            dtype='float32', name='year'))
    • depth
      PandasIndex
      PandasIndex(Index([15.0], dtype='float32', name='depth'))
    • latitude
      PandasIndex
      PandasIndex(Index([              80.0,  79.66666666666667,  79.33333333333333,
                           79.0,  78.66666666666667,  78.33333333333333,
                           78.0,  77.66666666666667,  77.33333333333333,
                           77.0,
             ...
                          -77.0, -77.33333333333333, -77.66666666666667,
                          -78.0, -78.33333333333333, -78.66666666666667,
                          -79.0, -79.33333333333333, -79.66666666666667,
                          -80.0],
            dtype='float64', name='latitude', length=481))
  • VARIABLE :
    Ocean Surface Currents
    DATATYPE :
    1/72 YEAR Interval
    DATASUBTYPE :
    unfiltered
    GEORANGE :
    20 to 420 -80 to 80
    PERIOD :
    Jan.01,2022 to Dec.26,2022
    year :
    2022
    description :
    OSCAR Third Degree Sea Surface Velocity
    CREATION_DATE :
    02:21 06-Feb-2023
    version :
    2009.0
    source :
    Gary Lagerloef, ESR ([email protected]) and Kathleen Dohan, ESR ([email protected])
    contact :
    Kathleen Dohan ([email protected]) or John T. Gunn ([email protected])
    company :
    Earth & Space Research, Seattle, WA
    reference :
    Bonjean F. and G.S.E. Lagerloef, 2002 ,Diagnostic model and analysis of the surface currents in the tropical Pacific ocean, J. Phys. Oceanogr., 32, 2,938-2,954
    note1 :
    Maximum Mask velocity is the geostrophic component at all points + any concurrent Ekman and buoyancy components
    note2 :
    Longitude extends from 20 E to 420 E to avoid a break in major ocean basins. Data repeats in overlap region.
In [4]:
import numpy as np
import cartopy.crs as ccrs
import matplotlib.pyplot as plt

plt.figure(figsize=(18, 9))

ax = plt.axes(projection=ccrs.PlateCarree())  # Plate Carrée projection

dec = 2

lon = ds.longitude.values[::dec]

lon[lon > 180] = lon[lon > 180] - 360

mymap = plt.streamplot(
    lon,
    ds.latitude.values[::dec],
    ds.u.values[0, 0, ::dec, ::dec],
    ds.v.values[0, 0, ::dec, ::dec],
    8,
    transform=ccrs.PlateCarree()
)

ax.coastlines()

# Adjust the longitude range for the entire world map
ax.set_extent([20, 420, -80, 80], crs=ccrs.PlateCarree())

plt.title('Sea surface currents derived from oscar_vel2022.nc')

plt.savefig("oscar_vel2022.png", dpi=150)

plt.show()
In [5]:
import numpy as np
import cartopy.crs as ccrs
import matplotlib.pyplot as plt

plt.figure(figsize=(18, 9))

ax = plt.axes(projection=ccrs.PlateCarree())  # Plate Carrée projection

scale = 1.5  # Adjust the scaling factor

dec = int(np.sqrt(scale))
density = int(np.sqrt(scale) * 5)  # Adjust the density of streamlines based on the scaling factor

lon = ds.longitude.values[::dec]
lon[lon > 180] = lon[lon > 180] - 360

mymap = plt.streamplot(
    lon,
    ds.latitude.values[::dec],
    ds.u.values[0, 0, ::dec, ::dec],
    ds.v.values[0, 0, ::dec, ::dec],
    density=density,  # Use named parameter
    transform=ccrs.PlateCarree()
)

ax.coastlines()

# Adjust the longitude range for the entire world map
ax.set_extent([20, 420, -80, 80], crs=ccrs.PlateCarree())

plt.title('Sea surface currents derived from oscar_vel2022.nc')

plt.savefig("oscar_vel2022_01.png", dpi=150)

plt.show()
In [6]:
import numpy as np
import cartopy.crs as ccrs
import matplotlib.pyplot as plt

plt.figure(figsize=(18, 9))

ax = plt.axes(projection=ccrs.PlateCarree())  # Plate Carrée projection

scale = 2  # Adjust the scaling factor

dec = int(np.sqrt(scale))
density = int(np.sqrt(scale) * 5)  # Adjust the density of streamlines based on the scaling factor

lon = ds.longitude.values[::dec]
lon[lon > 180] = lon[lon > 180] - 360

mymap = plt.streamplot(
    lon,
    ds.latitude.values[::dec],
    ds.u.values[0, 0, ::dec, ::dec],
    ds.v.values[0, 0, ::dec, ::dec],
    density=density,  # Use named parameter
    transform=ccrs.PlateCarree()
)

ax.coastlines()

# Adjust the longitude range for the entire world map
ax.set_extent([20, 420, -80, 80], crs=ccrs.PlateCarree())

plt.title('Sea surface currents derived from oscar_vel2022.nc')

plt.savefig("oscar_vel2022_01.png", dpi=150)

plt.show()
In [11]:
import numpy as np
import cartopy.crs as ccrs
import matplotlib.pyplot as plt

plt.figure(figsize=(18, 9))

ax = plt.axes(projection=ccrs.PlateCarree())  # Plate Carrée projection

scale = 10.0  # Adjust the scaling factor

density = int(np.log10(scale) * 20)  # Adjust the density of streamlines based on the logarithmic scaling

dec = int(np.sqrt(scale / density))

lon = ds.longitude.values[::max(dec, 1)]  # Ensure dec is at least 1
lon[lon > 180] = lon[lon > 180] - 360

mymap = plt.streamplot(
    lon,
    ds.latitude.values[::max(dec, 1)],  # Ensure dec is at least 1
    ds.u.values[0, 0, ::max(dec, 1), ::max(dec, 1)],  # Ensure dec is at least 1
    ds.v.values[0, 0, ::max(dec, 1), ::max(dec, 1)],  # Ensure dec is at least 1
    density=density,  # Use named parameter
    transform=ccrs.PlateCarree()
)

ax.coastlines()

# Adjust the longitude range for the entire world map
ax.set_extent([20, 420, -80, 80], crs=ccrs.PlateCarree())

plt.title('Sea surface currents derived from oscar_vel2022.nc')

plt.savefig("oscar_vel2022_02.png", dpi=150)

plt.show()
In [12]:
import numpy as np
import cartopy.crs as ccrs
import matplotlib.pyplot as plt

plt.figure(figsize=(18, 9))

ax = plt.axes(projection=ccrs.PlateCarree())  # Plate Carrée projection

scale = 5.0  # Adjust the scaling factor

density = int(np.log10(scale) * 20)  # Adjust the density of streamlines based on the logarithmic scaling

dec = int(np.sqrt(scale / density))

lon = ds.longitude.values[::max(dec, 1)]  # Ensure dec is at least 1
lon[lon > 180] = lon[lon > 180] - 360

mymap = plt.streamplot(
    lon,
    ds.latitude.values[::max(dec, 1)],  # Ensure dec is at least 1
    ds.u.values[0, 0, ::max(dec, 1), ::max(dec, 1)],  # Ensure dec is at least 1
    ds.v.values[0, 0, ::max(dec, 1), ::max(dec, 1)],  # Ensure dec is at least 1
    density=density,  # Use named parameter
    transform=ccrs.PlateCarree()
)

ax.coastlines()

# Adjust the longitude range for the entire world map
ax.set_extent([20, 420, -80, 80], crs=ccrs.PlateCarree())

plt.title('Sea surface currents derived from oscar_vel2022.nc')

plt.savefig("oscar_vel2022_03.png", dpi=150)

plt.show()
In [13]:
import numpy as np
import cartopy.crs as ccrs
import matplotlib.pyplot as plt

plt.figure(figsize=(18, 9))

ax = plt.axes(projection=ccrs.PlateCarree())  # Plate Carrée projection

scale = 2  # Adjust the scaling factor

density = int(np.log10(scale) * 20)  # Adjust the density of streamlines based on the logarithmic scaling

dec = int(np.sqrt(scale / density))

lon = ds.longitude.values[::max(dec, 1)]  # Ensure dec is at least 1
lon[lon > 180] = lon[lon > 180] - 360

mymap = plt.streamplot(
    lon,
    ds.latitude.values[::max(dec, 1)],  # Ensure dec is at least 1
    ds.u.values[0, 0, ::max(dec, 1), ::max(dec, 1)],  # Ensure dec is at least 1
    ds.v.values[0, 0, ::max(dec, 1), ::max(dec, 1)],  # Ensure dec is at least 1
    density=density,  # Use named parameter
    transform=ccrs.PlateCarree()
)

ax.coastlines()

# Adjust the longitude range for the entire world map
ax.set_extent([20, 420, -80, 80], crs=ccrs.PlateCarree())

plt.title('Sea surface currents derived from oscar_vel2022.nc')

plt.savefig("oscar_vel2022_04.png", dpi=150)

plt.show()
In [14]:
import numpy as np
import cartopy.crs as ccrs
import matplotlib.pyplot as plt

plt.figure(figsize=(18, 9))

ax = plt.axes(projection=ccrs.PlateCarree())  # Plate Carrée projection

scale = 1.5  # Adjust the scaling factor

density = int(np.log10(scale) * 20)  # Adjust the density of streamlines based on the logarithmic scaling

dec = int(np.sqrt(scale / density))

lon = ds.longitude.values[::max(dec, 1)]  # Ensure dec is at least 1
lon[lon > 180] = lon[lon > 180] - 360

mymap = plt.streamplot(
    lon,
    ds.latitude.values[::max(dec, 1)],  # Ensure dec is at least 1
    ds.u.values[0, 0, ::max(dec, 1), ::max(dec, 1)],  # Ensure dec is at least 1
    ds.v.values[0, 0, ::max(dec, 1), ::max(dec, 1)],  # Ensure dec is at least 1
    density=density,  # Use named parameter
    transform=ccrs.PlateCarree()
)

ax.coastlines()

# Adjust the longitude range for the entire world map
ax.set_extent([20, 420, -80, 80], crs=ccrs.PlateCarree())

plt.title('Sea surface currents derived from oscar_vel2022.nc')

plt.savefig("oscar_vel2022_05.png", dpi=150)

plt.show()
In [15]:
import numpy as np
import cartopy.crs as ccrs
import matplotlib.pyplot as plt

plt.figure(figsize=(18, 9))

ax = plt.axes(projection=ccrs.PlateCarree())  # Plate Carrée projection

scale = 1.7  # Adjust the scaling factor

density = int(np.log10(scale) * 20)  # Adjust the density of streamlines based on the logarithmic scaling

dec = int(np.sqrt(scale / density))

lon = ds.longitude.values[::max(dec, 1)]  # Ensure dec is at least 1
lon[lon > 180] = lon[lon > 180] - 360

mymap = plt.streamplot(
    lon,
    ds.latitude.values[::max(dec, 1)],  # Ensure dec is at least 1
    ds.u.values[0, 0, ::max(dec, 1), ::max(dec, 1)],  # Ensure dec is at least 1
    ds.v.values[0, 0, ::max(dec, 1), ::max(dec, 1)],  # Ensure dec is at least 1
    density=density,  # Use named parameter
    transform=ccrs.PlateCarree()
)

ax.coastlines()

# Adjust the longitude range for the entire world map
ax.set_extent([20, 420, -80, 80], crs=ccrs.PlateCarree())

plt.title('Sea surface currents derived from oscar_vel2022.nc')

plt.savefig("oscar_vel2022_06.png", dpi=150)

plt.show()
In [16]:
import numpy as np
import cartopy.crs as ccrs
import matplotlib.pyplot as plt

plt.figure(figsize=(18, 9))

ax = plt.axes(projection=ccrs.PlateCarree())  # Plate Carrée projection

scale = 1.8  # Adjust the scaling factor

density = int(np.log10(scale) * 20)  # Adjust the density of streamlines based on the logarithmic scaling

dec = int(np.sqrt(scale / density))

lon = ds.longitude.values[::max(dec, 1)]  # Ensure dec is at least 1
lon[lon > 180] = lon[lon > 180] - 360

mymap = plt.streamplot(
    lon,
    ds.latitude.values[::max(dec, 1)],  # Ensure dec is at least 1
    ds.u.values[0, 0, ::max(dec, 1), ::max(dec, 1)],  # Ensure dec is at least 1
    ds.v.values[0, 0, ::max(dec, 1), ::max(dec, 1)],  # Ensure dec is at least 1
    density=density,  # Use named parameter
    transform=ccrs.PlateCarree()
)

ax.coastlines()

# Adjust the longitude range for the entire world map
ax.set_extent([20, 420, -80, 80], crs=ccrs.PlateCarree())

plt.title('Sea surface currents derived from oscar_vel2022.nc')

plt.savefig("oscar_vel2022_06.png", dpi=150)

plt.show()