WSL/SLF GitLab Repository
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
snow-models
meteoio
Commits
e06ea011
Commit
e06ea011
authored
May 11, 2014
by
Mathias Bavay
Browse files
Made the library wrappers static and expanded the documentation
parent
5cfb7b0e
Changes
2
Hide whitespace changes
Inline
Side-by-side
meteoio/plugins/NetCDFIO.cc
View file @
e06ea011
...
...
@@ -25,8 +25,19 @@ namespace mio {
/**
* @page netcdf NetCDF
* @section netcdf_format Format
* *Put here the informations about the standard format that is implemented*
* http://cfconventions.org/1.6.html
* In order to promote creation, access and sharing of scientific data, the NetCDF format has been
* created as a machine-independent format. NetCDF (network Common Data Form) is therefore an interface
* for array-oriented data access and a library that provides an implementation of the interface. The
* <A HREF="http://www.unidata.ucar.edu/downloads/netcdf/index.jsp">NetCDF software</A> was developed
* at the <A HREF="http://www.unidata.ucar.edu/">Unidata Program Center</A> in Boulder, Colorado.
*
* The <A HREF="http://cfconventions.org/1.6.html">conventions</A> for climate and forecast (CF) metadata
* are designed to promote the processing and sharing of netCDF files. The conventions define metadata
* that provide a definitive description of what the data represents, and the spatial and temporal properties of the data.
* This plugin follows such conventions as well as the naming extensions defined by the
* <A HREF="http://www.cnrm.meteo.fr/">CNRM</A>.
*
* *Put here the more informations about the standard format that is implemented*
*
* @section netcdf_units Units
*
...
...
@@ -39,6 +50,18 @@ namespace mio {
* - DEMVAR: The variable name of the DEM within the DEMFILE; [Input] section
* - METEOFILE: the NetCDF file which shall be used for the meteo parameter input/output; [Input] and [Output] section
* - GRID2DFILE: the NetCDF file which shall be used for gridded input/output; [Input] and [Output] section
*
* @section example Example use
* @code
* [Input]
* DEM = NETCDF
* DEMFILE = ./input/Aster_tile.nc
* DEMVAR = z
* @endcode
*
* @section Compilation
* In order to compile this plugin, you need libnetcdf (for C). For Linux, please select both the libraries and
* their development files in your package manager.
*/
const
double
NetCDFIO
::
plugin_nodata
=
-
9999999.
;
//CNRM-GAME nodata value
...
...
meteoio/plugins/NetCDFIO.h
View file @
e06ea011
...
...
@@ -105,56 +105,56 @@ class NetCDFIO : public IOInterface {
/* libnetcdf wrappers */
//Opening, creating, closing dataset
void
open_file
(
const
std
::
string
&
filename
,
const
int
&
omode
,
int
&
ncid
);
void
create_file
(
const
std
::
string
&
filename
,
const
int
&
cmode
,
int
&
ncid
);
void
start_definitions
(
const
std
::
string
&
filename
,
const
int
&
ncid
);
void
end_definitions
(
const
std
::
string
&
filename
,
const
int
&
ncid
);
void
close_file
(
const
std
::
string
&
filename
,
const
int
&
ncid
);
static
void
open_file
(
const
std
::
string
&
filename
,
const
int
&
omode
,
int
&
ncid
);
static
void
create_file
(
const
std
::
string
&
filename
,
const
int
&
cmode
,
int
&
ncid
);
static
void
start_definitions
(
const
std
::
string
&
filename
,
const
int
&
ncid
);
static
void
end_definitions
(
const
std
::
string
&
filename
,
const
int
&
ncid
);
static
void
close_file
(
const
std
::
string
&
filename
,
const
int
&
ncid
);
//Adding variables
void
add_0D_variable
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
nc_type
&
xtype
,
int
&
varid
);
void
add_1D_variable
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
nc_type
&
xtype
,
const
int
&
dimid
,
int
&
varid
);
void
add_2D_variable
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
nc_type
&
xtype
,
const
int
&
dimid1
,
const
int
&
dimid2
,
int
&
varid
);
void
add_3D_variable
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
nc_type
&
xtype
,
const
int
&
dimid_record
,
static
void
add_0D_variable
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
nc_type
&
xtype
,
int
&
varid
);
static
void
add_1D_variable
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
nc_type
&
xtype
,
const
int
&
dimid
,
int
&
varid
);
static
void
add_2D_variable
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
nc_type
&
xtype
,
const
int
&
dimid1
,
const
int
&
dimid2
,
int
&
varid
);
static
void
add_3D_variable
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
nc_type
&
xtype
,
const
int
&
dimid_record
,
const
int
&
dimid1
,
const
int
&
dimid2
,
int
&
varid
);
//Adding attributes
void
add_attribute
(
const
int
&
ncid
,
const
int
&
varid
,
const
std
::
string
&
attr_name
,
const
std
::
string
&
attr_value
);
void
add_attribute
(
const
int
&
ncid
,
const
int
&
varid
,
const
std
::
string
&
attr_name
,
const
double
&
attr_value
);
void
get_attribute
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
int
&
varid
,
const
std
::
string
&
attr_name
,
std
::
string
&
attr_value
);
static
void
add_attribute
(
const
int
&
ncid
,
const
int
&
varid
,
const
std
::
string
&
attr_name
,
const
std
::
string
&
attr_value
);
static
void
add_attribute
(
const
int
&
ncid
,
const
int
&
varid
,
const
std
::
string
&
attr_name
,
const
double
&
attr_value
);
static
void
get_attribute
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
int
&
varid
,
const
std
::
string
&
attr_name
,
std
::
string
&
attr_value
);
//Adding dimensions
void
add_dimension
(
const
int
&
ncid
,
const
std
::
string
&
dimname
,
const
size_t
&
length
,
int
&
dimid
);
static
void
add_dimension
(
const
int
&
ncid
,
const
std
::
string
&
dimname
,
const
size_t
&
length
,
int
&
dimid
);
//Reading data from NetCDF file
void
read_data
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
int
&
varid
,
static
void
read_data
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
int
&
varid
,
const
size_t
&
pos
,
const
size_t
&
latlen
,
const
size_t
&
lonlen
,
double
*&
data
);
void
read_data_2D
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
int
&
varid
,
static
void
read_data_2D
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
int
&
varid
,
const
size_t
&
record
,
const
size_t
&
count
,
const
size_t
&
length
,
double
*&
data
);
void
read_value
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
int
&
varid
,
double
&
data
);
void
read_value
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
int
&
varid
,
const
size_t
&
pos
,
double
&
data
);
void
read_data
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
int
&
varid
,
double
*&
data
);
static
void
read_value
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
int
&
varid
,
double
&
data
);
static
void
read_value
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
int
&
varid
,
const
size_t
&
pos
,
double
&
data
);
static
void
read_data
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
int
&
varid
,
double
*&
data
);
//Writing data to NetCDF file
void
write_data
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
int
&
varid
,
const
double
*
const
data
);
void
write_data
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
int
&
varid
,
const
Grid2DObject
&
grid
,
static
void
write_data
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
int
&
varid
,
const
double
*
const
data
);
static
void
write_data
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
int
&
varid
,
const
Grid2DObject
&
grid
,
const
size_t
&
pos_start
,
const
double
*
const
data
);
//Dealing with variables that have dimension NC_UNLIMITED
size_t
find_record
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
int
&
varid
,
const
double
&
data
);
size_t
add_record
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
int
&
varid
,
const
double
&
data
);
void
write_record
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
int
&
varid
,
const
size_t
&
pos
,
static
size_t
find_record
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
int
&
varid
,
const
double
&
data
);
static
size_t
add_record
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
int
&
varid
,
const
double
&
data
);
static
void
write_record
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
int
&
varid
,
const
size_t
&
pos
,
const
size_t
&
length
,
const
double
*
const
data
);
//Dealing with variables and dimensions
bool
check_dim_var
(
const
int
&
ncid
,
const
std
::
string
&
dimname
);
bool
check_variable
(
const
int
&
ncid
,
const
std
::
string
&
varname
);
void
get_variable
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
int
&
varid
);
void
check_dimensions
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
int
&
varid
,
const
std
::
vector
<
std
::
string
>&
names
);
void
get_dimension
(
const
int
&
ncid
,
const
std
::
string
&
dimname
,
int
&
dimid
);
void
get_dimension
(
const
int
&
ncid
,
const
std
::
string
&
dimname
,
int
&
dimid
,
size_t
&
dimlen
);
void
get_dimension
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
int
&
varid
,
static
bool
check_dim_var
(
const
int
&
ncid
,
const
std
::
string
&
dimname
);
static
bool
check_variable
(
const
int
&
ncid
,
const
std
::
string
&
varname
);
static
void
get_variable
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
int
&
varid
);
static
void
check_dimensions
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
int
&
varid
,
const
std
::
vector
<
std
::
string
>&
names
);
static
void
get_dimension
(
const
int
&
ncid
,
const
std
::
string
&
dimname
,
int
&
dimid
);
static
void
get_dimension
(
const
int
&
ncid
,
const
std
::
string
&
dimname
,
int
&
dimid
,
size_t
&
dimlen
);
static
void
get_dimension
(
const
int
&
ncid
,
const
std
::
string
&
varname
,
const
int
&
varid
,
std
::
vector
<
int
>&
dimid
,
std
::
vector
<
int
>&
dim_varid
,
std
::
vector
<
std
::
string
>&
dimname
,
std
::
vector
<
size_t
>&
dimlen
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment