Repository: climate Updated Branches: refs/heads/master 07956fa96 -> d85484018
CLIMATE-783 Update ESGF examples - change name of esgf_integration_examply.py to esgf_integration_example.py - remove visability of ESGF password on esgf_integration_example.py - change username prompt to ask for OpenID - add configuration file for local ESGF example in RCMES Project: http://git-wip-us.apache.org/repos/asf/climate/repo Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/456e1b57 Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/456e1b57 Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/456e1b57 Branch: refs/heads/master Commit: 456e1b575f5a12afd03d44870cac64f2e359633a Parents: 45357f7 Author: Nash <[email protected]> Authored: Wed Apr 20 15:05:04 2016 -0700 Committer: Nash <[email protected]> Committed: Wed Apr 20 15:05:04 2016 -0700 ---------------------------------------------------------------------- .../ESGF_example/ESGF-Example_local.yaml | 62 ++++++++++++++++++++ examples/esgf_integration_example.py | 41 +++++++++++++ examples/esgf_integration_examply.py | 41 ------------- 3 files changed, 103 insertions(+), 41 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/climate/blob/456e1b57/RCMES/configuration_files/ESGF_example/ESGF-Example_local.yaml ---------------------------------------------------------------------- diff --git a/RCMES/configuration_files/ESGF_example/ESGF-Example_local.yaml b/RCMES/configuration_files/ESGF_example/ESGF-Example_local.yaml new file mode 100644 index 0000000..4be62ec --- /dev/null +++ b/RCMES/configuration_files/ESGF_example/ESGF-Example_local.yaml @@ -0,0 +1,62 @@ +# 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. + +workdir: ./results/ESGF_example +output_netcdf_filename: zos_annual_mean_local.nc + +# (RCMES will temporally subset data between month_start and month_end. If average_each_year is True (False), seasonal mean in each year is (not) calculated and used for metrics calculation.) +time: + maximum_overlap_period: False + start_time: 1995-01-01 + end_time: 2004-12-31 + temporal_resolution: monthly + month_start: 1 + month_end: 12 + average_each_year: False + +space: + min_lat: -70 + max_lat: 70 + min_lon: -178.5 + max_lon: 178.5 + +regrid: + regrid_on_reference: True + regrid_dlat: 0.50 + regrid_dlon: 0.50 + +datasets: + reference: + data_source: local + data_name: AVISO + path: ./data/ESGF_data/zos_AVISO_L4_199210-201012.nc + variable: zos + + targets: + data_source: local + path: ./data/ESGF_data/zos_Omon_MPI-ESM-LR_decadal1994_r1i1p1_199501-200412.nc + variable: zos + GCM_data: True + +number_of_metrics_and_plots: 1 + +metrics1: Map_plot_bias_of_multiyear_climatology + +plots1: + file_name: BIAS_zos_MPI-AVISO_1995-2004_local + subplots_array: !!python/tuple [2,2] + + +use_subregions: False http://git-wip-us.apache.org/repos/asf/climate/blob/456e1b57/examples/esgf_integration_example.py ---------------------------------------------------------------------- diff --git a/examples/esgf_integration_example.py b/examples/esgf_integration_example.py new file mode 100644 index 0000000..a76d1f8 --- /dev/null +++ b/examples/esgf_integration_example.py @@ -0,0 +1,41 @@ +# 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 +from getpass import getpass + +dataset_id = 'obs4MIPs.CNES.AVISO.zos.mon.v20110829|esgf-data.jpl.nasa.gov' +variable = 'zosStderr' + +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] http://git-wip-us.apache.org/repos/asf/climate/blob/456e1b57/examples/esgf_integration_examply.py ---------------------------------------------------------------------- diff --git a/examples/esgf_integration_examply.py b/examples/esgf_integration_examply.py deleted file mode 100644 index f4d58c3..0000000 --- a/examples/esgf_integration_examply.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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.zos.mon.v20110829|esgf-data.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]
