Skip to content

Commit

Permalink
Call floor to properly handle neg transform vals
Browse files Browse the repository at this point in the history
  • Loading branch information
bkg committed Jun 24, 2016
1 parent 9bc991a commit d7a2ea2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions greenwich/raster.py
@@ -1,5 +1,6 @@
"""Raster data handling"""
import os
import math
import xml.etree.cElementTree as ET

import numpy as np
Expand Down Expand Up @@ -153,8 +154,8 @@ def transform(self, coords):
# Use local vars for better performance here.
origin_x, origin_y = self.origin
sx, sy = self.scale
return [(int(round((x - origin_x) / sx)),
int(round((y - origin_y) / sy)))
return [(int(math.floor((x - origin_x) / sx)),
int(math.floor((y - origin_y) / sy)))
for x, y in coords]

@property
Expand Down

0 comments on commit d7a2ea2

Please sign in to comment.