---
title: "Parquet files"
---

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

If you need to query several municipalities, indicators and zonal statistics, we recommend to download and locally query the parquet files using the `arrow` package. 

## BR-DWGD (13.65 GB)

-    Evapotranspiration: `r brclimr::brdwgd_data[["eto"]][["link"]]`
-    Precipitation: `r brclimr::brdwgd_data[["pr"]][["link"]]`
-    Relative Humidity: `r brclimr::brdwgd_data[["rh"]][["link"]]`
-    Solar radiation: `r brclimr::brdwgd_data[["rs"]][["link"]]`
-    Maximum temperature: `r brclimr::brdwgd_data[["tmax"]][["link"]]`
-    Minimum temperature: `r brclimr::brdwgd_data[["tmin"]][["link"]]`
-    Wind speed: `r brclimr::brdwgd_data[["u2"]][["link"]]`


## TerraClimate (1.02 GB)
-    Actual Evapotranspiration: `r brclimr::terraclimate_data[["aet"]][["link"]]`
-    Climate Water Deficit: `r brclimr::terraclimate_data[["def"]][["link"]]`
-    Potential evapotranspiration: `r brclimr::terraclimate_data[["pet"]][["link"]]`
-    Precipitation: `r brclimr::terraclimate_data[["ppt"]][["link"]]`
-    Runoff: `r brclimr::terraclimate_data[["q"]][["link"]]`
-    Soil Moisture: `r brclimr::terraclimate_data[["soil"]][["link"]]`
-    Downward surface shortwave radiation: `r brclimr::terraclimate_data[["srad"]][["link"]]`
-    Snow water equivalent: `r brclimr::terraclimate_data[["swe"]][["link"]]`
-    Max Temperature: `r brclimr::terraclimate_data[["tmax"]][["link"]]`
-    Min Temperature: `r brclimr::terraclimate_data[["tmin"]][["link"]]`
-    Vapor pressure: `r brclimr::terraclimate_data[["vap"]][["link"]]`
-    Wind speed: `r brclimr::terraclimate_data[["ws"]][["link"]]`
-    Vapor Pressure Deficit: `r brclimr::terraclimate_data[["vpd"]][["link"]]`
-    PDSI: `r brclimr::terraclimate_data[["pdsi"]][["link"]]`

## Query example

After downloading the parquets files, you can query them using the `arrow` package.

```{r eval=FALSE}
library(tidyverse)
library(arrow)

brdwgd <- open_dataset(sources = "/parquet/files/address/")

brdwgd %>%
  filter(code_muni %in% c(3105608, 3304557, 3136702)) %>%
  filter(name == "Tmax_mean") %>%
  filter(date >= as.Date("2008-01-01") & date <= as.Date("2008-12-31")) %>%
  select(code_muni, date, value) %>%
  collect()
```

