Skip to content

Commit

Permalink
fix #21
Browse files Browse the repository at this point in the history
  • Loading branch information
pesekon2 committed Aug 14, 2017
1 parent c985f8e commit e028f3d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
9 changes: 5 additions & 4 deletions r.in.sos/r.in.sos.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,16 +293,17 @@ def create_maps(parsed_obs, offering):

new.table.conn.commit()

new.close() # build=False)
# run_command('v.build', quiet=True, map=tableName)
new.close(build=False)
run_command('v.build', quiet=True, map=tableName)

This comment has been minimized.

Copy link
@lucadelu

lucadelu Aug 17, 2017

really good idea!


run_command('g.region', vect=tableName)
run_command('v.to.rast', input=tableName, output=tableName,
use='attr', attribute_column='value', layer=1)
use='attr', attribute_column='value', layer=1,
quiet=True)

if flags['f'] is True:
run_command('g.remove', 'f', type='vector',
name=tableName)
name=tableName, quiet=True)


if __name__ == "__main__":
Expand Down
3 changes: 2 additions & 1 deletion t.rast.in.sos/t.rast.in.sos.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ def create_temporal(mapsListFile, mapName):
type='raster',
input=mapName,
maps='{}'.format(rasterMap.strip()),
start=mapTimestamp)
start=mapTimestamp,
quiet=True)


def handle_not_given_options(service, offering=None):
Expand Down
12 changes: 10 additions & 2 deletions t.vect.in.sos/t.vect.in.sos.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@ def create_maps(parsed_obs, offering):

for key, observation in parsed_obs.iteritems():

run_command('g.message',
message='Creating vector maps for {}...'.format(key))

mapName = '{}_{}_{}'.format(options['output'], offering, key)
if ':' in mapName:
mapName = '_'.join(mapName.split(':'))
Expand Down Expand Up @@ -326,7 +329,8 @@ def create_maps(parsed_obs, offering):
new.write(Point(*a['geometry']['coordinates']),
(name, value))
new.table.conn.commit()
new.close()
new.close(build=False)
run_command('v.build', map=mapName, quiet=True)

i += 1

Expand All @@ -342,6 +346,9 @@ def create_maps(parsed_obs, offering):

def create_temporal(vectorMap, layersCount, layersTimestamps):

run_command('g.message',
message='Registering maps in the space time dataset...')

for i in range(1, layersCount):
layerTimestamp = '{}-{}-{} {}:{}'.format(
layersTimestamps[i - 1][1:5], layersTimestamps[i - 1][5:7],
Expand All @@ -352,7 +359,8 @@ def create_temporal(vectorMap, layersCount, layersTimestamps):
type='vector',
input=vectorMap,
maps='{}:{}'.format(vectorMap, i),
start=layerTimestamp)
start=layerTimestamp,
quiet=True)


if __name__ == "__main__":
Expand Down

0 comments on commit e028f3d

Please sign in to comment.