[ 
https://issues.apache.org/jira/browse/CLIMATE-634?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14540249#comment-14540249
 ] 

ASF GitHub Bot commented on CLIMATE-634:
----------------------------------------

Github user kwhitehall commented on a diff in the pull request:

    https://github.com/apache/climate/pull/197#discussion_r30156559
  
    --- Diff: examples/simple_model_to_model_bias_DJF_and_JJA.py ---
    @@ -0,0 +1,64 @@
    +# 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 datetime
    +from os import path
    +import urllib
    +
    +import numpy as np
    +
    +import ocw.data_source.local as local
    +import ocw.dataset_processor as dsp
    +import ocw.evaluation as evaluation
    +import ocw.metrics as metrics
    +import ocw.plotter as plotter
    +import ocw.utils as utils
    +
    +# File URL leader
    +FILE_LEADER = "http://zipper.jpl.nasa.gov/dist/";
    +# Two Local Model Files 
    +FILE_1 = "AFRICA_KNMI-RACMO2.2b_CTL_ERAINT_MM_50km_1989-2008_tasmax.nc"
    +FILE_2 = "AFRICA_UC-WRF311_CTL_ERAINT_MM_50km-rg_1989-2008_tasmax.nc"
    +# Filename for the output image/plot (without file extension)
    +OUTPUT_PLOT = "wrf_bias_compared_to_knmi"
    +
    +FILE_1_PATH = path.join('/tmp', FILE_1)
    +FILE_2_PATH = path.join('/tmp', FILE_2)
    +
    +if not path.exists(FILE_1_PATH):
    +    urllib.urlretrieve(FILE_LEADER + FILE_1, FILE_1_PATH)
    +if not path.exists(FILE_2_PATH):
    +    urllib.urlretrieve(FILE_LEADER + FILE_2, FILE_2_PATH)
    +
    +""" Step 1: Load Local NetCDF Files into OCW Dataset Objects """
    +print("Loading %s into an OCW Dataset Object" % (FILE_1_PATH,))
    +knmi_dataset = local.load_file(FILE_1_PATH, "tasmax")
    +print("KNMI_Dataset.values shape: (times, lats, lons) - %s \n" % 
(knmi_dataset.values.shape,))
    +
    +print("Loading %s into an OCW Dataset Object" % (FILE_2_PATH,))
    +wrf_dataset = local.load_file(FILE_2_PATH, "tasmax")
    +print("WRF_Dataset.values shape: (times, lats, lons) - %s \n" % 
(wrf_dataset.values.shape,))
    +
    +""" Step 2: Calculate seasonal average """
    +print("Calculate seasonal average")
    --- End diff --
    
    In this example, to replicate the bug associated with the CLIMATE-634 tix, 
do below:
    
    knmi_dataset.values, knmi_DJF = 
utils.calc_climatology_season(month_start=12, month_end=2, dataset=knmi_dataset)
    wrf_dataset.values, wrf_DJF = utils.calc_climatology_season(month_start=12, 
month_end=2, dataset=wrf_dataset)
    print("Seasonally averaged KNMI_Dataset.values shape: (times, lats, lons) - 
%s \n" % (knmi_dataset.values.shape,))
    print("Seasonally averaged wrf_Dataset.values shape: (times, lats, lons) - 
%s \n" % (wrf_dataset.values.shape,))
    #JJA works with the current functionality
    # knmi_dataset.values, knmi_JJA = 
utils.calc_climatology_season(month_start=6, month_end=8, dataset=knmi_dataset)
    # wrf_dataset.values,wrf_JJA = utils.calc_climatology_season(month_start=6, 
month_end=8, dataset=wrf_dataset)



> fix calc_climatology_monthly 
> -----------------------------
>
>                 Key: CLIMATE-634
>                 URL: https://issues.apache.org/jira/browse/CLIMATE-634
>             Project: Apache Open Climate Workbench
>          Issue Type: Bug
>            Reporter: Kim Whitehall
>            Assignee: Kim Whitehall
>
> Bug if start month > end mth causes calc_climatology_season to fail



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to