REMORA
Regional Modeling of Oceans Refined Adaptively
Loading...
Searching...
No Matches
REMORA_NCFile.H File Reference
#include <sstream>
#include <string>
#include <ctime>
#include <atomic>
#include "AMReX_FArrayBox.H"
#include "AMReX_IArrayBox.H"
#include "REMORA_NCInterface.H"
Include dependency graph for REMORA_NCFile.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  NDArray< DataType >
 NDArray is the datatype designed to hold any data, including scalars, multidimensional arrays, that read from the NetCDF file. More...
 

Typedefs

using PlaneVector = amrex::Vector< amrex::FArrayBox >
 

Enumerations

enum class  NC_Data_Dims_Type {
  Time_BT_SN_WE , Time_SN_WE , BT_SN_WE , SN_WE ,
  Time_BT_Riv , Time_Riv , BT_Riv
}
 

Functions

template<typename DType >
void ReadNetCDFFile (const std::string &fname, amrex::Vector< std::string > names, amrex::Vector< NDArray< DType > > &arrays, bool one_time=false, int fill_time=0)
 Read in data from netcdf file and save to data arrays.
 
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.
 
template<class FAB , typename DType >
void fill_fab_from_arrays (int iv, amrex::Vector< NDArray< amrex::Real > > &nc_arrays, const std::string &var_name, NC_Data_Dims_Type &NC_dim_type, FAB &temp)
 Helper function for reading data from NetCDF file into a provided FAB.
 
template<class FAB , typename DType >
void BuildFABsFromNetCDFFile (const amrex::Box &domain, const std::string &fname, amrex::Vector< std::string > nc_var_names, amrex::Vector< enum NC_Data_Dims_Type > NC_dim_types, amrex::Vector< FAB * > fab_vars, bool one_time=false, int fill_time=0)
 Function to read NetCDF variables and fill the corresponding Array4's.
 

Typedef Documentation

◆ PlaneVector

using PlaneVector = amrex::Vector<amrex::FArrayBox>

Definition at line 14 of file REMORA_NCFile.H.

Enumeration Type Documentation

◆ NC_Data_Dims_Type

enum class NC_Data_Dims_Type
strong
Enumerator
Time_BT_SN_WE 
Time_SN_WE 
BT_SN_WE 
SN_WE 
Time_BT_Riv 
Time_Riv 
BT_Riv 

Definition at line 16 of file REMORA_NCFile.H.

Function Documentation

◆ BuildFABsFromNetCDFFile()

template<class FAB , typename DType >
void BuildFABsFromNetCDFFile ( const amrex::Box &  domain,
const std::string &  fname,
amrex::Vector< std::string >  nc_var_names,
amrex::Vector< enum NC_Data_Dims_Type NC_dim_types,
amrex::Vector< FAB * >  fab_vars,
bool  one_time = false,
int  fill_time = 0 
)

Function to read NetCDF variables and fill the corresponding Array4's.

Parameters
fnameName of the NetCDF file to be read
nc_var_namesVariable names in the NetCDF file
NC_dim_typesNetCDF data dimension types
fab_varsFab data we are to fill
one_timeWhether to read in a single time step from file
fill_timeWhat time step to read from file, if only reading one step

Definition at line 312 of file REMORA_NCFile.H.

Here is the call graph for this function:

◆ fill_fab_from_arrays()

template<class FAB , typename DType >
void fill_fab_from_arrays ( int  iv,
amrex::Vector< NDArray< amrex::Real > > &  nc_arrays,
const std::string &  var_name,
NC_Data_Dims_Type NC_dim_type,
FAB &  temp 
)

Helper function for reading data from NetCDF file into a provided FAB.

Parameters
ivIndex for which variable we are going to fill
nc_arraysArrays of data from NetCDF file
var_nameVariable name
NC_dim_typeDimension type for the variable as stored in the NetCDF file
tempFAB where we store the variable data from the NetCDF Arrays

Definition at line 195 of file REMORA_NCFile.H.

◆ ReadNetCDFFile()

template<typename DType >
void ReadNetCDFFile ( const std::string &  fname,
amrex::Vector< std::string >  names,
amrex::Vector< NDArray< DType > > &  arrays,
bool  one_time = false,
int  fill_time = 0 
)

Read in data from netcdf file and save to data arrays.

Parameters
[in]fnamefile name to read from
[in]namesfield names to read
[in,out]arraysvector of data arrays to fill
[in]one_timewhether to read in a single time step of data
[in]fill_timeif reading a single time, what time step to read from the file?

Definition at line 119 of file REMORA_NCFile.H.

Referenced by BuildFABsFromNetCDFFile(), NCTimeSeries::Initialize(), NCTimeSeriesRiver::Initialize(), read_bdry_from_netcdf(), and read_vec_from_netcdf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadNetCDFVarAttrStr()

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.

Parameters
fnameName of NetCDF file
var_nameName of variable
attr_nameName of attribute to read
Returns
attribute value

Definition at line 13 of file REMORA_NCFile.cpp.

Referenced by NCTimeSeries::Initialize(), NCTimeSeriesRiver::Initialize(), and read_bdry_from_netcdf().

Here is the call graph for this function:
Here is the caller graph for this function: