Код: Выделить всё
Job 1714090 (network_extraction_job) Complete
User = user_ID
Queue =
Host =
Start Time = 09/24/2024 16:46:09
End Time = 09/24/2024 16:46:09
User Time = 00:00:00
System Time = 00:00:00
Wallclock Time = 00:00:00
CPU = 00:01:52
Max vmem = NA
Exit Status = 2
Код: Выделить всё
#!/bin/bash -l
# Request wallclock time (format hours:minutes:seconds).
#$ -l h_rt=1:0:0
# Request 41 gigabyte of RAM (must be an integer followed by M, G, or T)
#$ -l mem=150G
# Set the name of the job
#$ -N nx_extract_job
# Set the working directory to somewhere in your scratch space
#$ -wd /home/user_ID/Scratch/enhance
# email when begin, end, aborted, or suspended
#$ -m beas
# Load the Python module and run your Python programme
module load python3/recommended
pip install osmnx
pip install geopandas
pip install os
pip install pyrosm
python /home/user_ID/Scratch/enhance/script/network_data_import.py
Код: Выделить всё
import osmnx as ox # install
import geopandas as gpd # install
from os.path import exists # install
import pyrosm as pyr # install
import networkx as nx
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
ox.settings.timeout=9000
# metropolitan region Amsterdam
city = 'amsterdam'
# bounding box of Amsterdam Metropolitan Region
bbox_of_interest = {
'amsterdam': {
'bbox': {
'west': 4.4776,
'east': 5.6059,
'south': 52.1659,
'north': 52.6928
},
'src': '/home/user_ID/Scratch/enhance/data/osm_extracts/netherlands-latest.osm.pbf'
}
}
# extract networks from layer
net_filepath = "/home/user_ID/Scratch/enhance/data/sf_bike_"+city+".gpkg"
if not exists(net_filepath):
if bbox_of_interest[city]['src']=='':
sf_net = ox.graph_from_bbox(
west= bbox_of_interest[city]['bbox'][1]
,east= bbox_of_interest[city]['bbox'][2]
,south= bbox_of_interest[city]['bbox'][3]
,north= bbox_of_interest[city]['bbox'][4]
,network_type='cycling'
,simplify=True
,retain_all=False
,truncate_by_edge=True
,clean_periphery=True
,custom_filter=None
)
ox.save_graph_geopackage(sf_net,net_filepath)
elif bbox_of_interest[city]['src']!='': # experimental : from a local pbf file construct the network
print('Extracting the network from the bbox in file '+bbox_of_interest[city]['src'])
output_path = bbox_of_interest[city]['src']
# Convert the bbox dictionary to a list: [west, south, east, north]
bbox = [
bbox_of_interest[city]['bbox']['west'],
bbox_of_interest[city]['bbox']['south'],
bbox_of_interest[city]['bbox']['east'],
bbox_of_interest[city]['bbox']['north']
]
# Initialise the reader
osm = pyr.OSM(output_path, bounding_box = bbox)
# Get all walkable roads and the nodes
nodes,edges = osm.get_network(network_type="cycling",nodes=True)
# save nodes and edges
nodes.to_file(net_filepath, layer="nodes", driver="GPKG")
edges.to_file(net_filepath, layer="edges", driver="GPKG")
else :
print('Raw network file exists')
print('finished!')
Что мне следует сделать, чтобы получить желаемый результат ? Любая помощь будет оценена по достоинству!
Подробнее здесь: https://stackoverflow.com/questions/790 ... ata-output