WolframAlpha.com
WolframCloud.com
All Sites & Public Resources...
Products & Services
Wolfram|One
Mathematica
Wolfram|Alpha Notebook Edition
Programming Lab
Finance Platform
SystemModeler
Wolfram Player
Wolfram Engine
WolframScript
Enterprise Private Cloud
Enterprise Mathematica
Wolfram|Alpha Appliance
Enterprise Solutions
Corporate Consulting
Technical Consulting
Wolfram|Alpha Business Solutions
Resource System
Data Repository
Neural Net Repository
Function Repository
Wolfram|Alpha
Wolfram|Alpha Pro
Problem Generator
API
Data Drop
Products for Education
Mobile Apps
Wolfram Player
Wolfram Cloud App
Wolfram|Alpha for Mobile
Wolfram|Alpha-Powered Apps
Services
Paid Project Support
Wolfram U
Summer Programs
All Products & Services »
Technologies
Wolfram Language
Revolutionary knowledge-based programming language.
Wolfram Cloud
Central infrastructure for Wolfram's cloud products & services.
Wolfram Science
Technology-enabling science of the computational universe.
Wolfram Notebooks
The preeminent environment for any technical workflows.
Wolfram Engine
Software engine implementing the Wolfram Language.
Wolfram Natural Language Understanding System
Knowledge-based broadly deployed natural language.
Wolfram Data Framework
Semantic framework for real-world data.
Wolfram Universal Deployment System
Instant deployment across cloud, desktop, mobile, and more.
Wolfram Knowledgebase
Curated computable knowledge powering Wolfram|Alpha.
All Technologies »
Solutions
Engineering, R&D
Aerospace & Defense
Chemical Engineering
Control Systems
Electrical Engineering
Image Processing
Industrial Engineering
Mechanical Engineering
Operations Research
More...
Finance, Statistics & Business Analysis
Actuarial Sciences
Bioinformatics
Data Science
Econometrics
Financial Risk Management
Statistics
More...
Education
All Solutions for Education
Trends
Machine Learning
Multiparadigm Data Science
Internet of Things
High-Performance Computing
Hackathons
Software & Web
Software Development
Authoring & Publishing
Interface Development
Web Development
Sciences
Astronomy
Biology
Chemistry
More...
All Solutions »
Learning & Support
Learning
Wolfram Language Documentation
Fast Introduction for Programmers
Wolfram U
Videos & Screencasts
Wolfram Language Introductory Book
Webinars & Training
Summer Programs
Books
Need Help?
Support FAQ
Wolfram Community
Contact Support
Premium Support
Paid Project Support
Technical Consulting
All Learning & Support »
Company
About
Company Background
Wolfram Blog
Events
Contact Us
Work with Us
Careers at Wolfram
Internships
Other Wolfram Language Jobs
Initiatives
Wolfram Foundation
MathWorld
Computer-Based Math
A New Kind of Science
Wolfram Technology for Hackathons
Student Ambassador Program
Wolfram for Startups
Demonstrations Project
Wolfram Innovator Awards
Wolfram + Raspberry Pi
Summer Programs
More...
All Company »
Search
WOLFRAM COMMUNITY
Connect with users of Wolfram technologies to learn, solve problems and share ideas
Join
Sign In
Dashboard
Groups
People
Message Boards
Answer
(
Unmark
)
Mark as an Answer
GROUPS:
Staff Picks
Data Science
Earth Science
Environmental Science
Image Processing
Wolfram Language
Wolfram High School Summer Camp
6
Olivia Schenker
[WSC20] Correlating Land Use with Carbon Emission Data
Olivia Schenker, Columbia Grammar and Prep School
Posted
10 months ago
2022 Views
|
1 Reply
|
6 Total Likes
Follow this post
|
Introduction
Global warming is the current rise of the average temperature on Earth as a result of the changing climate. Mostly due to human activity, there has been a recent increase in surface temperatures and sea levels, more severe and frequent natural disasters, and more. These changes to our climate have not only impacted the human population, but also other animal species that cannot adapt to this new environment. Two of the biggest contributors to climate change is accelerating carbon emissions and deforestation, both caused by humans. There have been some studies showing the correlation between land use and greenhouse gas emissions. This project, which I made at the Wolfram Summer Camp with the help of mentors, aims to provide evidence for the relationship between land usage and carbon monoxide emissions. I hope the results of this project can be used to further educated people and present the urgency for change.
The goal of this project was to display the correlation between land usage and carbon monoxide levels in a country. Land cover type and carbon monoxide emissions data were extracted and interpreted from the NASA Earthdata repository to create visuals, either in the form of maps or graphs, of user-specified countries. The data derived from the maps were then used to create plots that show change over time when comparing the data from two countries or within one country.
Extracting the Data
The imported NASA Earthdata contained information for world land usage from 2001 to present and carbon monoxide levels from 1980 to present. Since the online repository is formatted in XML, the data had to be modified. The code to do this was created by Christopher Wolfram.
Imports the data from the NASA Earthdata repository:
r
a
w
X
M
L
=
I
m
p
o
r
t
[
"
h
t
t
p
s
:
/
/
g
i
b
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[
"
D
i
m
e
n
s
i
o
n
"
,
{
}
,
{
O
r
d
e
r
l
e
s
s
P
a
t
t
e
r
n
S
e
q
u
e
n
c
e
[
_
_
_
,
X
M
L
E
l
e
m
e
n
t
[
{
"
h
t
t
p
:
/
/
w
w
w
.
o
p
e
n
g
i
s
.
n
e
t
/
o
w
s
/
1
.
1
"
,
"
I
d
e
n
t
i
f
i
e
r
"
}
,
{
}
,
{
"
T
i
m
e
"
}
]
,
X
M
L
E
l
e
m
e
n
t
[
"
D
e
f
a
u
l
t
"
,
{
}
,
{
d
_
}
]
]
}
]
D
a
t
e
O
b
j
e
c
t
[
d
]
]
|
>
]
]
/
@
r
a
w
L
a
y
e
r
s
]
]
;
Creates an Association[] between the levels within the imported data and {1, level number}:
t
i
l
e
M
a
t
r
i
x
Z
o
o
m
L
e
v
e
l
s
=
<
|
"
G
o
o
g
l
e
M
a
p
s
C
o
m
p
a
t
i
b
l
e
_
L
e
v
e
l
6
"
{
1
,
6
}
,
"
G
o
o
g
l
e
M
a
p
s
C
o
m
p
a
t
i
b
l
e
_
L
e
v
e
l
7
"
{
1
,
7
}
,
"
G
o
o
g
l
e
M
a
p
s
C
o
m
p
a
t
i
b
l
e
_
L
e
v
e
l
8
"
{
1
,
8
}
,
"
G
o
o
g
l
e
M
a
p
s
C
o
m
p
a
t
i
b
l
e
_
L
e
v
e
l
9
"
{
1
,
9
}
,
"
G
o
o
g
l
e
M
a
p
s
C
o
m
p
a
t
i
b
l
e
_
L
e
v
e
l
1
2
"
{
1
,
1
2
}
,
"
G
o
o
g
l
e
M
a
p
s
C
o
m
p
a
t
i
b
l
e
_
L
e
v
e
l
1
3
"
{
1
,
1
3
}
|
>
;
Withdraws data from the NASA server which can then be used within GeoServer:
l
a
y
e
r
G
e
o
S
e
r
v
e
r
[
l
a
y
e
r
_
,
t
i
m
e
_
]
/
;
K
e
y
E
x
i
s
t
s
Q
[
l
a
y
e
r
s
,
l
a
y
e
r
]
:
=
{
l
a
y
e
r
s
[
l
a
y
e
r
]
[
"
T
e
m
p
l
a
t
e
"
]
[
<
|
"
T
i
m
e
"
t
i
m
e
,
"
T
i
l
e
M
a
t
r
i
x
S
e
t
"
l
a
y
e
r
s
[
l
a
y
e
r
]
[
"
T
i
l
e
M
a
t
r
i
x
S
e
t
"
]
,
"
T
i
l
e
M
a
t
r
i
x
"
"
`
1
`
"
,
"
T
i
l
e
R
o
w
"
"
`
3
`
"
,
"
T
i
l
e
C
o
l
"
"
`
2
`
"
|
>
]
,
"
Z
o
o
m
R
a
n
g
e
"
t
i
l
e
M
a
t
r
i
x
Z
o
o
m
L
e
v
e
l
s
[
l
a
y
e
r
s
[
l
a
y
e
r
]
[
"
T
i
l
e
M
a
t
r
i
x
S
e
t
"
]
]
}
l
a
y
e
r
G
e
o
S
e
r
v
e
r
[
l
a
y
e
r
_
]
:
=
l
a
y
e
r
G
e
o
S
e
r
v
e
r
[
l
a
y
e
r
,
l
a
y
e
r
s
[
l
a
y
e
r
]
[
"
D
a
t
e
D
e
f
a
u
l
t
"
]
]
l
a
y
e
r
G
e
o
S
e
r
v
e
r
[
]
:
=
l
a
y
e
r
s
Forming an Image
The data from the NASA repository was turned into GeoImage[]s with the GeoServer being provided by layerGeoServer[].The constructed images displayed the region of the specified country along with its data is shown from 2001 to 2017. When entering the specified country, the user must input an Entity[].
Produces land cover type images of France in 2001:
l
a
n
d
I
M
G
=
G
e
o
I
m
a
g
e
G
e
o
R
a
n
g
e
F
r
a
n
c
e
C
O
U
N
T
R
Y
,
G
e
o
S
e
r
v
e
r
l
a
y
e
r
G
e
o
S
e
r
v
e
r
[
"
M
O
D
I
S
_
C
o
m
b
i
n
e
d
_
L
3
_
I
G
B
P
_
L
a
n
d
_
C
o
v
e
r
_
T
y
p
e
_
A
n
n
u
a
l
"
,
D
a
t
e
O
b
j
e
c
t
[
{
2
0
0
1
,
1
}
]
]
,
G
e
o
P
r
o
j
e
c
t
i
o
n
"
O
r
t
h
o
g
r
a
p
h
i
c
"
O
u
t
[
]
=
Constructs carbon monoxide emission images of the United States in 2001:
c
a
r
b
o
n
I
M
G
=
G
e
o
I
m
a
g
e
G
e
o
R
a
n
g
e
U
n
i
t
e
d
S
t
a
t
e
s
C
O
U
N
T
R
Y
,
G
e
o
S
e
r
v
e
r
l
a
y
e
r
G
e
o
S
e
r
v
e
r
[
"
M
E
R
R
A
2
_
C
a
r
b
o
n
_
M
o
n
o
x
i
d
e
_
E
m
i
s
s
i
o
n
_
M
o
n
t
h
l
y
"
,
D
a
t
e
O
b
j
e
c
t
[
{
2
0
0
1
,
1
}
]
]
,
G
e
o
P
r
o
j
e
c
t
i
o
n
"
O
r
t
h
o
g
r
a
p
h
i
c
"
O
u
t
[
]
=
Isolating One Country
As a result of using GeoImage[] to generate the maps, the image of the country was not isolated.
In order to accomplish isolating the country, a mask of the user-specified country was created and applied to the GeoImage. Since the image colors correspond to land type or carbon monoxide levels, the data for the inputted country can be extracted by counting the amount of pixels per color. To fit the mask onto the original image, the dimensions of the mask was changed to the same size as the original. This method was used for both land cover type and carbon emission images.
Constructs an image of the specified country (Italy), which is then turned into a mask.
c
a
r
b
o
n
O
R
L
a
n
d
M
a
s
k
=
I
m
a
g
e
R
e
s
i
z
e
C
o
l
o
r
N
e
g
a
t
e
B
i
n
a
r
i
z
e
I
m
a
g
e
G
e
o
G
r
a
p
h
i
c
s
G
e
o
S
t
y
l
i
n
g
[
N
o
n
e
]
,
E
d
g
e
F
o
r
m
[
B
l
u
e
]
,
F
a
c
e
F
o
r
m
[
B
l
u
e
]
,
P
o
l
y
g
o
n
I
t
a
l
y
C
O
U
N
T
R
Y
,
G
e
o
B
a
c
k
g
r
o
u
n
d
N
o
n
e
,
G
e
o
P
r
o
j
e
c
t
i
o
n
"
O
r
t
h
o
g
r
a
p
h
i
c
"
,
I
m
a
g
e
D
i
m
e
n
s
i
o
n
s
[
c
a
r
b
o
n
O
r
L
a
n
d
I
M
G
]
O
u
t
[
]
=
Produces the masked image of Italy by applying the mask to the original image:
o
n
e
C
o
u
n
t
r
y
I
m
a
g
e
=
B
r
i
g
h
t
n
e
s
s
E
q
u
a
l
i
z
e
[
I
m
a
g
e
A
p
p
l
y
[
1
-
#
&
,
c
a
r
b
o
n
O
r
L
a
n
d
I
M
G
,
M
a
s
k
i
n
g
c
a
r
b
o
n
O
r
L
a
n
d
M
a
s
k
]
,
1
]
O
u
t
[
]
=
Recoloring the Land Cover Type Images
When the images with land cover data were imported into Mathematica, the colors shifted slightly. These colors needed to match with the ones from the original legend, which were generated from the NASA data. To fix this problem, all the pixels from the masked image were changed using ColorReplace[], where the masked image's colors were replaced with the closest color based on the NASA legend. The pixel colors were changed based on their respective land types, grouping land types together for further analysis.
Generates a recolored land cover type image of Spain in 2001:
r
e
c
o
l
o
r
e
d
I
M
G
=
M
o
d
u
l
e
{
l
e
g
e
n
d
,
f
o
r
e
s
t
C
o
l
o
r
,
s
h
r
u
b
C
o
l
o
r
,
c
r
o
p
C
o
l
o
r
,
s
a
v
a
n
n
a
C
o
l
o
r
,
u
r
b
a
n
C
o
l
o
r
,
g
r
a
s
s
l
a
n
d
C
o
l
o
r
}
,
l
e
g
e
n
d
=
D
r
o
p
[
A
s
s
o
c
i
a
t
i
o
n
M
a
p
[
R
e
v
e
r
s
e
,
A
s
s
o
c
i
a
t
i
o
n
@
C
a
s
e
s
[
I
m
p
o
r
t
[
"
h
t
t
p
s
:
/
/
g
i
b
s
.
e
a
r
t
h
d
a
t
a
.
n
a
s
a
.
g
o
v
/
c
o
l
o
r
m
a
p
s
/
v
1
.
3
/
M
O
D
I
S
_
C
o
m
b
i
n
e
d
_
I
G
B
P
_
L
a
n
d
_
C
o
v
e
r
_
T
y
p
e
_
A
n
n
u
a
l
.
x
m
l
"
]
,
X
M
L
E
l
e
m
e
n
t
[
"
L
e
g
e
n
d
E
n
t
r
y
"
,
{
"
r
g
b
"
c
o
l
o
r
_
,
"
t
o
o
l
t
i
p
"
n
a
m
e
_
,
"
i
d
"
_
}
,
{
}
]
T
o
E
x
p
r
e
s
s
i
o
n
/
@
S
t
r
i
n
g
S
p
l
i
t
[
c
o
l
o
r
,
"
,
"
]
n
a
m
e
,
I
n
f
i
n
i
t
y
]
]
,
-
1
]
;
f
o
r
e
s
t
C
o
l
o
r
=
R
G
B
C
o
l
o
r
[
T
o
t
a
l
[
l
e
g
e
n
d
[
[
1
;
;
5
]
]
/
2
5
5
]
/
5
]
;
s
h
r
u
b
C
o
l
o
r
=
R
G
B
C
o
l
o
r
[
T
o
t
a
l
[
l
e
g
e
n
d
[
[
6
;
;
7
]
]
/
2
5
5
]
/
2
]
;
c
r
o
p
C
o
l
o
r
=
R
G
B
C
o
l
o
r
[
T
o
t
a
l
[
l
e
g
e
n
d
[
[
{
1
2
,
1
4
}
]
]
/
2
5
5
]
/
2
]
;
s
a
v
a
n
n
a
C
o
l
o
r
=
R
G
B
C
o
l
o
r
[
T
o
t
a
l
[
l
e
g
e
n
d
[
[
8
;
;
9
]
]
/
2
5
5
]
/
2
]
;
u
r
b
a
n
C
o
l
o
r
=
R
e
d
;
g
r
a
s
s
l
a
n
d
C
o
l
o
r
=
O
r
a
n
g
e
;
C
o
l
o
r
R
e
p
l
a
c
e
o
n
e
C
o
u
n
t
r
y
I
m
a
g
e
,
s
a
v
a
n
n
a
C
o
l
o
r
,
G
r
e
e
n
f
o
r
e
s
t
C
o
l
o
r
,
s
a
v
a
n
n
a
C
o
l
o
r
,
c
r
o
p
C
o
l
o
r
,
c
r
o
p
C
o
l
o
r
,
s
h
r
u
b
C
o
l
o
r
,
s
h
r
u
b
C
o
l
o
r
,
M
a
g
e
n
t
a
,
u
r
b
a
n
C
o
l
o
r
,
g
r
a
s
s
l
a
n
d
C
o
l
o
r
,
,
{
.
0
4
,
.
3
1
,
.
0
5
,
.
0
5
,
.
0
5
,
.
0
5
,
.
0
5
,
.
0
3
,
.
2
,
.
2
,
1
}
O
u
t
[
]
=
Using the Data to Create Images
Land Cover Type
To create maps that would allow for the analysis of the NASA data, a new image was created that combined the recolored image, a legend, and the percentage of the amount of each land type group for that country. Most of the code used in anyCountryLand[] was taken from previous variables.
Note: all variables below will not generate proper output.
Creates an association between the amount of pixels and its respective color
c
A
m
o
u
n
t
s
=
C
o
u
n
t
s
[
R
G
B
C
o
l
o
r
/
@
S
e
l
e
c
t
[
P
i
x
e
l
V
a
l
u
e
[
c
I
M
G
,
{
A
l
l
,
A
l
l
}
]
,
#
[
[
4
]
]
>
.
0
5
&
]
]
;
Yields the colored image along with a color legend and the percentages of each land cover type:
C
o
l
u
m
n
[
{
L
e
g
e
n
d
e
d
[
c
I
M
G
,
T
a
b
l
e
[
S
w
a
t
c
h
L
e
g
e
n
d
[
{
n
e
w
C
o
l
o
r
S
c
h
e
m
e
[
[
n
]
]
}
,
{
K
e
y
s
[
n
e
w
C
o
l
o
r
S
c
h
e
m
e
]
[
[
n
]
]
}
]
(
*
c
r
e
a
t
e
s
s
i
d
e
l
e
g
e
n
d
*
)
,
{
n
,
L
e
n
g
t
h
[
n
e
w
C
o
l
o
r
S
c
h
e
m
e
]
}
]
]
,
P
e
r
c
e
n
t
F
o
r
m
[
S
o
r
t
[
N
[
#
/
(
T
o
t
a
l
[
c
A
m
o
u
n
t
s
]
)
&
/
@
c
A
m
o
u
n
t
s
]
,
G
r
e
a
t
e
r
]
]
(
*
c
r
e
a
t
e
s
p
e
r
c
e
n
t
a
g
e
s
*
)
}
]
Develops an image that displays a map, legend, and percentages based on the land cover type data in the United States in 2001:
a
n
y
C
o
u
n
t
r
y
L
a
n
d
[
c
o
u
n
t
r
y
_
,
y
e
a
r
_
]
:
=
M
o
d
u
l
e
{
i
M
G
,
m
a
s
k
,
c
L
a
n
d
,
f
o
r
e
s
t
C
o
l
o
r
,
s
h
r
u
b
C
o
l
o
r
,
c
r
o
p
C
o
l
o
r
,
s
a
v
a
n
n
a
C
o
l
o
r
,
n
e
w
C
o
l
o
r
S
c
h
e
m
e
,
c
I
M
G
,
c
A
m
o
u
n
t
s
}
,
i
M
G
=
(
*
o
r
i
g
i
n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
n
n
a
C
o
l
o
r
,
c
r
o
p
C
o
l
o
r
,
c
r
o
p
C
o
l
o
r
,
s
h
r
u
b
C
o
l
o
r
,
s
h
r
u
b
C
o
l
o
r
,
M
a
g
e
n
t
a
,
R
e
d
,
O
r
a
n
g
e
,
,
{
.
0
4
,
.
3
1
,
.
0
5
,
.
0
5
,
.
0
5
,
.
0
5
,
.
0
5
,
.
0
3
,
.
2
,
.
2
,
1
}
;
c
A
m
o
u
n
t
s
=
C
o
u
n
t
s
[
R
G
B
C
o
l
o
r
/
@
S
e
l
e
c
t
[
P
i
x
e
l
V
a
l
u
e
[
c
I
M
G
,
{
A
l
l
,
A
l
l
}
]
,
#
[
[
4
]
]
>
.
0
5
&
]
]
;
C
o
l
u
m
n
[
{
L
e
g
e
n
d
e
d
[
c
I
M
G
,
T
a
b
l
e
[
S
w
a
t
c
h
L
e
g
e
n
d
[
{
n
e
w
C
o
l
o
r
S
c
h
e
m
e
[
[
n
]
]
}
,
{
K
e
y
s
[
n
e
w
C
o
l
o
r
S
c
h
e
m
e
]
[
[
n
]
]
}
]
(
*
c
r
e
a
t
e
s
s
i
d
e
l
e
g
e
n
d
*
)
,
{
n
,
L
e
n
g
t
h
[
n
e
w
C
o
l
o
r
S
c
h
e
m
e
]
}
]
]
,
P
e
r
c
e
n
t
F
o
r
m
[
S
o
r
t
[
N
[
#
/
(
T
o
t
a
l
[
c
A
m
o
u
n
t
s
]
)
&
/
@
c
A
m
o
u
n
t
s
]
,
G
r
e
a
t
e
r
]
]
(
*
c
r
e
a
t
e
s
p
e
r
c
e
n
t
a
g
e
s
*
)
}
]
a
n
y
C
o
u
n
t
r
y
L
a
n
d
U
n
i
t
e
d
S
t
a
t
e
s
C
O
U
N
T
R
Y
,
2
0
0
1
The anyCountryLand[] function was then used to construct a ListAnimate[] that presented the same data for multiple years. The function allows the user to see data from 2001, 2010, and 2017. These dates were chosen to demonstrate change over time while accounting for many years taking a longer time to run.
Constructs an interactive animation of the land cover type of the United States during the years 2001, 2009, and 2017:
a
n
y
C
o
u
n
t
r
y
L
a
n
d
L
A
[
c
o
u
n
t
r
y
_
]
:
=
L
i
s
t
A
n
i
m
a
t
e
[
a
n
y
C
o
u
n
t
r
y
L
a
n
d
[
c
o
u
n
t
r
y
,
#
]
&
/
@
{
2
0
0
1
,
2
0
0
9
,
2
0
1
7
}
,
A
n
i
m
a
t
i
o
n
R
u
n
n
i
n
g
F
a
l
s
e
]
a
n
y
C
o
u
n
t
r
y
L
a
n
d
L
A
U
n
i
t
e
d
S
t
a
t
e
s
C
O
U
N
T
R
Y
O
u
t
[
]
=
Monthly Carbon Monoxide Emissions
The images created for the carbon monoxide emissions are extremely similar to the ones created for the land cover type data. Using a related strategy for producing the anyCountryLand[] function, the anyCountryCarbon[] function uses the GeoImage, mask, and masked image. While the images with land type data needed to be recolored, the carbon images were not for this function because a Count[] of the pixels was not taken yet. Using carbon data from the NASA site, a legend was created that corresponded the pixel colors to a specific value measured in kg/m^2/s.
Note: all variables below will not generate proper output.
Constructs a number to color association that is used as a legend:
c
L
e
g
e
n
d
=
D
r
o
p
[
A
s
s
o
c
i
a
t
i
o
n
M
a
p
[
R
e
v
e
r
s
e
,
A
s
s
o
c
i
a
t
i
o
n
@
C
a
s
e
s
[
I
m
p
o
r
t
[
"
h
t
t
p
s
:
/
/
g
i
b
s
.
e
a
r
t
h
d
a
t
a
.
n
a
s
a
.
g
o
v
/
c
o
l
o
r
m
a
p
s
/
v
1
.
3
/
M
E
R
R
A
2
_
C
a
r
b
o
n
_
M
o
n
o
x
i
d
e
_
E
m
i
s
s
i
o
n
_
M
o
n
t
h
l
y
.
x
m
l
"
]
,
X
M
L
E
l
e
m
e
n
t
[
"
L
e
g
e
n
d
E
n
t
r
y
"
,
{
"
r
g
b
"
c
o
l
o
r
_
,
"
t
o
o
l
t
i
p
"
n
a
m
e
_
,
"
i
d
"
_
}
,
{
}
]
T
o
E
x
p
r
e
s
s
i
o
n
/
@
S
t
r
i
n
g
S
p
l
i
t
[
c
o
l
o
r
,
"
,
"
]
n
a
m
e
,
I
n
f
i
n
i
t
y
]
]
,
2
]
;
Rearranges above output into a new association (color to number):
c
o
l
o
r
S
c
h
e
m
e
C
a
r
b
o
n
=
A
s
s
o
c
i
a
t
i
o
n
T
h
r
e
a
d
[
V
a
l
u
e
s
[
R
G
B
C
o
l
o
r
/
@
(
c
L
e
g
e
n
d
/
2
5
5
)
]
R
e
p
l
a
c
e
P
a
r
t
[
T
a
k
e
[
F
l
a
t
t
e
n
[
S
t
r
i
n
g
S
p
l
i
t
[
#
,
"
-
"
]
&
/
@
K
e
y
s
[
c
L
e
g
e
n
d
]
]
,
{
1
,
-
1
,
2
}
]
,
-
1
"
1
.
0
0
e
-
0
9
"
]
]
;
Produces a gradient legend using the input above to create labels:
c
a
r
b
o
n
L
e
g
e
n
d
=
L
a
b
e
l
e
d
[
L
i
n
e
a
r
G
r
a
d
i
e
n
t
I
m
a
g
e
[
K
e
y
s
[
c
o
l
o
r
S
c
h
e
m
e
C
a
r
b
o
n
]
,
{
1
5
0
,
5
0
}
]
,
T
a
b
l
e
[
V
a
l
u
e
s
[
c
o
l
o
r
S
c
h
e
m
e
C
a
r
b
o
n
[
[
{
1
,
-
1
}
]
]
]
[
[
n
]
]
<
>
"
k
g
/
m
^
2
/
s
"
,
{
n
,
1
,
2
}
]
(
*
l
a
b
e
l
*
)
,
{
{
B
o
t
t
o
m
,
L
e
f
t
}
,
{
T
o
p
,
R
i
g
h
t
}
}
,
L
a
b
e
l
S
t
y
l
e
D
i
r
e
c
t
i
v
e
[
B
o
l
d
,
8
]
]
;
Produces expected outputted image with a legend:
L
e
g
e
n
d
e
d
[
B
r
i
g
h
t
n
e
s
s
E
q
u
a
l
i
z
e
[
I
m
a
g
e
A
p
p
l
y
[
1
-
#
&
,
c
a
r
b
I
M
G
,
M
a
s
k
i
n
g
c
a
r
b
M
a
s
k
]
,
1
]
,
c
a
r
b
o
n
L
e
g
e
n
d
]
Yields an image of Turkey with colors that correspond to the amount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
.
0
0
e
-
0
9
"
]
]
;
c
a
r
b
o
n
L
e
g
e
n
d
=
(
*
c
r
e
a
t
e
s
t
h
e
l
e
g
e
n
d
*
)
L
a
b
e
l
e
d
[
L
i
n
e
a
r
G
r
a
d
i
e
n
t
I
m
a
g
e
[
K
e
y
s
[
c
o
l
o
r
S
c
h
e
m
e
C
a
r
b
o
n
]
,
{
1
5
0
,
5
0
}
]
,
T
a
b
l
e
[
V
a
l
u
e
s
[
c
o
l
o
r
S
c
h
e
m
e
C
a
r
b
o
n
[
[
{
1
,
-
1
}
]
]
]
[
[
n
]
]
<
>
"
k
g
/
m
^
2
/
s
"
,
{
n
,
1
,
2
}
]
(
*
l
a
b
e
l
*
)
,
{
{
B
o
t
t
o
m
,
L
e
f
t
}
,
{
T
o
p
,
R
i
g
h
t
}
}
,
L
a
b
e
l
S
t
y
l
e
D
i
r
e
c
t
i
v
e
[
B
o
l
d
,
8
]
]
;
L
e
g
e
n
d
e
d
[
B
r
i
g
h
t
n
e
s
s
E
q
u
a
l
i
z
e
[
I
m
a
g
e
A
p
p
l
y
[
1
-
#
&
,
c
a
r
b
I
M
G
,
M
a
s
k
i
n
g
c
a
r
b
M
a
s
k
]
,
1
]
(
*
c
r
e
a
t
e
s
o
u
t
p
u
t
e
d
i
m
a
g
e
*
)
,
c
a
r
b
o
n
L
e
g
e
n
d
]
]
a
n
y
C
o
u
n
t
r
y
C
a
r
b
o
n
T
u
r
k
e
y
C
O
U
N
T
R
Y
,
2
0
0
7
O
u
t
[
]
=
The anyCountryCarbon[] function was then used to produce another function similar to the anyCountryLandLA[] function. However, instead of showing land cover types and their percentages, it shows a map of carbon monoxide levels over the same years (2001, 2009, and 2017).
Generates an interactive list animation of carbon monoxide emissions in Turkey during the years 2001, 2009, and 2017:
a
n
y
C
o
u
n
t
r
y
C
a
r
b
o
n
L
A
[
c
o
u
n
t
r
y
_
]
:
=
L
i
s
t
A
n
i
m
a
t
e
a
n
y
C
o
u
n
t
r
y
C
a
r
b
o
n
T
u
r
k
e
y
C
O
U
N
T
R
Y
,
#
&
/
@
{
2
0
0
1
,
2
0
0
9
,
2
0
1
7
}
,
A
n
i
m
a
t
i
o
n
R
u
n
n
i
n
g
F
a
l
s
e
,
F
r
a
m
e
M
a
r
g
i
n
s
S
m
a
l
l
O
u
t
[
]
=
Comparing Data Through Graphs
To investigate the correlation between land coverage type and carbon monoxide emissions, plots of the two data sets were produced.
Land Type Cover Values
To extract the data from the land cover type images, a similar process as anyCountryLand[] was used to create numsLand[]. Using the recolored image, the pixel values were grouped together by color which corresponded to a land type. numsLand[] takes in a specified country, year, and land type(s). The generated values are created by counting the number of pixels from a user-specified land cover type (item) and extracted from cAmounts.
However, after counting the amount of pixels per land type in the image, the colors shifted again. To solve this problem, FindMatchingColor[] was used to find the closest color in the cAmounts association to the colors in the masked image. The named colors from the masked image are called based on the user's input into item_ and is combined with the string "Color".
For item_, a list of land cover types, with all lower case letters, must be entered (i.e. {"forest","crop"}). The user can choose from any of the items: forest, shrub, crop, savanna, urban, and grassland. While the function itself does not produce percentage values, PercentForm[] can be mapped across the output to display these values.
Note: all of the code below besides numsLand[] will not generate proper output.
Finds the nearest color in the cAmounts association to the colors in the masked image and divides by the total amount of colored pixels:
N
[
(
T
a
b
l
e
[
c
A
m
o
u
n
t
s
[
F
i
n
d
M
a
t
c
h
i
n
g
C
o
l
o
r
[
K
e
y
s
[
c
A
m
o
u
n
t
s
]
,
T
o
E
x
p
r
e
s
s
i
o
n
[
i
t
e
m
[
[
n
]
]
<
>
"
C
o
l
o
r
"
]
]
]
,
{
n
,
L
e
n
g
t
h
[
i
t
e
m
]
}
]
)
/
T
o
t
a
l
[
c
A
m
o
u
n
t
s
]
]
Generates the percentages of the land cover types: savannas, forests, and crops in Brazil during 2014:
n
u
m
s
L
a
n
d
[
c
o
u
n
t
r
y
_
,
y
e
a
r
_
,
i
t
e
m
_
]
:
=
M
o
d
u
l
e
{
i
M
G
,
m
a
s
k
,
c
L
a
n
d
,
f
o
r
e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
C
o
l
o
r
,
,
{
.
0
4
,
.
3
1
,
.
0
5
,
.
0
5
,
.
0
5
,
.
0
5
,
.
0
5
,
.
0
3
,
.
2
,
.
2
,
1
}
;
c
A
m
o
u
n
t
s
=
C
o
u
n
t
s
[
R
G
B
C
o
l
o
r
/
@
S
e
l
e
c
t
[
P
i
x
e
l
V
a
l
u
e
[
c
I
M
G
,
{
A
l
l
,
A
l
l
}
]
,
#
[
[
4
]
]
>
.
0
5
&
]
]
;
N
[
(
T
a
b
l
e
[
c
A
m
o
u
n
t
s
[
F
i
n
d
M
a
t
c
h
i
n
g
C
o
l
o
r
[
K
e
y
s
[
c
A
m
o
u
n
t
s
]
,
T
o
E
x
p
r
e
s
s
i
o
n
[
i
t
e
m
[
[
n
]
]
<
>
"
C
o
l
o
r
"
]
]
]
,
{
n
,
L
e
n
g
t
h
[
i
t
e
m
]
}
]
)
/
T
o
t
a
l
[
c
A
m
o
u
n
t
s
]
]
n
u
m
s
L
a
n
d
B
r
a
z
i
l
C
O
U
N
T
R
Y
,
2
0
1
4
,
{
"
s
a
v
a
n
n
a
"
,
"
f
o
r
e
s
t
"
,
"
c
r
o
p
"
}
{
2
8
.
9
8
%
,
4
3
.
8
6
%
,
2
8
.
9
8
%
}
O
u
t
[
]
=
Carbon Monoxide Emission Values
Similar to numsLand[], the numsCarb[] function used some of the same code from anyCountryCarbon[]. However, this function generates the average of carbon monoxide emissions for a specific year and country. Besides taking an average of the carbon monoxide emissions by correlating pixel color with emission amounts, the process is the same as numsLand[]. Also, as seen in numsLand[], the pixel colors changed when counted.
Note: all of the code below besides numsCarb[] will not generate proper output.
Creates an association between the amount of pixels and its respective color:
c
C
o
u
n
t
s
=
C
o
u
n
t
s
[
R
G
B
C
o
l
o
r
/
@
S
e
l
e
c
t
[
P
i
x
e
l
V
a
l
u
e
[
B
r
i
g
h
t
n
e
s
s
E
q
u
a
l
i
z
e
[
I
m
a
g
e
A
p
p
l
y
[
1
-
#
&
,
c
a
r
b
I
M
G
,
M
a
s
k
i
n
g
c
a
r
b
M
a
s
k
]
,
1
]
,
{
A
l
l
,
A
l
l
}
]
,
#
[
[
4
]
]
>
.
0
5
&
]
]
;
Finds the closest color in cCounts, to the original legend list:
c
o
l
o
r
s
C
a
r
b
o
n
=
F
i
n
d
M
a
t
c
h
i
n
g
C
o
l
o
r
[
K
e
y
s
[
c
o
l
o
r
S
c
h
e
m
e
C
a
r
b
o
n
]
,
#
]
&
/
@
K
e
y
s
[
c
C
o
u
n
t
s
]
;
Turns the values in colorsCarbon into numbers:
c
N
u
m
s
=
I
n
t
e
r
p
r
e
t
e
r
[
"
N
u
m
b
e
r
"
]
[
c
o
l
o
r
S
c
h
e
m
e
C
a
r
b
o
n
[
#
]
&
/
@
c
o
l
o
r
s
C
a
r
b
o
n
]
;
Generates the average carbon emissions for specified year:
(
T
o
t
a
l
[
V
a
l
u
e
s
[
c
C
o
u
n
t
s
]
*
c
N
u
m
s
]
)
/
(
T
o
t
a
l
[
c
C
o
u
n
t
s
]
)
Yields the average of carbon monoxide levels of China in 2009 :
n
u
m
s
C
a
r
b
[
c
o
u
n
t
r
y
_
,
y
e
a
r
_
]
:
=
M
o
d
u
l
e
[
{
c
a
r
b
I
M
G
,
c
a
r
b
M
a
s
k
,
c
L
e
g
e
n
d
,
c
o
l
o
r
S
c
h
e
m
e
C
a
r
b
o
n
,
c
a
r
b
o
n
L
e
g
e
n
d
,
c
C
o
u
n
t
s
,
c
o
l
o
r
s
C
a
r
b
o
n
,
c
N
u
m
s
}
,
c
a
r
b
I
M
G
=
(
*
o
r
i
g
i
n
a
l
i
m
a
g
e
o
f
c
o
u
n
t
r
y
w
i
t
h
d
a
t
a
*
)
G
e
o
I
m
a
g
e
[
G
e
o
R
a
n
g
e
c
o
u
n
t
r
y
,
G
e
o
S
e
r
v
e
r
l
a
y
e
r
G
e
o
S
e
r
v
e
r
[
"
M
E
R
R
A
2
_
C
a
r
b
o
n
_
M
o
n
o
x
i
d
e
_
E
m
i
s
s
i
o
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