The XGCM Family of Python Packages

The XGCM Family of Python Packages

Lightning talk for the 2019 Pangeo Community Meeting

http://pangeo.io/meetings/2019_summer-meeting.html

654d48d6c1c10c50c160954ba31207a2?s=128

Ryan Abernathey

August 22, 2019
Tweet

Transcript

  1. T h e X G C M F a m

    i l y o f P y t h o n P a c k a g e s xgcm xrft xhistogram GCM
  2. • Consume and produce xarray data structures (never “leave” xarray)

    • Operate eagerly on NumPy inputs and lazily on Dask inputs • Follow existing metadata standards.
 (Be as flexible as possible about variable or dimension names) • Keep it as simple as possible! Solve one problem well
 —> lots of small packages !2 D e s i g n P r i n c i p l e s
  3. X G C M : F i n i t

    e V o l u m e C a l c u l u s !3 7/9/2019 grid2d_hv.svg C-grid — horizontal view C-grid — vertical view t u w w u w u w u u w u w X Z Y t u v v f f u f f X Y Z Fundamental Operations Interoperation Difference x = 1 2 ( i +1 / 2 + i 1 / 2 ) x = i +1 / 2 i 1 / 2 These move us from one grid position to another. Example Derived Quantities ⇣ = @u @y + @v @x ⇣ = ( y xcu + x ycv ) /A⇣ Vorticity https://xgcm.readthedocs.io/
  4. X G C M G r i d !4 A

    Grid is the primary user interaction point with xgcm.
 Very small API. zeta = (- grid.diff(ds.UVEL * ds.dxC, 'Y') + grid.diff(ds.VVEL * ds.dyC, 'X'))/ds.rAz
  5. • Applies FFT-type operations to xarray objects
 DFT, power_spectrum, cross_spectrum

    • Automatically generates spectral coordinates in output • Dispatches numpy.fft or dask.fft appropriately • Utility functions (e.g. detrending) X R F T: N D - S p e c t r a l A n a ly s i s !5 https://xrft.readthedocs.io/
  6. !6 X h i s t o g r a

    m https://xhistogram.readthedocs.io • Calculate complex histograms with multi-dimensional data • Operate over selected axes of arrays • Generate histogram labels for xarray datasets • Uses dask intelligently