Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 888A8200B14 for ; Sat, 18 Jun 2016 12:13:16 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 86F46160A4E; Sat, 18 Jun 2016 10:13:16 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id CBFD8160A26 for ; Sat, 18 Jun 2016 12:13:15 +0200 (CEST) Received: (qmail 83773 invoked by uid 500); 18 Jun 2016 10:13:15 -0000 Mailing-List: contact dev-help@climate.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@climate.apache.org Delivered-To: mailing list dev@climate.apache.org Received: (qmail 83761 invoked by uid 99); 18 Jun 2016 10:13:15 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 18 Jun 2016 10:13:14 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 9402D18057B for ; Sat, 18 Jun 2016 10:13:14 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.646 X-Spam-Level: X-Spam-Status: No, score=-4.646 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-1.426] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id rRPIGOZC72xx for ; Sat, 18 Jun 2016 10:13:12 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id A85605FAD4 for ; Sat, 18 Jun 2016 10:13:11 +0000 (UTC) Received: (qmail 82696 invoked by uid 99); 18 Jun 2016 10:13:05 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 18 Jun 2016 10:13:05 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 3FB7A2C1F60 for ; Sat, 18 Jun 2016 10:13:05 +0000 (UTC) Date: Sat, 18 Jun 2016 10:13:05 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: dev@climate.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CLIMATE-812) Fix PEP8 Violations in dataset processor MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Sat, 18 Jun 2016 10:13:16 -0000 [ https://issues.apache.org/jira/browse/CLIMATE-812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15337725#comment-15337725 ] ASF GitHub Bot commented on CLIMATE-812: ---------------------------------------- Github user jarifibrahim commented on a diff in the pull request: https://github.com/apache/climate/pull/361#discussion_r67598748 --- Diff: ocw/dataset_processor.py --- @@ -202,130 +214,158 @@ def spatial_regrid(target_dataset, new_latitudes, new_longitudes, boundary_check ny_new, nx_new = new_lats.shape # Make masked array of shape (times, new_latitudes,new_longitudes) - new_values = ma.zeros([len(target_dataset.times), - ny_new, nx_new]) + new_values = ma.zeros([len(target_dataset.times), + ny_new, nx_new]) # Make masked array of shape (times, new_latitudes,new_longitudes) - new_values = ma.zeros([len(target_dataset.times), + new_values = ma.zeros([len(target_dataset.times), ny_new, nx_new]) # Boundary vertices of target_dataset vertices = [] - if regular_grid: - vertices.append([lons[0,0], lats[0,0]]) - vertices.append([lons[-1,0], lats[-1,0]]) - vertices.append([lons[-1,-1], lats[-1,-1]]) - vertices.append([lons[0,-1], lats[0,-1]]) - else: - for iy in np.arange(ny_old): # from south to north along the west boundary - vertices.append([lons[iy,0], lats[iy,0]]) - for ix in np.arange(nx_old): # from west to east along the north boundary + if regular_grid: + vertices.append([lons[0, 0], lats[0, 0]]) + vertices.append([lons[-1, 0], lats[-1, 0]]) + vertices.append([lons[-1, -1], lats[-1, -1]]) + vertices.append([lons[0, -1], lats[0, -1]]) + else: + # from south to north along the west boundary + for iy in np.arange(ny_old): + vertices.append([lons[iy, 0], lats[iy, 0]]) + # from west to east along the north boundary + for ix in np.arange(nx_old): vertices.append([lons[-1, ix], lats[-1, ix]]) - for iy in np.arange(ny_old)[::-1]: # from north to south along the east boundary + # from north to south along the east boundary + for iy in np.arange(ny_old)[::-1]: vertices.append([lons[iy, -1], lats[iy, -1]]) - for ix in np.arange(nx_old)[::-1]: # from east to west along the south boundary + # from east to west along the south boundary + for ix in np.arange(nx_old)[::-1]: vertices.append([lons[0, ix], lats[0, ix]]) path = Path(vertices) # Convert new_lats and new_lons to float indices new_lons_indices = np.zeros(new_lons.shape) new_lats_indices = np.zeros(new_lats.shape) - + for iy in np.arange(ny_new): for ix in np.arange(nx_new): - if path.contains_point([new_lons[iy,ix], new_lats[iy,ix]]) or not boundary_check: + if path.contains_point([new_lons[iy, ix], + new_lats[iy, ix]]) or not boundary_check: if regular_grid: - new_lats_indices[iy,ix] = (ny_old -1.)*(new_lats[iy,ix] - lats.min())/(lats.max() - lats.min()) - new_lons_indices[iy,ix] = (nx_old -1.)*(new_lons[iy,ix] - lons.min())/(lons.max() - lons.min()) + mn = lats.min() + mx = lats.max() + new_lats_indices[iy, ix] = ( + ny_old - 1.) * (new_lats[iy, ix] - mn / (mx - mn)) --- End diff -- `mx`, `mn` are used to reduce line length. > Fix PEP8 Violations in dataset processor > ---------------------------------------- > > Key: CLIMATE-812 > URL: https://issues.apache.org/jira/browse/CLIMATE-812 > Project: Apache Open Climate Workbench > Issue Type: Improvement > Reporter: Ibrahim Jarif > Assignee: Ibrahim Jarif > Fix For: 1.1 > > -- This message was sent by Atlassian JIRA (v6.3.4#6332)