Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Arctic transects tag and flip OSNAP sections #185

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env python

import shutil

from geometric_features import GeometricFeatures, FeatureCollection
from geometric_features.utils import write_feature_names_and_tags


gf = GeometricFeatures(cacheLocation='../../geometric_data',
remoteBranchOrTag='master')

fcNew = FeatureCollection()

# Flip OSNAP sections and rename their tag to 'arctic_transport_sections'
fc = gf.read('ocean', 'transect', ['OSNAP section East'])
properties = fc.features[0]['properties']
properties['tags'] = 'arctic_transport_sections'
geometry = fc.features[0]['geometry']
coords = geometry['coordinates']
geometry['coordinates'] = coords[::-1]
xylar marked this conversation as resolved.
Show resolved Hide resolved
fcNew = fc

fc = gf.read('ocean', 'transect', ['OSNAP section West'])
properties = fc.features[0]['properties']
properties['tags'] = 'arctic_transport_sections'
geometry = fc.features[0]['geometry']
coords = geometry['coordinates']
geometry['coordinates'] = coords[::-1]
xylar marked this conversation as resolved.
Show resolved Hide resolved
fcNew.merge(fc)

# Rename tag of remaining Arctic sections to 'arctic_transport_sections'
fc = gf.read(componentName='ocean', objectType='transect',
tags=['standard_transport_sections', 'arctic_sections'])
for feature in fc.features:
print(feature['properties']['name'])
properties = feature['properties']
properties['tags'] = 'standard_transport_sections;arctic_transport_sections'
fcNew.merge(fc)
fc = gf.read('ocean', 'transect', ['Hudson Bay-Labrador Sea'])
properties = fc.features[0]['properties']
properties['tags'] = 'arctic_transport_sections'
fcNew.merge(fc)

fcNew.to_geojson('arctic_transport_sections.geojson')

# "split" these features into individual files in the geometric data cache
gf.split(fcNew)

