File Read_netcdf.cu
FileList > src > Read_netcdf.cu
Go to the source code of this file
#include "Read_netcdf.h"
Public Functions
Type | Name |
---|---|
std::string | checkncvarname (int ncid, std::string stringA, std::string stringB, std::string stringC, std::string stringD, std::string stringE) Check for the existence of NetCDF variable names and return the first found. |
int | nc_get_var1_T (int ncid, int varid, const size_t * startp, float * zsa) |
int | nc_get_var1_T (int ncid, int varid, const size_t * startp, double * zsa) |
int | nc_get_var_T (int ncid, int varid, float *& zb) |
int | nc_get_var_T (int ncid, int varid, double *& zb) |
int | nc_get_var_T (int ncid, int varid, int *& zb) |
int | nc_get_vara_T (int ncid, int varid, const size_t * startp, const size_t * countp, int *& zb) |
int | nc_get_vara_T (int ncid, int varid, const size_t * startp, const size_t * countp, float *& zb) |
int | nc_get_vara_T (int ncid, int varid, const size_t * startp, const size_t * countp, double *& zb) |
void | read2Dnc (int nx, int ny, char ncfile, float *& hh) |
void | read3Dnc (int nx, int ny, int ntheta, char ncfile, float *& ee) |
void | readATMstep (forcingmap ATMPmap, int steptoread, float *& Po) Read atmospheric pressure data from NetCDF file for a specific time step. |
void | readWNDstep (forcingmap WNDUmap, forcingmap WNDVmap, int steptoread, float *& Uo, float *& Vo) Read wind data from NetCDF files for a specific time step. |
void | readgridncsize (const std::string ncfilestr, const std::string varstr, std::string reftime, int & nx, int & ny, int & nt, double & dx, double & dy, double & dt, double & xo, double & yo, double & to, double & xmax, double & ymax, double & tmax, bool & flipx, bool & flipy) Read grid size and metadata from a NetCDF file. |
void | readgridncsize (forcingmap & Fmap, Param XParam) Read grid size and metadata for a forcing map. |
void | readgridncsize (T & Imap) Read grid size and metadata for a generic map type. |
template void | readgridncsize< DynForcingP< float > > (DynForcingP< float > & Imap) |
template void | readgridncsize< StaticForcingP< float > > (StaticForcingP< float > & Imap) |
template void | readgridncsize< StaticForcingP< int > > (StaticForcingP< int > & Imap) |
template void | readgridncsize< deformmap< float > > (deformmap< float > & Imap) |
template void | readgridncsize< forcingmap > (forcingmap & Imap) |
template void | readgridncsize< inputmap > (inputmap & Imap) |
int | readncslev1 (std::string filename, std::string varstr, size_t indx, size_t indy, size_t indt, bool checkhh, double eps, T *& zsa) Read a single level of data from a NetCDF file. |
template int | readncslev1< double > (std::string filename, std::string varstr, size_t indx, size_t indy, size_t indt, bool checkhh, double eps, double *& zsa) |
template int | readncslev1< float > (std::string filename, std::string varstr, size_t indx, size_t indy, size_t indt, bool checkhh, double eps, float *& zsa) |
int | readnctime (std::string filename, double *& time) Read time variable from a NetCDF file. |
int | readnctime2 (int ncid, char * timecoordname, std::string refdate, size_t nt, double *& time) Read time variable from a NetCDF file with reference date. |
void | readnczb (int nx, int ny, std::string ncfile, float *& zb) |
int | readvardata (std::string filename, std::string Varname, int step, T *& vardata, bool flipx, bool flipy) Read variable data from a NetCDF file for a specific time step. |
template int | readvardata< double > (std::string filename, std::string Varname, int step, double *& vardata, bool flipx, bool flipy) |
template int | readvardata< float > (std::string filename, std::string Varname, int step, float *& vardata, bool flipx, bool flipy) |
template int | readvardata< int > (std::string filename, std::string Varname, int step, int *& vardata, bool flipx, bool flipy) |
int | readvarinfo (std::string filename, std::string Varname, size_t *& ddimU) Read variable dimension info from a NetCDF file. |
Public Functions Documentation
function checkncvarname
Check for the existence of NetCDF variable names and return the first found.
std::string checkncvarname (
int ncid,
std::string stringA,
std::string stringB,
std::string stringC,
std::string stringD,
std::string stringE
)
Checks up to five possible variable names in a NetCDF file and returns the first one that exists.
Parameters:
ncid
NetCDF file IDstringA
First variable name to checkstringB
Second variable name to checkstringC
Third variable name to checkstringD
Fourth variable name to checkstringE
Fifth variable name to check
Returns:
The first variable name found in the NetCDF file, or an empty string if none are found.
function nc_get_var1_T
function nc_get_var1_T
function nc_get_var_T
function nc_get_var_T
function nc_get_var_T
function nc_get_vara_T
inline int nc_get_vara_T (
int ncid,
int varid,
const size_t * startp,
const size_t * countp,
int *& zb
)
function nc_get_vara_T
inline int nc_get_vara_T (
int ncid,
int varid,
const size_t * startp,
const size_t * countp,
float *& zb
)
function nc_get_vara_T
inline int nc_get_vara_T (
int ncid,
int varid,
const size_t * startp,
const size_t * countp,
double *& zb
)
function read2Dnc
function read3Dnc
function readATMstep
Read atmospheric pressure data from NetCDF file for a specific time step.
Reads atmospheric pressure data from a NetCDF file for a given time step. Atm pressure is same as wind we only read floats and that is plenty for real world application.
Parameters:
ATMPmap
Forcing map for atmospheric pressuresteptoread
Time step to readPo
Output array for pressure data
function readWNDstep
Read wind data from NetCDF files for a specific time step.
void readWNDstep (
forcingmap WNDUmap,
forcingmap WNDVmap,
int steptoread,
float *& Uo,
float *& Vo
)
Reads U and V wind components from NetCDF files for a given time step. By default we want to read wind info as float because it will reside in a texture. the value is converted to the apropriate type only when it is used. so there is no need to template this function
Parameters:
WNDUmap
Forcing map for U windWNDVmap
Forcing map for V windsteptoread
Time step to readUo
Output array for U windVo
Output array for V wind
function readgridncsize
Read grid size and metadata from a NetCDF file.
void readgridncsize (
const std::string ncfilestr,
const std::string varstr,
std::string reftime,
int & nx,
int & ny,
int & nt,
double & dx,
double & dy,
double & dt,
double & xo,
double & yo,
double & to,
double & xmax,
double & ymax,
double & tmax,
bool & flipx,
bool & flipy
)
Reads dimensions, coordinates, and time information for a variable in a NetCDF file.
Parameters:
ncfilestr
NetCDF filenamevarstr
Variable namereftime
Reference time stringnx
Number of x grid pointsny
Number of y grid pointsnt
Number of time stepsdx
Grid spacing in xdy
Grid spacing in ydt
Time step sizexo
Origin xyo
Origin yto
Origin timexmax
Maximum xymax
Maximum ytmax
Maximum timeflipx
Flip x axisflipy
Flip y axis
function readgridncsize
Read grid size and metadata for a forcing map.
Reads grid size and metadata for a forcing map using model parameters.
Parameters:
function readgridncsize
Read grid size and metadata for a generic map type.
Reads grid size and metadata for a generic map type (inputmap, forcingmap, etc.).
Template parameters:
T
Map type
Parameters:
Imap
Map structure
function readgridncsize< DynForcingP< float > >
function readgridncsize< StaticForcingP< float > >
function readgridncsize< StaticForcingP< int > >
function readgridncsize< deformmap< float > >
function readgridncsize< forcingmap >
function readgridncsize< inputmap >
function readncslev1
Read a single level of data from a NetCDF file.
template<class T>
int readncslev1 (
std::string filename,
std::string varstr,
size_t indx,
size_t indy,
size_t indt,
bool checkhh,
double eps,
T *& zsa
)
Reads a single level of data for a variable from a NetCDF file.
Template parameters:
T
Data type
Parameters:
filename
NetCDF filenamevarstr
Variable nameindx
X indexindy
Y indexindt
Time indexcheckhh
Check for missing valueseps
Epsilon for missing value detectionzsa
Output array for data
Returns:
Status code
function readncslev1< double >
template int readncslev1< double > (
std::string filename,
std::string varstr,
size_t indx,
size_t indy,
size_t indt,
bool checkhh,
double eps,
double *& zsa
)
function readncslev1< float >
template int readncslev1< float > (
std::string filename,
std::string varstr,
size_t indx,
size_t indy,
size_t indt,
bool checkhh,
double eps,
float *& zsa
)
function readnctime
Read time variable from a NetCDF file.
Reads the time variable from a NetCDF file into a double array.
Parameters:
filename
NetCDF filenametime
Output array for time values
Returns:
Status code
function readnctime2
Read time variable from a NetCDF file with reference date.
Reads the time variable from a NetCDF file using a reference date and time coordinate name.
Parameters:
ncid
NetCDF file IDtimecoordname
Time coordinate variable namerefdate
Reference date stringnt
Number of time stepstime
Output array for time values
Returns:
Status code
function readnczb
function readvardata
Read variable data from a NetCDF file for a specific time step.
template<class T>
int readvardata (
std::string filename,
std::string Varname,
int step,
T *& vardata,
bool flipx,
bool flipy
)
Reads data for a variable from a NetCDF file for a given time step, with optional axis flipping.
Template parameters:
T
Data type
Parameters:
filename
NetCDF filenameVarname
Variable namestep
Time step to readvardata
Output array for dataflipx
Flip x axisflipy
Flip y axis
Returns:
Status code
function readvardata< double >
template int readvardata< double > (
std::string filename,
std::string Varname,
int step,
double *& vardata,
bool flipx,
bool flipy
)
function readvardata< float >
template int readvardata< float > (
std::string filename,
std::string Varname,
int step,
float *& vardata,
bool flipx,
bool flipy
)
function readvardata< int >
template int readvardata< int > (
std::string filename,
std::string Varname,
int step,
int *& vardata,
bool flipx,
bool flipy
)
function readvarinfo
Read variable dimension info from a NetCDF file.
Reads the dimensions for a variable in a NetCDF file.
Parameters:
filename
NetCDF filenameVarname
Variable nameddimU
Output array for dimension sizes
Returns:
Number of dimensions
The documentation for this class was generated from the following file src/Read_netcdf.cu