1 Getting started

1.1 Obtaining and saving API Key

CMAP hosts data on a Microsoft SQL Server. To retrieve data from the database, cmap4r requires an API key. For this, the user needs to register on the SimonsCMAP website and navigate to the "APIKeys" tab on the webpage to obtain an API key. The package allows theĀ user to save the key as a keyring variable which will be used for data retrieval whenever required.

1.2 Installation and setup

First, open R in a command line or in an R console. In order to install the R package, first install the devtools R package using install.packages("devtools").

Next, install the cmap4r R package using devtools::install_github("simonscmap/cmap4r/cmap4r"). There are some other dependencies to install as well:

## Package for data processing:
install.packages("dplyr")  

## Packages for visualization:
install.packages("ggplot2")
install.packages("plotly")

Now, in your R session, run set_authorization() to set/reset the API Key. You will be prompted to enter the key on the command line or in a pop-up prompt. Alternatively, you can attempt to use any of the functions (e.g. get_catalog()) and you will be prompted to enter the key.

1.3 Catalog of data

You can obtain the latest version of the data catalog for the CMAP data (https://cmap.readthedocs.io/en/latest/catalog/catalog.html) to R using get_catalog(), partially reproduced here.

get_catalog() %>%
  select(Variable, Table_Name, Unit, Sensor, Unit) %>%
  head(20) %>%
  kable()
Variable Table_Name Unit Sensor
vgosa tblAltimetry_REP m/s Satellite
vgos tblAltimetry_REP m/s Satellite
sla tblAltimetry_REP m Satellite
adt tblAltimetry_REP m Satellite
ugosa tblAltimetry_REP m/s Satellite
ugos tblAltimetry_REP m/s Satellite
wind_speed_rms tblWind_NRT m/s Satellite
eastward_wind_rms tblWind_NRT m/s Satellite
wind_stress tblWind_NRT Pa Satellite
eastward_wind tblWind_NRT m/s Satellite
surface_downward_eastward_stress tblWind_NRT Pa Satellite
wind_speed tblWind_NRT m/s Satellite
surface_downward_northward_stress tblWind_NRT Pa Satellite
northward_wind tblWind_NRT m/s Satellite
northward_wind_rms tblWind_NRT m/s Satellite
sst tblSST_AVHRR_OI_NRT C Satellite
ftle_bw_sla tblLCS_REP 1/day Satellite
disp_bw_sla tblLCS_REP deg Satellite
ftle_fw_sla tblLCS_REP 1/day Satellite
disp_fw_sla tblLCS_REP deg Satellite