# update the database of feature names and tags
write_feature_names_and_tags(gf.cacheLocation)
# move the resulting file into place
shutil.copyfile('features_and_tags.json',
'../../geometric_features/features_and_tags.json')
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "Feature",
"properties": {
"name": "Barents Sea Opening",
"tags": "standard_transport_sections;arctic_sections",
"tags": "standard_transport_sections;arctic_transport_sections",
"object": "transect",
"component": "ocean",
"author": "Milena Veneziani",
Expand Down Expand Up @@ -51,4 +51,4 @@
}
}
]
}
}
4 changes: 2 additions & 2 deletions geometric_data/ocean/transect/Bering_Strait/transect.geojson
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "Feature",
"properties": {
"name": "Bering Strait",
"tags": "standard_transport_sections;arctic_sections",
"tags": "standard_transport_sections;arctic_transport_sections",
"object": "transect",
"component": "ocean",
"author": "Mark Petersen, Xylar Asay-Davis, Milena Veneziani",
Expand Down Expand Up @@ -39,4 +39,4 @@
}
}
]
}
}
4 changes: 2 additions & 2 deletions geometric_data/ocean/transect/Davis_Strait/transect.geojson
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "Feature",
"properties": {
"name": "Davis Strait",
"tags": "standard_transport_sections;arctic_sections",
"tags": "standard_transport_sections;arctic_transport_sections",
"object": "transect",
"component": "ocean",
"author": "Milena Veneziani",
Expand Down Expand Up @@ -35,4 +35,4 @@
}
}
]
}
}
55 changes: 27 additions & 28 deletions geometric_data/ocean/transect/Denmark_Strait/transect.geojson
Original file line number Diff line number Diff line change
Expand Up @@ -5,65 +5,64 @@
"type": "Feature",
"properties": {
"name": "Denmark Strait",
"tags": "standard_transport_sections;arctic_sections",
"tags": "standard_transport_sections;arctic_transport_sections",
"object": "transect",
"component": "ocean",
"author": "Milena Veneziani",
"history": "03/20/21 : milena : hand drawn in geojson.io;"
"author": "Milena Veneziani"
},
"geometry": {
"type": "LineString",
"coordinates": [
[
-24.06005859375,
65.52206835254366
-24.060059,
65.522068
milenaveneziani marked this conversation as resolved.
Show resolved Hide resolved
],
[
-24.947204589843746,
65.8915584316631
-24.947205,
65.891558
],
[
-25.8343505859375,
66.25579951687561
-25.834351,
66.2558
],
[
-26.277923583984375,
66.43597045483075
-26.277924,
66.43597
],
[
-26.72149658203125,
66.61485166299882
-26.721497,
66.614852
],
[
-27.165069580078125,
66.7924506425733
-27.16507,
66.792451
],
[
-27.608642578125,
66.96877489043764
-27.608643,
66.968775
],
[
-28.05221557617187,
67.14383189813256
-28.052216,
67.143832
],
[
-28.49578857421875,
67.31762915084906
-28.495789,
67.317629
],
[
-29.3829345703125,
67.66147429450167
-29.382935,
67.661474
],
[
-30.270080566406246,
68.00037003928001
-30.270081,
68.00037
],
[
-31.1572265625,
68.33437594128185
-31.157227,
68.334376
]
]
}
}
]
}
}
4 changes: 2 additions & 2 deletions geometric_data/ocean/transect/Fram_Strait/transect.geojson
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "Feature",
"properties": {
"name": "Fram Strait",
"tags": "standard_transport_sections;arctic_sections",
"tags": "standard_transport_sections;arctic_transport_sections",
"object": "transect",
"component": "ocean",
"author": "Mark Petersen, Xylar Asay-Davis, Milena Veneziani",
Expand Down Expand Up @@ -67,4 +67,4 @@
}
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
"type": "Feature",
"properties": {
"name": "Hudson Bay-Labrador Sea",
"tags": "arctic_sections",
"tags": "arctic_transport_sections",
"object": "transect",
"component": "ocean",
"author": "Milena Veneziani",
"history": "03/20/21 : milena : hand drawn in geojson.io;"
"author": "Milena Veneziani"
},
"geometry": {
"type": "LineString",
Expand All @@ -20,7 +19,7 @@
],
[
-65.695,
61.010192354571686
61.010192
],
[
-66.75,
Expand All @@ -30,4 +29,4 @@
}
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,85 +5,84 @@
"type": "Feature",
"properties": {
"name": "Iceland-Faroe-Scotland",
"tags": "standard_transport_sections;arctic_sections",
"tags": "standard_transport_sections;arctic_transport_sections",
"object": "transect",
"component": "ocean",
"author": "Milena Veneziani",
"history": "03/20/21 : milena : hand drawn in geojson.io;"
"author": "Milena Veneziani"
},
"geometry": {
"type": "LineString",
"coordinates": [
[
-3.9111328125000004,
58.459228692360625
-3.911133,
58.459229
],
[
-4.27642822265625,
58.94009027227909
-4.276428,
58.94009
],
[
-4.6417236328125,
59.41434334604421
-4.641724,
59.414343
],
[
-5.00701904296875,
59.882046686648515
-5.007019,
59.882047
],
[
-5.372314453125,
60.343260013555195
-5.372314,
60.34326
],
[
-5.73760986328125,
60.798043911722594
-5.73761,
60.798044
],
[
-6.1029052734375,
61.24645975350053
-6.102905,
61.24646
],
[
-6.46820068359375,
61.68856962337029
-6.468201,
61.68857
],
[
-6.83349609375,
62.12443624549497
-6.833496,
62.124436
],
[
-7.764587402343749,
62.47680101352278
-7.764587,
62.476801
],
[
-8.6956787109375,
62.825055614564306
-8.695679,
62.825056
],
[
-9.62677001953125,
63.169235275109116
-9.62677,
63.169235
],
[
-10.557861328125,
63.509375401175134
-10.557861,
63.509375
],
[
-11.48895263671875,
63.84551155612745
-11.488953,
63.845512
],
[
-12.420043945312498,
64.17767943926998
-12.420044,
64.177679
],
[
-13.35113525390625,
64.50591486519582
-13.351135,
64.505915
],
[
-14.2822265625,
64.830253743883
-14.282227,
64.830254
]
]
}
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "Feature",
"properties": {
"name": "Lancaster Sound",
"tags": "standard_transport_sections;arctic_sections",
"tags": "standard_transport_sections;arctic_transport_sections",
"object": "transect",
"component": "ocean",
"author": "Milena Veneziani",
Expand All @@ -27,4 +27,4 @@
}
}
]
}
}
4 changes: 2 additions & 2 deletions geometric_data/ocean/transect/Nares_Strait/transect.geojson
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "Feature",
"properties": {
"name": "Nares Strait",
"tags": "standard_transport_sections;arctic_sections",
"tags": "standard_transport_sections;arctic_transport_sections",
"object": "transect",
"component": "ocean",
"author": "Milena Veneziani",
Expand All @@ -27,4 +27,4 @@
}
}
]
}
}
Loading