[cmor] 67/190: adding Jamie's example
Alastair McKinstry
mckinstry at moszumanska.debian.org
Tue Jul 21 12:54:38 UTC 2015
This is an automated email from the git hooks/post-receive script.
mckinstry pushed a commit to branch debian/master
in repository cmor.
commit 88401aa007bc27779aec133f86491134e7857b0e
Author: Charles Doutriaux <doutriaux1 at llnl.gov>
Date: Fri Nov 5 11:33:06 2010 -0700
adding Jamie's example
---
Test/test_python_jamie_site_surface.py | 60 ++++++++++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
diff --git a/Test/test_python_jamie_site_surface.py b/Test/test_python_jamie_site_surface.py
new file mode 100644
index 0000000..6e7cb60
--- /dev/null
+++ b/Test/test_python_jamie_site_surface.py
@@ -0,0 +1,60 @@
+import cmor
+import numpy
+
+def cmor_initialisation():
+ cmor.setup(inpath='/data/local/hadju/test/mip_tables',
+ netcdf_file_action = cmor.CMOR_REPLACE_3,
+ create_subdirectories = 0)
+ cmor.dataset('pre-industrial control', 'ukmo', 'HadCM3', '360_day',
+ institute_id = 'ukmo',
+ model_id = 'HadCM3',
+ history = 'some global history',
+ forcing = 'N/A',
+ parent_experiment_id = 'N/A',
+ parent_experiment_rip = 'N/A',
+ branch_time = 0.,
+ contact = 'bob',
+ outpath = '/data/local/hadju/test')
+
+def setup_data():
+ axes = [ {'table_entry': 'time1',
+ 'units': 'days since 2000-01-01 00:00:00',
+ },
+ {'table_entry': 'site',
+ 'units': '',
+ 'coord_vals': [0]},
+ ]
+
+ values = numpy.array([215.], numpy.float32)
+ return values, axes
+
+def cmor_define_and_write(values, axes):
+ table = 'CMIP5_cfSites'
+ cmor.load_table(table)
+
+ axis_ids = list()
+ for axis in axes:
+ axis_id = cmor.axis(**axis)
+ axis_ids.append(axis_id)
+
+ varid = cmor.variable('rlut',
+ 'W m-2',
+ axis_ids,
+ history = 'variable history',
+ missing_value = -99,
+ positive = 'up'
+ )
+
+ cmor.write(varid, values, time_vals = [15])
+
+
+def main():
+
+ cmor_initialisation()
+ values, axes = setup_data()
+ cmor_define_and_write(values, axes)
+ cmor.close()
+
+if __name__ == '__main__':
+
+ main()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/cmor.git
More information about the debian-science-commits
mailing list