Commit 90f5fb41 authored by Tomas Pettersson's avatar Tomas Pettersson 🏸

using pkg_resources

parent 37f9ecaa
......@@ -5,6 +5,7 @@ import os
import sys
import json
import pickle
import pkg_resources
from traceback import print_exc
from model import Model
from shapely import geometry
......@@ -24,14 +25,12 @@ def storetree():
continue
split = line.split(' ')
section.append([float(split[2]),float(split[1])])
with open('strtree.pickle', 'wb') as handle:
with open('resources/strtree.pickle', 'wb') as handle:
pickle.dump(sections, handle, protocol=pickle.HIGHEST_PROTOCOL)
def run():
try:
with open('exercisemodel/strtree.pickle', 'rb') as handle:
strtree = STRtree(pickle.load(handle))
strtree = STRtree(pickle.load(pkg_resources.resource_stream(__name__, '/'.join(('resources', 'strtree.pickle')))))
m = Model()()
with open('input.json',"r") as inputfile:
inputfeaturecollection = json.load(inputfile)
......
......@@ -8,4 +8,4 @@ setup(name='exercisemodel',
author_email='tomas.pettersson@smhi.se',
license='MIT',
packages=['exercisemodel'],
zip_safe=False)
\ No newline at end of file
zip_safe=True)
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment