View source: R/download_Copernicus.R
downloadCopernicus | R Documentation |
Download products from Copernicus Marine Environment Monitoring Service (CMEMS). More information about the available data in https://marine.copernicus.eu/.
downloadCopernicus(startDate, endDate, time, time2=NULL, var, minDepth=0.493, maxDepth=0.4942,
outDir, outName, Cuser, Cpssw, Cproduct, CproductId, maxLon, minLon, maxLat, minLat,
frequency = c("daily", "all"), parallel=FALSE, numCores=NULL)
startDate |
Date or character, indicating the begin date to extract the data (Format [yyyy:mm:dd]). |
endDate |
Date or character, indicating the end date to extract the data (Format [yyyy:mm:dd]). |
time |
character, indicating the hours, minutes, and seconds of the startDate (Format [HH:MM:SS]). |
time2 |
character, indicating the hours, minutes, and seconds of the endDate (Format [HH:MM:SS]).
If missing |
var |
Character with the variable name (Only one variable is allowed). |
minDepth |
Numeric value specifying the minimum depth. Allowed interval [0 ; 2e31] |
maxDepth |
Numeric value specifying the maximum depth. Allowed interval [0 ; 2e31] |
outDir |
Character with the output path where downloaded files should be stored. |
outName |
Character indicating the output file name. |
Cuser |
Character with the CMEMS user name. |
Cpssw |
Character with the CMEMS password. |
Cproduct |
Character with the CMEMS service id. |
CproductId |
Character with the CMEMS product id. |
maxLon |
Max. longitude of the area/region to extract. Allowed interval [-180 ; 180] |
minLon |
Min. longitude of the area/region to extract. Allowed interval [-180 ; 180] |
maxLat |
Max. latitude of the area/region to extract. Allowed interval [-90 ; 90] |
minLat |
Min. latitude of the area/region to extract. Allowed interval [-90 ; 90] |
frequency |
Select the download frequency between 'daily' and 'all'. 'daily' will download one file per day, whereas 'all' will download all the data in one file. |
parallel |
An optional logical argument indicating whether the download should be run in parallel or not. Default |
numCores |
An integer indicating the number of cores to be used in parallel execution |
Python and motuclient are needed. To check if both are correctly installed run:
system("python --version")
and system("motuclient --version")
.
If target files are already present in the outDir
folder, they are not downloaded.
More information:
If 'parallel'=TRUE then the 'parallel' / 'doParallel' / 'foreach' / 'doRNG' packages will be used to run the computation over multiple cores of the computer. To use this component you need to install those packages using: 'install.packages(c("foreach", "doParallel", "doRNG"))' It is advised that you do not set 'cores' to be greater than one less than the number of cores on your machine.
## Not run:
# Python command generated by CMEMS. Frther information in:
https://help.marine.copernicus.eu/en/articles/4899195-how-to-write-and-run-a-script-to-download-a-subset-of-a-dataset-from-the-copernicus-marine-data-store
command = "python -m motuclient --motu https://nrt.cmems-du.eu/motu-web/Motu
--service-id GLOBAL_ANALYSIS_FORECAST_WAV_001_027-TDS --product-id global-analysis-forecast-wav-001-027
--longitude-min -180 --longitude-max 79 --latitude-min -40 --latitude-max 90
--date-min '2021-11-25 00:00:00' --date-max '2021-11-25 00:00:00' --variable VHM0 --variable VHM0_SW1
--out-dir <OUTPUT_DIRECTORY> --out-name <OUTPUT_FILENAME> --user <USERNAME> --pwd <PASSWORD>"
system(command)
# Function inputs
startDate = "2021-01-01"
endDate = "2021-02-01"
time = "12:00:00"
var = "VHM0"
outDir = "C:/Use/Escritorio/tmp"
outName = "Global_"
Cuser = <your user name>
Cpssw = <your password>
Cproduct = "GLOBAL_ANALYSIS_FORECAST_WAV_001_027-TDS"
CproductId = "global-analysis-forecast-wav-001-027"
minLon = -75
maxLon = 20
minLat = -30
maxLat = 20
# Daily and in sequential
downloadCopernicus(startDate, endDate, time, var = var, outDir = outDir, outName = outName,
Cuser = Cuser, Cpssw = Cpssw, Cproduct = Cproduct, CproductId=CproductId,
maxLon = maxLon, minLon = minLon, maxLat = maxLat, minLat = minLat, frequency = "daily")
# All data together
downloadCopernicus(startDate, endDate, time, var = var, outDir = outDir, outName = outName,
Cuser = Cuser, Cpssw = Cpssw, Cproduct = Cproduct, CproductId=CproductId,
maxLon = maxLon, minLon = minLon, maxLat = maxLat, minLat = minLat, frequency = "all")
# Daily and in parallel
downloadCopernicus(startDate, endDate, time, var = var, outDir = outDir, outName = outName,
Cuser = Cuser, Cpssw = Cpssw, Cproduct = Cproduct, CproductId=CproductId,
maxLon = maxLon, minLon = minLon, maxLat = maxLat, minLat = minLat,
frequency = "daily", parallel = T, numCores = 4)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.