MyNixOS website logo
Description

Acquire and Explore BEC-SMOS L4 Soil Moisture Data in R.

Provides functions that automate accessing, downloading and exploring Soil Moisture and Ocean Salinity (SMOS) Level 4 (L4) data developed by Barcelona Expert Center (BEC). Particularly, it includes functions to search for, acquire, extract, and plot BEC-SMOS L4 soil moisture data downscaled to ~1 km spatial resolution. Note that SMOS is one of Earth Explorer Opportunity missions by the European Space Agency (ESA). More information about SMOS products can be found at <https://earth.esa.int/eogateway/missions/smos/data>.

R-CMD-check

smosr

Acquire and Explore BEC-SMOS L4 Soil Moisture Data in R

Overview

The goal of smosr is to automate accessing, downloading and exploring Soil Moisture and Ocean Salinity (SMOS) Level 4 (L4) data developed by Barcelona Expert Center (BEC). Particularly, it includes functions to search for, acquire, extract, and plot BEC-SMOS L4 soil moisture data downscaled to ~1 km spatial resolution.

Installation

Install the released version of smosr from CRAN:

install.packages("smosr")

Development version

To get a bug fix or to use the newest features of the package, install the development version of smosr from GitHub:

# install.packages("devtools")
devtools::install_github("tshestakova/smosr")

Usage

library(smosr)

# # to set credentials for accessing the BEC server
# # note that "username" and "password" should be replaced with your login details 
# set_credentials("username", "password")

# to search for BEC-SMOS data with the specified parameters available on the server
start_date <- as.Date("2010-07-15")
end_date <- as.Date("2022-07-15")
date_range <- seq(start_date, end_date, by = 365)
smos_data <- find_smos(freq = 3, orbit = "des", dates = date_range)
#> Done. All requested files were successfully found.

# to download the data from the server to a temporary directory in a local computer
download_smos(data = smos_data)
#> |================================================================================| 100%

# to list all BEC-SMOS data files currently stored in the temporary directory
smos_files <- list_smos()
head(smos_files, 5)
#> [1] "C:/Users/.../Temp/RtmpInOFOr/BEC_SM____SMOS__EUM_L4__D_20100715T183618_001km_3d_REP_v6.0.nc"
#> [2] "C:/Users/.../Temp/RtmpInOFOr/BEC_SM____SMOS__EUM_L4__D_20110715T182802_001km_3d_REP_v6.0.nc"
#> [3] "C:/Users/.../Temp/RtmpInOFOr/BEC_SM____SMOS__EUM_L4__D_20120714T182030_001km_3d_REP_v6.0.nc"
#> [4] "C:/Users/.../Temp/RtmpInOFOr/BEC_SM____SMOS__EUM_L4__D_20130714T181231_001km_3d_REP_v6.0.nc"
#> [5] "C:/Users/.../Temp/RtmpInOFOr/BEC_SM____SMOS__EUM_L4__D_20140714T180441_001km_3d_REP_v6.0.nc"

# to extract soil moisture estimates for the specified geographical locations
# from the list of data files obtained in the previous steps
lat <- c(38.72, 41.90, 48.86, 52.50, 59.44)
lon <- c(-9.14, 12.50, 2.35, 13.40, 24.75)
sm_estimates <- extract_smos(data = smos_files, lat = lat, lon = lon)
#> |================================================================================| 100%

head(sm_estimates, 12)
#>       Lat     Lon     Freq Orbit Date         Time       SM                     QA
#>  [1,] "38.72" "-9.14" "3d" "D"   "2010-07-15" "20:36:18" "0.0176999995528604"   "5"
#>  [2,] "41.9"  "12.5"  "3d" "D"   "2010-07-15" "20:36:18" "0.0872999977946165"   "7"
#>  [3,] "48.86" "2.35"  "3d" "D"   "2010-07-15" "20:36:18" "0.206299994788424"    "2"
#>  [4,] "52.5"  "13.4"  "3d" "D"   "2010-07-15" "20:36:18" "0.191299995167356"    "6"
#>  [5,] "59.44" "24.75" "3d" "D"   "2010-07-15" "20:36:18" "0.165999995806487"    "7"
#>  [6,] "38.72" "-9.14" "3d" "D"   "2011-07-15" "20:28:02" "0.071999998181127"    "3"
#>  [7,] "41.9"  "12.5"  "3d" "D"   "2011-07-15" "20:28:02" "0.025399999358342"    "7"
#>  [8,] "48.86" "2.35"  "3d" "D"   "2011-07-15" "20:28:02" "0.0235999994038139"   "6"
#>  [9,] "52.5"  "13.4"  "3d" "D"   "2011-07-15" "20:28:02" "0.0769999980548164"   "2"
#> [10,] "59.44" "24.75" "3d" "D"   "2011-07-15" "20:28:02" "0.144699996344571"    "7"
#> [11,] "38.72" "-9.14" "3d" "D"   "2012-07-14" "20:20:31" "0.0246999993760255"   "5"
#> [12,] "41.9"  "12.5"  "3d" "D"   "2012-07-14" "20:20:31" "0.000499999987368938" "7"

# to plot extracted temporal series of soil moisture data
plot_temporal_smos(data = sm_estimates)
# to draw a raster image of soil moisture estimates from a file with
# desired data quality and within the specified geographical bounds
lat <- c(35.00, 45.00)
lon <- c(-10.50, 4.50)
plot_raster_smos(data = smos_files[13], lat = lat, lon = lon, QA = c(0,1,2,3))

Getting help

If you encounter a clear bug, please file an issue with a minimal reproducible example on GitHub.

For questions and other discussion, please use Stack Overflow and the RStudio community.

Metadata

Version

1.0.1

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows