Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Smart_Agro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
28
Issues
28
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TMP-23-236
Smart_Agro
Commits
647f11f2
Commit
647f11f2
authored
Sep 07, 2023
by
pramod_a
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init commit smap_gis.js for SMAP implementation
parent
53423603
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
0 deletions
+77
-0
src/smap_gis.js
src/smap_gis.js
+77
-0
No files found.
src/smap_gis.js
0 → 100644
View file @
647f11f2
// Import shelf files
var
table
=
ee
.
FeatureCollection
(
"
projects/ee-arachchigepramod/assets/Mallawapitiya
"
);
// SMAP(Soil Moisture Active Passive)soil moisture data
// Extract & Visualize Monthly Time Series Analysis of SMAP soil moisture
// and export to your Google Drive as a CSV file
// 1. Define countries boundary
var
Countries
=
ee
.
FeatureCollection
(
'
USDOS/LSIB_SIMPLE/2017
'
);
// var roi = Countries.filter(ee.Filter.eq('country_na', 'South Sudan'));
var
roi
=
table
;
Map
.
addLayer
(
roi
,
{},
"
roi
"
);
Map
.
centerObject
(
roi
);
// 2. List of years
var
years
=
ee
.
List
.
sequence
(
2016
,
2021
);
var
months
=
ee
.
List
.
sequence
(
1
,
12
);
// 3. Load SMAP Data
var
coll
=
ee
.
ImageCollection
(
'
NASA_USDA/HSL/SMAP10KM_soil_moisture
'
).
select
(
'
ssm
'
);
print
(
coll
.
first
());
// 4. Set visualization parameter
var
soilVis
=
{
min
:
0.0
,
max
:
28.0
,
palette
:
[
'
0300ff
'
,
'
418504
'
,
'
efff07
'
,
'
efff07
'
,
'
ff0303
'
],
};
// 5. Center and add SMAP layer
Map
.
setCenter
(
17
,
13
,
2
);
// Zoom level ranges from 1 to 16
Map
.
addLayer
(
coll
.
mean
(),
soilVis
,
'
Soil Moisture
'
);
Map
.
addLayer
(
coll
.
mean
().
clip
(
roi
),
soilVis
,
'
Mallwapitiya Soil Moisture
'
);
// 6. Summaries our SMAP (Soil Moisture Active Passive) soil moisture data by month and year
var
smap
=
coll
.
select
(
'
ssm
'
)
.
map
(
function
(
img
){
var
d
=
ee
.
Date
(
ee
.
Number
(
img
.
get
(
'
system:time_start
'
)));
var
m
=
ee
.
Number
(
d
.
get
(
'
month
'
));
var
y
=
ee
.
Number
(
d
.
get
(
'
year
'
));
return
img
.
set
({
'
month
'
:
m
,
'
year
'
:
y
});
});
print
(
smap
.
first
());
// 7. Function generate monthly soil moisture data for each year
var
byYearMonth
=
ee
.
ImageCollection
.
fromImages
(
years
.
map
(
function
(
y
){
return
months
.
map
(
function
(
m
)
{
return
smap
.
filterMetadata
(
'
year
'
,
'
equals
'
,
y
)
.
filterMetadata
(
'
month
'
,
'
equals
'
,
m
)
.
select
(
'
ssm
'
).
mean
()
.
set
(
'
year
'
,
y
)
.
set
(
'
month
'
,
m
)
.
set
(
'
date
'
,
ee
.
Date
.
fromYMD
(
y
,
m
,
1
));
});
}).
flatten
()
);
print
(
"
monthlyCol
"
,
byYearMonth
.
first
());
// 8. Zonal statistics to sumarries SMAP soil moisture to specific study area (eg South Sudan)
var
smapSouth_Sudan
=
byYearMonth
.
map
(
function
(
img
)
{
var
features
=
roi
.
map
(
function
(
f
)
{
return
f
.
set
(
'
date
'
,
img
.
get
(
'
date
'
),
'
month
'
,
img
.
get
(
'
month
'
),
'
year
'
,
img
.
get
(
'
year
'
))})
var
proj
=
ee
.
Image
(
byYearMonth
.
first
()).
projection
();
return
img
.
reduceRegions
(
features
,
ee
.
Reducer
.
mean
(),
1000
,
proj
);
}).
flatten
();
print
(
"
SMAP Summary Mean
"
,
smapSouth_Sudan
.
limit
(
10
));
// 9. Export the resulting mean soil moisture as a table to Google Drive
var
selectors
=
"
year, month, country_na, mean
"
;
Export
.
table
.
toDrive
({
collection
:
smapSouth_Sudan
,
description
:
'
SMAP_Timeseries
'
,
folder
:
'
earth_engine_data
'
,
fileNamePrefix
:
'
SMAP_Timeseries
'
,
fileFormat
:
'
CSV
'
,
selectors
:
selectors
});
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment