-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiris_Chapter9.py
47 lines (24 loc) · 916 Bytes
/
iris_Chapter9.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python3
""" 9. Merge and Concatenate
Examples from http://scitools.org.uk/iris/docs/latest/userguide """
# 9.1 Merge
# 9.1.1. Using CubeList.merge
# 9.2 Concatenate
import iris
from iris.util import unify_time_units
import numpy as np
fname = '/media/oem/Elements/nc_files/NCEP_data/wind_200hPa/uwnd/uwnd.1979.nc'
u79 = iris.load_cube(fname)
fname = '/media/oem/Elements/nc_files/NCEP_data/wind_200hPa/uwnd/uwnd.1980.nc'
u80 = iris.load_cube(fname)
fname = '/media/oem/Elements/nc_files/NCEP_data/wind_200hPa/uwnd/uwnd.1981.nc'
u81 = iris.load_cube(fname)
cubes = iris.cube.CubeList([u79, u81])
print(cubes[0].coord('time').units)
print(cubes[1].coord('time').units)
print(cubes[0].coord('time').dtype)
print(cubes[1].coord('time').dtype)
print(cubes[0].coord('time'))
print(repr(cubes[1].coord('time')))
iris.util.unify_time_units(cubes)
new_cube = cubes.concatenate_cube()