SWORD.get_nodes_in_AOI()
import shapely
# Import package
from dahitiapi.SWORD import SWORD
# Initialize Class
sword = SWORD()
# Define AOI as Shapely polygon
points = [[-91.1428, 40.7682], [-91.0428, 40.7682], [-91.0428, 40.8681], [-91.1428, 40.8681], [-91.1428, 40.7682]]
polygon = shapely.geometry.Polygon(points)
SWORD_version = 'v17'
response = sword.get_nodes_in_AOI(SWORD_version,polygon)
Output of JSON response:
{
'SWORD_version': 'v17b',
'centerlines': None,
'nodes': {
'74285000100011': {
'node_id': 74285000100011,
'reach_id': 74285000101,
'width': 953.0,
'width_var': 1045.4285714285713,
'x': -91.0831,
'y': 40.76844167584262
},
'74285000100021': {
'node_id': 74285000100021,
'reach_id': 74285000101,
'width': 1078.5,
'width_var': 1804.3333333333333,
'x': -91.0837,
'y': 40.770208582627575
},
...
'74285000100631': {
'node_id': 74285000100631,
'reach_id': 74285000101,
'width': 875.5,
'width_var': 1329.138888888889,
'x': -91.0519,
'y': 40.866959760650815
}
},
'reaches': {
'74285000101': {
'change_log': '',
'cl_ids_0': 4281840,
'cl_ids_1': 4282289,
'continent': 'north_america',
'dist_out': 2223957.406977444,
'edit_flag': None,
'end_reach': 0,
'facc': 297591.78800951084,
'grod_id': 0,
'hfalls_id': 0,
'iceflag': 2958,
'id': 169303,
'lakeflag': 0,
'low_slope_flag': 0,
'main_side': 0,
'max_width': 2958.0,
'n_chan_max': 5,
'n_chan_mod': 1,
'n_nodes': 76,
'n_rch_down': 1,
'n_rch_up': 1,
'network': 1,
'nodes': 'LINESTRING(-91.0831 '
'40.76844167584262,-91.0837 '
'40.770208582627575,-91.0839 '
'40.77183276232397,-91.0842 '
'40.77359376496515,-91.0845 '
'40.775490409963254,-91.0849 '
'40.77725377050331,-91.0853 '
...
'40.87427829149507,-91.0369 '
'40.87532536426219,-91.0349 '
'40.87648043887865,-91.0331 '
'40.87742243778996,-91.0314 '
'40.87863693041557,-91.03 '
'40.8799630826101,-91.0282 '
'40.88141878362745)',
'obstr_type': 0.0,
'path_freq': 27,
'path_order': 55,
'path_segs': 169,
'rch_id_dn_0': 74285000091,
'rch_id_dn_1': None,
'rch_id_dn_2': None,
'rch_id_dn_3': None,
'rch_id_up_0': 74285000114,
'rch_id_up_1': None,
'rch_id_up_2': None,
'rch_id_up_3': None,
'reach_id': 74285000101,
'reach_id_v16': None,
'reach_length': 15128.742728026218,
'river_name': 'Mississippi River',
'slope': 0.07769367100757169,
'slope_IRISv2r1': None,
'stream_order': 4,
'swot_obs': 3,
'swot_orbits_0': 216,
'swot_orbits_1': 259,
'swot_orbits_10': None,
'swot_orbits_11': None,
'swot_orbits_12': None,
'swot_orbits_13': None,
'swot_orbits_14': None,
'swot_orbits_15': None,
'swot_orbits_16': None,
'swot_orbits_17': None,
'swot_orbits_18': None,
'swot_orbits_19': None,
'swot_orbits_2': 537,
'swot_orbits_20': None,
'swot_orbits_3': None,
'swot_orbits_4': None,
'swot_orbits_5': None,
'swot_orbits_6': None,
'swot_orbits_7': None,
'swot_orbits_8': None,
'swot_orbits_9': None,
'trib_flag': '0',
'width': 934.0,
'width_var': 34584.219600000004,
'wse': 159.3000030517578,
'wse_var': 0.15731478347092243,
'x': -91.07536753528892,
'x_max': -91.02726607370734,
'x_min': -91.09493831490377,
'y': 40.82715260956562,
'y_max': 40.882078795668434,
'y_min': 40.76763135632249
}
}
}