Skip to content

Commit

Permalink
Moved shapefile module for RTD
Browse files Browse the repository at this point in the history
  • Loading branch information
sambowers committed Jan 16, 2018
1 parent 908224f commit 6d7928b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion biota/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from PIL import Image, ImageDraw
from scipy import ndimage
import scipy.stats as stats
import shapefile
import pdb


Expand Down Expand Up @@ -388,6 +387,8 @@ def _coordinateTransformer(shp):
A function that transforms shapefile points to EPSG.
"""

from osgeo import ogr, osr

driver = ogr.GetDriverByName('ESRI Shapefile')
ds = driver.Open(shp)
layer = ds.GetLayer()
Expand Down Expand Up @@ -443,6 +444,8 @@ def rasterizeShapefile(data, shp, buffer_size = 0., binary_mask = True):
A numpy array with a boolean mask delineating locations inside (True) and outside (False) the shapefile [and optional buffer].
"""

import shapefile

# Determine size of buffer to place around lines/polygons
buffer_px = int(round(buffer_size / data.geo_t[1]))

Expand Down Expand Up @@ -538,6 +541,8 @@ def getTilesInShapefile(shp):
The lat/lon indicators of which ALOS tiles are covered by the shapefile
"""

import shapefile

# The shapefile may not have the same CRS as ALOS mosaic data, so this will generate a function to reproject points.
coordTransform = _coordinateTransformer(shp)

Expand Down

0 comments on commit 6d7928b

Please sign in to comment.