Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
resite_ip
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
smart_grids
public
resite_ip
Commits
70b31524
Commit
70b31524
authored
4 years ago
by
David Radu
Browse files
Options
Downloads
Patches
Plain Diff
fixed bug keeping only unique coordinate points for each region
parent
30f996ac
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/tools.py
+8
-10
8 additions, 10 deletions
src/tools.py
with
8 additions
and
10 deletions
src/tools.py
+
8
−
10
View file @
70b31524
...
...
@@ -502,18 +502,17 @@ def return_filtered_coordinates(dataset, spatial_resolution, technologies, regio
# from src.helpers import plot_basemap
# plot_basemap(final_coordinates[tech], title=tech)
for
region
in
regions
:
shape_region
=
union_regions
([
region
],
path_shapefile_data
,
which
=
'
both
'
)
points_in_region
=
return_coordinates_from_shapefiles_light
(
dataset
,
shape_region
)
for
tech
in
technologies
:
# points_in_region_rounded = [(round(item[0], 2), round(item[1], 2)) for item in points_in_region]
list_points_unique
=
[]
for
region
in
regions
:
for
tech
in
technologies
:
shape_region
=
union_regions
([
region
],
path_shapefile_data
,
which
=
'
both
'
)
points_in_region
=
return_coordinates_from_shapefiles_light
(
dataset
,
shape_region
)
points_to_take
=
list
(
set
(
final_coordinates
[
tech
]).
intersection
(
set
(
points_in_region
)))
output_dict
[
region
][
tech
]
=
points_to_take
output_dict
[
region
][
tech
]
=
[
p
for
p
in
points_to_take
if
p
not
in
list_points_unique
]
list_points_unique
.
extend
(
points_to_take
)
if
len
(
points_to_take
)
>
0
:
print
(
region
,
tech
,
len
(
points_to_take
))
...
...
@@ -719,7 +718,6 @@ def return_output(input_dict, path_to_transfer_function, smooth_wind_power_curve
raise
ValueError
(
'
The resource specified is not available yet.
'
)
output_array
=
output_array
.
where
(
output_array
>
0.01
,
other
=
0.0
)
output_dict
[
region
][
tech
]
=
output_array
.
reindex_like
(
input_dict
[
region
][
tech
])
# output_array.mean(dim='time').unstack('locations').plot(x='longitude', y='latitude')
# plt.show()
...
...
@@ -800,7 +798,7 @@ def critical_data_position_mapping(input_dict, coordinates_data):
for
region
,
tech
in
key_list
:
locations_list
.
extend
([(
tech
,
loc
)
for
loc
in
input_dict
[
region
][
tech
].
locations
.
values
.
flatten
()])
coordinates_data
[
region
][
tech
]
=
input_dict
[
region
][
tech
].
locations
.
values
.
flatten
()
locations_dict
=
dict
(
zip
(
locations_list
,
arange
(
len
(
locations_list
))))
locations_dict
=
dict
(
zip
(
locations_list
,
list
(
arange
(
len
(
locations_list
))))
)
return
locations_dict
,
coordinates_data
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment