项目作者: mathause

项目描述 :
list CESM history files
高级语言: Python
项目地址: git://github.com/mathause/cesm.git
创建时间: 2016-07-18T16:47:44Z
项目社区:https://github.com/mathause/cesm

开源协议:MIT License

下载


cesm - list simulation files and retrieve data

Usage

Define one or more simulations in ~/cesm_cases.yaml:

  1. SMX2000:
  2. folder: /net/exo/landclim/mathause/cesm_data/
  3. name: f.e121.FC5.f19_g16.SMM2010_2000-io384.001

List / select files:

  1. import cesm
  2. case = cesm.case('SMX2000')
  3. print(case.lnd.h0.filename)
  4. print(case.lnd.h1.sel(year=50))

Output

  1. ['f.e121.FC5.f19_g16.SMM2010_2000-io384.001.clm2.h0.0001-01.nc',
  2. 'f.e121.FC5.f19_g16.SMM2010_2000-io384.001.clm2.h0.0001-02.nc',
  3. 'f.e121.FC5.f19_g16.SMM2010_2000-io384.001.clm2.h0.0001-03.nc'
  4. ...]
  5. '/net/.../f.e121.FC5.f19_g16.SMM2010_2000-io384.001.clm2.h1.0050-01-01-00000.nc'

Load data:

  1. TREFHT = cesm.load.var(case.atm.h0, 'TREFHT', year=50)
  2. print(TREFHT)

Output

  1. 1 years require saving
  2. writing variable: 50 in 50..50
  3. <xarray.Dataset>
  4. Dimensions: (lat: 96, lon: 144, time: 12)
  5. Coordinates:
  6. * lat (lat) float64 -90.0 -88.11 -86.21 -84.32 -82.42 -80.53 -78.63 ...
  7. * lon (lon) float64 0.0 2.5 5.0 7.5 10.0 12.5 15.0 17.5 20.0 22.5 ...
  8. * time (time) datetime64[ns] 2000-01-16T12:00:00 2000-02-15 ...
  9. Data variables:
  10. TREFHT (time, lat, lon) float32 242.634 243.037 242.642 242.609 ...

Note

With version 0.2.0 I disentangled this package with the changes I added on top of xarray (which was a very bad idea) by adding the xarray_utils. It should now work with the original version of xarray (but this is currenly untested).