climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lewi...@apache.org
Subject [3/3] climate git commit: Merge branch 'master' into CLIMATE-891
Date Thu, 22 Mar 2018 21:16:45 GMT
Merge branch 'master' into CLIMATE-891

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

Branch: refs/heads/master
Commit: f8b8c9042e9a72de6b01129d932caed68d7be215
Parents: 539bb8b 8e1edc8
Author: MichaelArthurAnderson <michael.arthur.anderson@gmail.com>
Authored: Sat Mar 17 08:04:13 2018 -0400
Committer: GitHub <noreply@github.com>
Committed: Sat Mar 17 08:04:13 2018 -0400

----------------------------------------------------------------------
 examples/esgf_integration_example.py | 62 +++++++++++---------
 ocw/data_source/esgf.py              | 66 ++++++++++-----------
 ocw/dataset_processor.py             | 43 ++++++++++----
 ocw/esgf/constants.py                |  2 +-
 ocw/esgf/download.py                 | 53 ++++++++++-------
 ocw/esgf/logon.py                    | 16 +++---
 ocw/esgf/main.py                     | 96 ++++++++++++++++---------------
 ocw/esgf/search.py                   | 22 ++++---
 8 files changed, 203 insertions(+), 157 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/f8b8c904/examples/esgf_integration_example.py
----------------------------------------------------------------------
diff --cc examples/esgf_integration_example.py
index 3964454,e541273..162986b
--- a/examples/esgf_integration_example.py
+++ b/examples/esgf_integration_example.py
@@@ -37,31 -38,38 +37,37 @@@ from getpass import getpas
  
  import ocw.data_source.esgf as esgf
  
- if hasattr(ssl, '_create_unverified_context'):
-     ssl._create_default_https_context = ssl._create_unverified_context
- 
- dataset_id = 'obs4mips.CNES.AVISO.zos.mon.v20110829|esgf-data.jpl.nasa.gov'
- variable = 'zosStderr'
- 
- if sys.version_info[0] >= 3:
-     username = input('Enter your ESGF OpenID:\n')
- else:
-     username = raw_input('Enter your ESGF OpenID:\n')
- 
- password = getpass(prompt='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])
+ def main():
+     """
+     An example of using the OCW ESGF library.  Connects to an ESGF
+     server and downloads a dataset.
+     """
+     if hasattr(ssl, '_create_unverified_context'):
+         ssl._create_default_https_context = ssl._create_unverified_context
+ 
+     dataset_id = 'obs4mips.CNES.AVISO.zos.mon.v20110829|esgf-data.jpl.nasa.gov'
+     variable = 'zosStderr'
+ 
+     if sys.version_info[0] >= 3:
+         username = input('Enter your ESGF OpenID:\n')
+     else:
+         username = raw_input('Enter your ESGF OpenID:\n')
+ 
+     password = getpass(prompt='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.
+     dataset = datasets[0]
+ 
+     print('\n--------\n')
+     print('Variable: ', dataset.variable)
+     print('Shape: ', dataset.values.shape)
+     print('A Value: ', dataset.values[100][100][100])
+ 
+ 
+ if __name__ == '__main__':
+     main()


Mime
View raw message