climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject [1/2] climate git commit: CLIMATE-553 - Add ESGF data source example
Date Thu, 13 Nov 2014 19:05:11 GMT
Repository: climate
Updated Branches:
  refs/heads/master 0b74c82d9 -> a8d84b19e


CLIMATE-553 - Add ESGF data source example


Project: http://git-wip-us.apache.org/repos/asf/climate/repo
Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/8893731e
Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/8893731e
Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/8893731e

Branch: refs/heads/master
Commit: 8893731eebb813839755747f33e07e433868fefd
Parents: 0b74c82
Author: Michael Joyce <joyce@apache.org>
Authored: Wed Nov 12 08:08:42 2014 -0800
Committer: Michael Joyce <joyce@apache.org>
Committed: Wed Nov 12 08:08:42 2014 -0800

----------------------------------------------------------------------
 examples/esgf_integration_examply.py | 40 +++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/8893731e/examples/esgf_integration_examply.py
----------------------------------------------------------------------
diff --git a/examples/esgf_integration_examply.py b/examples/esgf_integration_examply.py
new file mode 100644
index 0000000..cf0725d
--- /dev/null
+++ b/examples/esgf_integration_examply.py
@@ -0,0 +1,40 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import ocw.data_source.esgf as esgf
+
+dataset_id = 'obs4MIPs.CNES.AVISO.mon.v1|esg-datanode.jpl.nasa.gov'
+variable = 'zosStderr'
+
+username = raw_input('Enter your ESGF Username:\n')
+password = raw_input('Enter your ESGF Password:\n')
+
+# Multiple datasets are returned in a list if the ESGF dataset is
+# divided into multiple files.
+datasets = esgf.load_dataset(dataset_id,
+                             variable,
+                             username,
+                             password)
+
+# For this example, our dataset is only stored in a single file so
+# we only need to look at the 0-th value in the returned list.
+ds = datasets[0]
+
+print '\n--------\n'
+print 'Variable: ', ds.variable
+print 'Shape: ', ds.values.shape
+print 'A Value: ', ds.values[100][100][100]


Mime
View raw message