Weiming-Hu / AnalogsEnsemble

The C++ and R packages for parallel ensemble forecasts using Analog Ensemble
https://weiming-hu.github.io/AnalogsEnsemble/
MIT License
18 stars 5 forks source link

RAnEn::readObservations and RAnEn::readForecasts need updating #94

Closed Weiming-Hu closed 4 years ago

Weiming-Hu commented 4 years ago

Since Forecasts and Observations now can be a sub-group in a NetCDF file, these two functions need to be able to handle that situation.

A possible solution is to define a variable prefix.

  # Check if Observations is the root group
  # If it is the root group, no variable prefix is needed
  # If it is not the root group, the variable prefix should be "Observations/"
  # 
  var_prefix <- ''
  if (any(grepl("^Observations", names(nc$var)))) {
    var_prefix <- 'Observations/'
  }
Weiming-Hu commented 4 years ago

Resolved in 91c45350fc0c7eb53e27df617f25db3ab47d9e0c