Skip to content
Permalink
Browse files

WIP

  • Loading branch information
ranghetti committed Aug 1, 2017
1 parent 3be0ace commit 0c00fc6bf07aed046b2b198e0278ab3264e5298a
@@ -113,7 +113,7 @@ MODIStsp <- function(gui = TRUE, options_file = NULL,
options_file <- test_files[test]
# Workaround: if a test with http download was selected,
# open the GUI so that the user can insert his credentials.
if (test == 4) {
if (test %in% c(4,5)) {
direct_username <- readline(prompt = "Enter your USGS username: ")
direct_password <- readline(prompt = "Enter your password: ")
}
@@ -4,20 +4,18 @@
"prod_version": "6",
"start_date": "2017-01-01",
"end_date": "2017-01-01",
"bandsel": [
1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
],
"bandsel": [ 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ],
"indexes_bandsel": 0,
"quality_bandsel": [
1, 0, 0, 0, 0, 1, 0, 0, 0, 0
],
"quality_bandsel": [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0 ],
"start_x": 14,
"end_x": 14,
"start_y": 4,
"end_y": 4,
"user": "",
"password": "",
"use_aria": false,
"download_server": "offline",
"download_range": "full",
"proj": "Sinusoidal",
"user_proj4": "+proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs",
"out_res_sel": "Native",
@@ -31,14 +29,12 @@
"None": "None"
},
"nodata_change": "No",
"scale_val": "No",
"delete_hdf": "No",
"reprocess": "Yes",
"bbox": [ 6.1126e+05, 4.9603e+06, 9.155e+05, 5.089e+06 ],
"out_folder": "$tempdir",
"out_folder_mod": "$modistest",
"MODIStspVersion": "1.3.3",
"custom_indexes": [],
"use_aria": false,
"download_range": "full",
"scale_val": "No"
"custom_indexes": []
}
@@ -13,28 +13,28 @@
"end_y": 4,
"user": "",
"password": "",
"use_aria": false,
"download_server": "offline",
"proj": "User Defined",
"user_proj4": "+init=epsg:32622 +proj=utm +zone=22 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0",
"download_range": "full",
"proj": "Sinusoidal",
"user_proj4": "+proj=utm +zone=22 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0",
"out_res_sel": "Resampled",
"out_res": "1000",
"full_ext": "Resized",
"resampling": "near",
"out_format": "GTiff",
"out_format": "ENVI",
"ts_format": "None",
"rts": "Yes",
"compress": {
"None": "None"
"High (DEFLATE)": "DEFLATE"
},
"nodata_change": "No",
"scale_val": "No",
"delete_hdf": "No",
"reprocess": "Yes",
"bbox": [ 2.5e+05, 5.15e+06, 3.8e+05, 5.35e+06 ],
"out_folder": "$tempdir",
"out_folder_mod": "$modistest",
"MODIStspVersion": "1.3.3",
"custom_indexes": [],
"use_aria": false,
"download_range": "full",
"scale_val": "No"
"custom_indexes": []
}
@@ -4,22 +4,18 @@
"prod_version": "6",
"start_date": "2017-07-10",
"end_date": "2017-07-15",
"bandsel": [
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
],
"indexes_bandsel": [
1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1
],
"quality_bandsel": [
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
],
"bandsel": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 ],
"indexes_bandsel": [ 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ],
"quality_bandsel": [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ],
"start_x": 18,
"end_x": 18,
"start_y": 4,
"end_y": 4,
"user": "",
"password": "",
"use_aria": false,
"download_server": "offline",
"download_range": "full",
"proj": "UTM 32N",
"user_proj4": "+init=epsg:32632 +proj=utm +zone=32 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0",
"out_res_sel": "Resampled",
@@ -33,12 +29,13 @@
"Medium (LZW)": "LZW"
},
"nodata_change": "Yes",
"scale_val": "Yes",
"delete_hdf": "No",
"reprocess": "Yes",
"bbox": [ 5.7e+05, 5.095e+06, 5.88e+05, 5.108e+06 ],
"out_folder": "$tempdir",
"out_folder_mod": "$modistest",
"MODIStspVersion": "1.3.3",
"MODIStspVersion": "1.3.2",
"custom_indexes": {
"Surf_Ref_8Days_500m (M*D09A1)": {
"6": {
@@ -49,7 +46,4 @@
}
}
},
"use_aria": false,
"download_range": "full",
"scale_val": "Yes"
}
@@ -4,20 +4,20 @@
"prod_version": "6",
"start_date": "2015-07-31",
"end_date": "2016-08-02",
"bandsel": [
1, 0
],
"bandsel": [ 1, 0 ],
"indexes_bandsel": 0,
"quality_bandsel": 0,
"start_x": 18,
"end_x": 18,
"start_y": 0,
"end_y": 1,
"user": "",
"password": "",
"user": "user",
"password": "password",
"use_aria": false,
"download_server": "http",
"proj": "User Defined",
"user_proj4": "+init=epsg:3995 +proj=stere +lat_0=90 +lat_ts=71 +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0",
"download_range": "seasonal",
"proj": "Latlon MODIS",
"user_proj4": "+proj=stere +lat_0=90 +lat_ts=71 +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0",
"out_res_sel": "Native",
"out_res": "native",
"full_ext": "Resized",
@@ -29,14 +29,12 @@
"None": "None"
},
"nodata_change": "No",
"scale_val": "No",
"delete_hdf": "No",
"reprocess": "Yes",
"bbox": [ 2e+05, -1.42e+06, 6.1e+05, -8.8e+05 ],
"out_folder": "$tempdir",
"out_folder_mod": "$modistest",
"out_folder_mod": "$tempdir",
"MODIStspVersion": "1.3.3",
"custom_indexes": [],
"use_aria": true,
"download_range": "seasonal",
"scale_val": "No"
"custom_indexes": []
}
@@ -1,42 +1,42 @@
{
"sel_prod": "LAI_8Days_500m (MCD15A2H)",
"sel_prod": "Albedo_Daily_500m (MCD43A3)",
"sensor": "Combined",
"prod_version": "6",
"start_date": "2016-07-16",
"end_date": "2016-07-31",
"start_date": "2017-07-19",
"end_date": "2017-07-19",
"bandsel": [
0, 1, 0, 0, 0, 0
0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
],
"indexes_bandsel": 0,
"quality_bandsel": [
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
],
"start_x": 18,
"end_x": 18,
"start_y": 0,
"end_y": 1,
"quality_bandsel": 0,
"start_x": 15,
"end_x": 15,
"start_y": 7,
"end_y": 7,
"user": "",
"password": "",
"download_server": "ftp",
"use_aria": false,
"download_server": "http",
"download_range": "full",
"proj": "User Defined",
"user_proj4": "+proj=stere +lat_0=90 +lat_ts=71 +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0",
"user_proj4": "+proj=lcc +lat_1=15 +lat_2=16.66666666666667 +lat_0=15.83333333333333 +lon_0=-24 +x_0=161587.83 +y_0=128511.202 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0",
"out_res_sel": "Native",
"out_res": "native",
"full_ext": "Resized",
"resampling": "near",
"out_format": "ENVI",
"ts_format": "ENVI Meta Files",
"rts": "Yes",
"compress": [ ],
"out_format": "GTiff",
"ts_format": "None",
"rts": "No",
"compress": {
"High (DEFLATE)": "DEFLATE"
},
"nodata_change": "No",
"scale_val": "No",
"delete_hdf": "No",
"reprocess": "Yes",
"bbox": [ 2e+05, -1.45e+06, 7e+05, -8.5e+05 ],
"reprocess": "No",
"bbox": [ 0, 0, 3.2e+05, 3e+05 ],
"out_folder": "$tempdir",
"out_folder_mod": "$modistest",
"MODIStspVersion": "1.3.3",
"custom_indexes": [],
"use_aria": false,
"download_range": "seasonal",
"scale_val": "Yes"
"MODIStspVersion": "1.3.2",
"custom_indexes": []
}
@@ -0,0 +1,40 @@
{
"sel_prod": "LAI_8Days_500m (MCD15A2H)",
"sensor": "Combined",
"prod_version": "6",
"start_date": "2016-07-16",
"end_date": "2016-07-31",
"bandsel": [ 0, 1, 0, 0, 0, 0 ],
"indexes_bandsel": 0,
"quality_bandsel": [ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ],
"start_x": 18,
"end_x": 18,
"start_y": 4,
"end_y": 5,
"user": "",
"password": "",
"use_aria": false,
"download_server": "ftp",
"download_range": "seasonal",
"proj": "Latlon WGS84",
"user_proj4": "+init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0",
"out_res_sel": "Resampled",
"out_res": "0.1",
"full_ext": "Resized",
"resampling": "near",
"out_format": "GTiff",
"ts_format": "GDAL vrt Files",
"rts": "Yes",
"compress": {
"Medium (LZW)": "LZW"
},
"nodata_change": "No",
"scale_val": "Yes",
"delete_hdf": "No",
"reprocess": "Yes",
"bbox": [ 3.77, 39.8, 4.34, 40.1 ],
"out_folder": "$tempdir",
"out_folder_mod": "$tempdir",
"MODIStspVersion": "1.3.3",
"custom_indexes": []
}
@@ -6,33 +6,61 @@ testthat::test_that(
# skip_on_cran()
skip_on_travis()

MODIStsp()
# MODIStsp()
#
# print("test-http")
# MODIStsp(gui = FALSE, options_file = system.file("ExtData/test_http.json", package = "MODIStsp"))

print("test-http")
MODIStsp(gui = FALSE, options_file = system.file("ExtData/test_http.json", package = "MODIStsp"))
### Test 1: test of the basic operations of MODIStsp. ###
# The test downloads two bands and extract one quality indicator from a single locale LST product
# (MOD11A2), without any additional preprocessing operation. Output files are in GeoTiff format.
cat("Test 1: basic extraction of bands and quality indicators\n")
MODIStsp(test = 1)

# What is this test ?
print("test1")
MODIStsp(test = 1)

# What is this test ?
print("test2")
### Test 2: test of geometric routines. ###
# The test works on the same local product of test 1, performing geometric operations (clipping,
# resampling resolution to 1000m. Output files are in ENVI format.
cat("Test 2: geometric operations\n")
MODIStsp(test = 2)

# What is this test ?
print("test3")
### Test 3: test of the creation of spectral indices and time series. ###
# The test work on a clipped SR local product (MOD09A1), acreating two defined spectral indices
# (NDVI and SAVI) and one custom index (GVMI). Geometric operations are performed like in
# test 2 (with a resampling to 250m resolution using mode), and processing options for time
# series creation are applied.
# Output files are in GeoTiff compressed format, with vrt time series.
cat("Test 3: spectral indices and creation of time series\n")
expect_warning(MODIStsp(test = 3))

# What is this test ?
### Test 4: test of HTTP download (from NSIDC) with seasonal period. ###
# This test downloads two snow cover products (MOD10CM) of 1st August of years 2015 and 2016,
# applying geometric operations (clipping and reprojecting).
# Output files and time series are in ENVI format.
# FIXME the test requires valid USGS credentials, which are asked in
# interactive mode. For this reason the test is excluded from testthat routines,
# and must be runned manually.
cat("Test 4: HTTP download from NSIDC and seasonal download\n")
cat("(skipped)\n")
# MODIStsp(test = 4)

# What is this test ?
print("test5")
expect_warning(MODIStsp(test = 5))
### Test 5: test of HTTP download (from USGS). ###
# This test downloads an albedo product (MCD43A3), clipping and reprojecting it.
# Output files and time series are in ENVI format.
# FIXME the test requires valid USGS credentials, which are asked in
# interactive mode. For this reason the test is excluded from testthat routines,
# and must be runned manually.
cat("Test 5: HTTP download from NSIDC and seasonal download\n")
cat("(skipped)\n")
# MODIStsp(test = 5)

### Test 6: test of FTP download and union of MODIS tiles ###
# This test download X LAI products (MCD15A2H) from FTP and merge them in a clipped
# overlapping area.
# After reprojection in geographic coordinates, output files are exported as GeoTiff
# (scaling output values) and vrt time series are created.
cat("Test 6: FTP download and union of MODIS tiles\n")
expect_warning(MODIStsp(test = 6))


# for (n in c(1:3,5)) { # test 4 (http) can not be runned in non-interactive mode
# cat("\nTest ",n,"...\n", sep = "")
# MODIStsp(test = n)
# }
}
)

0 comments on commit 0c00fc6

Please sign in to comment.
You can’t perform that action at this time.