|
REMORA
Regional Modeling of Oceans Refined Adaptively
|
#include <string>#include "REMORA_NCFile.H"#include "REMORA_NCInterface.H"#include "REMORA_TimeUnits.H"
Go to the source code of this file.
Functions | |
| std::string | ReadNetCDFVarAttrStr (const std::string &fname, const std::string &var_name, const std::string &attr_name) |
| Helper function for reading a single variable attribute. | |
| bool | QueryNetCDFVarAttrStr (const std::string &fname, const std::string &var_name, const std::string &attr_name) |
| Helper function for testing for the presence of a single variable attribute. | |
| double | ReadNetCDFTimeOffsetDays (const std::string &fname, const std::string &time_name, double time_ref, bool units_required, bool announce) |
| Offset, in days, that puts a file's time variable onto the model clock. | |
| bool | QueryNetCDFHasVars (const std::string &fname, const amrex::Vector< std::string > &var_names) |
| Helper function for testing whether a file carries every named variable. | |
| bool QueryNetCDFHasVars | ( | const std::string & | fname, |
| const amrex::Vector< std::string > & | var_names | ||
| ) |
Helper function for testing whether a file carries every named variable.
| fname | Name of NetCDF file |
| var_names | Names of the variables to test for |
Use this before calling BuildFABsFromNetCDFFile() on optional variables: ReadNetCDFFile() calls ncf.var(name) unconditionally, so a missing variable is a hard failure rather than a recoverable one. The answer is broadcast so every rank agrees before any collective read is attempted.
Definition at line 150 of file REMORA_NCFile.cpp.
Referenced by REMORA::init_only(), NCTimeSeriesBoundary::Initialize(), read_clim_nudg_coeff_from_netcdf(), and read_spherical_grid_vars_from_netcdf().


| bool QueryNetCDFVarAttrStr | ( | const std::string & | fname, |
| const std::string & | var_name, | ||
| const std::string & | attr_name | ||
| ) |
Helper function for testing for the presence of a single variable attribute.
| fname | Name of NetCDF file |
| var_name | Name of variable |
| attr_name | Name of attribute to read |
Definition at line 41 of file REMORA_NCFile.cpp.

| double ReadNetCDFTimeOffsetDays | ( | const std::string & | fname, |
| const std::string & | time_name, | ||
| double | time_ref, | ||
| bool | units_required, | ||
| bool | announce | ||
| ) |
Offset, in days, that puts a file's time variable onto the model clock.
Reads the units attribute of time_name, which must count days, and its calendar attribute if it has one. A days since <date> reference date is converted to days since the date remora.time_ref names, so a file whose epoch differs from the run's is still read at the right time; the offset is zero when the two dates agree. A time variable with no reference date is taken to be on the model clock already. A calendar that disagrees with time_ref is an error, since the two would count days differently.
Collective: the attributes are read on the I/O processor and the result is broadcast. The mapping applied is printed, so a reader of the log can see it.
| [in] | fname | NetCDF file |
| [in] | time_name | name of the time variable |
| [in] | time_ref | remora.time_ref |
| [in] | units_required | abort when the time variable has no units attribute; otherwise warn and assume days on the model clock |
| [in] | announce | print the mapping; false for a series that is set up but will never be read |
Definition at line 61 of file REMORA_NCFile.cpp.
Referenced by NCTimeSeries::Initialize(), NCTimeSeriesBoundary::Initialize(), and NCTimeSeriesRiver::Initialize().


| std::string ReadNetCDFVarAttrStr | ( | const std::string & | fname, |
| const std::string & | var_name, | ||
| const std::string & | attr_name | ||
| ) |
Helper function for reading a single variable attribute.
| fname | Name of NetCDF file |
| var_name | Name of variable |
| attr_name | Name of attribute to read |
Definition at line 14 of file REMORA_NCFile.cpp.
