Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GeoPEAS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
esde
toar-data
GeoPEAS
Commits
a6d3755c
Commit
a6d3755c
authored
5 years ago
by
leufen1
Browse files
Options
Downloads
Patches
Plain Diff
added plot routine to population
parent
e62cefc0
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!5
New App; stable_night_lights
,
!4
Lukas issue004 feat new app stable night lights
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
population-density/population_file_extraction.py
+6
-4
6 additions, 4 deletions
population-density/population_file_extraction.py
population-density/tests.py
+7
-0
7 additions, 0 deletions
population-density/tests.py
with
13 additions
and
4 deletions
population-density/population_file_extraction.py
+
6
−
4
View file @
a6d3755c
...
...
@@ -8,8 +8,8 @@ Author: Martin Schultz, FZ Juelich (04 May 2016)
import
numpy
as
np
import
os
from
toar_location_services.settings
import
DATA_DIR
,
DEBUG
,
USE_DUMMY_POPULATION_DATA
import
matplotlib.pyplot
as
plt
# import matplotlib.pyplot as plt
def
read_proxydata
(
filename
,
dummy
=
DEBUG
and
USE_DUMMY_POPULATION_DATA
):
"""
Read the ascii file and return the data array together with
...
...
@@ -54,9 +54,11 @@ def read_proxydata(filename, dummy=DEBUG and USE_DUMMY_POPULATION_DATA):
logdata
=
data
.
copy
()
logdata
[
logdata
<=
1.e-4
]
=
1.e-4
# plt.contourf(lonvec, latvec, np.log10(logdata))
# plt.savefig('global_population_density.png')
# plt.close()
if
DEBUG
:
plt
.
contourf
(
lonvec
,
latvec
,
np
.
log10
(
logdata
))
plt
.
savefig
(
'
../plots/global_population_density.png
'
)
plt
.
close
()
# set metadata
boundingbox
=
[
lon0
,
lat0
,
lonvec
.
max
(),
latvec
.
max
()]
...
...
This diff is collapsed.
Click to expand it.
population-density/tests.py
+
7
−
0
View file @
a6d3755c
from
django.test
import
TestCase
# Create your tests here.
from
.population_file_extraction
import
read_proxydata
FILENAME
=
"
pop.txt
"
read_proxydata
(
FILENAME
,
dummy
=
False
)
\ No newline at end of file
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