Skip to content

CST_PeriodPET(): Add longname and other variable metadata

Hi @tkariyat,

The function PeriodPET() computes Potential evapotranspiration (PET) using a set of variables provided by the user.

CST_PeriodPET() returns an s2dv_cube with metadata, but it does not return any metadata for the new variable, except for the varName 'PET'. It should return a PET item in the attrs$Variable$metadata list with at least the longname ("Potential evapotranspiration") and the units ("mm/month"? @allabres it would be great if you could confirm)

So basically after these lines:

  coords <- data[[1]]$coords
  Dates <- data[[1]]$attrs$Dates
  metadata <- data[[1]]$attrs$Variable$metadata

We should add something like:

data[[1]]$attrs$Variable$metadata[["PET"]]$longname <- "Potential evapotranspiration"
data[[1]]$attrs$Variable$metadata[["PET"]]$units <- "mm/month"

The metadata of the previous non-coordinate variable could also be removed.

Let me know if you need any clarification. I can also provide some sample data for you to test the changes.

Cheers,

Victòria

Edited by vagudets