---
title: "Getting Started with copernicusR"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Getting Started with copernicusR}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

> **Note:** The code examples below are not evaluated (`eval = FALSE`) to comply with CRAN policies.  
> They require internet access, user credentials for [Copernicus Marine Service](https://marine.copernicus.eu/),  
> and external Python dependencies, which are not permitted to run automatically in CRAN checks.

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  eval = FALSE
)
```

This vignette shows how to set up and use copernicusR to access Copernicus Marine data.

## Prerequisites
Before using this package, ensure that:
1. You have Python 3.7 or higher installed on your system.
2. You have a free Copernicus Marine account and valid credentials.
3. The copernicusmarine Python package is installed (handled via setup_copernicus()).

## Basic Setup

```{r setup}
library(copernicusR)

# Check if everything is ready
copernicus_is_ready()

# Set up using your credentials (replace with your actual values)
setup_copernicus(username = "<your_username>", password = "<your_password>")
```

## Download Example

```{r download}
# Download sea surface temperature
file <- copernicus_download(
  dataset_id = "cmems_mod_glo_phy_anfc_0.083deg_P1D-m",
  variables = "thetao",
  start_date = "2024-01-01",
  end_date = "2024-01-01",
  bbox = c(-10, 0, 35, 45),  # Mediterranean subset
  output_file = file.path(tempdir(), "test_download.nc")
)
```

