File: test_python_1D_var.py

package info (click to toggle)
cmor 3.13.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 16,960 kB
  • sloc: ansic: 28,094; f90: 13,872; python: 12,423; sh: 3,738; makefile: 111
file content (20 lines) | stat: -rw-r--r-- 539 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import cmor

error_flag = cmor.setup(inpath='Tables', netcdf_file_action=cmor.CMOR_REPLACE)

error_flag = cmor.dataset_json("Test/CMOR_input_example.json")

cmor.load_table("CMIP6_Omon.json")
itim = cmor.axis(
    table_entry='time',
    units='months since 2010-1-1',
    coord_vals=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
    cell_bounds=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])

ivar = cmor.variable('thetaoga', units='deg_C', axis_ids=[itim, ])

data = [280., ] * 12  # 12 months worth of data

cmor.write(ivar, data)

cmor.close()