MI - Fimex
|
Go to the source code of this file.
Typedefs | |
typedef struct mifi_cdm_reader | mifi_cdm_reader |
typedef struct mifi_slicebuilder | mifi_slicebuilder |
typedef int(* | doubleDatasliceCallbackPtr) (mifi_cdm_reader *reader, const char *varName, size_t unLimDimPos, double *scaledData, size_t dataSize) |
Functions | |
void | mifi_free_cdm_reader (mifi_cdm_reader *reader) |
mifi_cdm_reader * | mifi_new_io_reader (int file_type, const char *filename, const char *configFile) |
MIFI_DEPRECATED (mifi_cdm_reader *mifi_new_felt_reader(const char *filename, const char *configFile)) | |
MIFI_DEPRECATED (mifi_cdm_reader *mifi_new_netcdf_reader(const char *filename)) | |
MIFI_DEPRECATED (mifi_cdm_reader *mifi_new_ncml_reader(const char *ncmlFile)) | |
mifi_cdm_reader * | mifi_new_ncml_modifier (mifi_cdm_reader *reader, const char *ncmlFile) |
int | mifi_netcdf_writer (mifi_cdm_reader *reader, const char *filename, const char *configFile, int version) |
int | mifi_grib_writer (mifi_cdm_reader *reader, const char *filename, const char *configFile, int version) |
int | mifi_nullcdm_writer (mifi_cdm_reader *reader) |
mifi_cdm_reader * | mifi_new_cdminterpolator (mifi_cdm_reader *reader, int method, const char *proj_input, const char *out_x_axis, const char *out_y_axis, const char *out_x_axis_unit, const char *out_y_axis_unit) |
change the projection of the reader to this new projection More... | |
mifi_cdm_reader * | mifi_new_lonlat_interpolator (mifi_cdm_reader *reader, int method, int n, const double *lonVals, const double *latVals) |
change the projection of the reader to this new projection More... | |
mifi_cdm_reader * | mifi_new_c_reader (mifi_cdm_reader *reader) |
int | mifi_set_callback_double (mifi_cdm_reader *c_reader, const char *varName, doubleDatasliceCallbackPtr callback) |
size_t | mifi_get_variable_number (mifi_cdm_reader *reader) |
const char * | mifi_get_variable_name (mifi_cdm_reader *reader, size_t pos) |
unsigned int | mifi_get_variable_type (mifi_cdm_reader *reader, const char *varName) |
size_t | mifi_get_dimension_number (mifi_cdm_reader *reader) |
const char * | mifi_get_dimension_name (mifi_cdm_reader *reader, size_t pos) |
size_t | mifi_get_dimension_size (mifi_cdm_reader *reader, const char *dimName) |
const char * | mifi_get_unlimited_dimension_name (mifi_cdm_reader *reader) |
const char * | mifi_get_var_longitude (mifi_cdm_reader *reader, const char *varName) |
int | mifi_get_var_longitude_cpy (mifi_cdm_reader *reader, const char *varName, char *lonName, int n) |
const char * | mifi_get_var_latitude (mifi_cdm_reader *reader, const char *varName) |
int | mifi_get_var_latitude_cpy (mifi_cdm_reader *reader, const char *varName, char *latName, int n) |
mifi_slicebuilder * | mifi_new_slicebuilder (mifi_cdm_reader *reader, const char *varName) |
int | mifi_slicebuilder_has_CS (mifi_slicebuilder *sb) |
const char * | mifi_slicebuilder_get_proj4 (mifi_slicebuilder *sb) |
int | mifi_slicebuilder_get_proj4_cpy (mifi_slicebuilder *sb, char *proj4, int n) |
int | mifi_slicebuilder_ndims (mifi_slicebuilder *sb) |
const char * | mifi_slicebuilder_dimname (mifi_slicebuilder *sb, int pos) |
int | mifi_slicebuilder_dimname_cpy (mifi_slicebuilder *sb, int pos, char *dimName, int n) |
int | mifi_slicebuilder_get_start_size (mifi_slicebuilder *sb, unsigned int *start, unsigned int *size) |
int | mifi_slicebuilder_get_axistype (mifi_slicebuilder *sb, int *axistype) |
int | mifi_slicebuilder_set_dim_start_size (mifi_slicebuilder *sb, const char *dimName, unsigned int start, unsigned int size) |
void | mifi_free_slicebuilder (mifi_slicebuilder *sb) |
int | mifi_get_double_dataslice (mifi_cdm_reader *reader, const char *varName, size_t unLimDimPos, double **data, size_t *size) |
int | mifi_get_double_data (mifi_cdm_reader *reader, const char *varName, double **data, size_t *size) |
int | mifi_fill_scaled_double_dataslice (mifi_cdm_reader *reader, const char *varName, mifi_slicebuilder *sb, const char *units, double *data, size_t *size) |
int | mifi_write_scaled_double_dataslice (mifi_cdm_reader *rwreader, const char *varName, mifi_slicebuilder *sb, const char *units, double *data, size_t size) |
double | mifi_get_unique_forecast_reference_time (mifi_cdm_reader *reader, const char *units) |
typedef int(* doubleDatasliceCallbackPtr) (mifi_cdm_reader *reader, const char *varName, size_t unLimDimPos, double *scaledData, size_t dataSize) |
Function pointer as used for the get_double_dataslice callback function
typedef struct mifi_cdm_reader mifi_cdm_reader |
This is the public C-Api for fimex. It is a wrapper api for the underlying C++ api.
typedef struct mifi_slicebuilder mifi_slicebuilder |
MIFI_DEPRECATED | ( | mifi_cdm_reader * | mifi_new_felt_readerconst char *filename, const char *configFile | ) |
Get a new reader from a felt file.
filename | name of the felt-file |
configFile | configuration file for the felt-file |
Get a new reader from a grib1/2 file.
filename | name of the grib-file |
configFile | configuration file for the grib-file |
MIFI_DEPRECATED | ( | mifi_cdm_reader * | mifi_new_netcdf_readerconst char *filename | ) |
Get a new reader from a netcdf file.
filename | name of the netcdf-file |
MIFI_DEPRECATED | ( | mifi_cdm_reader * | mifi_new_ncml_readerconst char *ncmlFile | ) |
Get a new reader from a ncml file.
ncmlFile | name of the ncml config file |
int mifi_fill_scaled_double_dataslice | ( | mifi_cdm_reader * | reader, |
const char * | varName, | ||
mifi_slicebuilder * | sb, | ||
const char * | units, | ||
double * | data, | ||
size_t * | size | ||
) |
Read information from the readers variable to the pre-allocated data-variable.
reader | the data-source |
varName | variable-name to read |
sb | The slicebuilder to restrict dimensions. It is possible to reuse a slicebuilder for several variables with the same dimensions. |
units | Units of the data. Scaling and unit-conversion will be done automatically. Use units = "" if you don't want any units-conversion. Units need to be udunits-compatible. |
data | Preallocated data. The total size must be identical to the slicebuilders total size. |
size | The actually read data. This might be <= the requested data if data not available. |
void mifi_free_cdm_reader | ( | mifi_cdm_reader * | reader | ) |
Free the reader. This won't free the resources immediately, but reduce the reference counter. It is therefore possible to free a reader, while it still is used within another part of the fimex-chain.
void mifi_free_slicebuilder | ( | mifi_slicebuilder * | sb | ) |
Free the memory allocated for the slicebuilder.
sb |
const char* mifi_get_dimension_name | ( | mifi_cdm_reader * | reader, |
size_t | pos | ||
) |
Get the name of a dimension from the reader.
reader | the data source |
pos | the position number of the dimensin, should be between 0 and size-1 |
size_t mifi_get_dimension_number | ( | mifi_cdm_reader * | reader | ) |
Get the number of the dimensions from the reader.
reader | the data source |
size_t mifi_get_dimension_size | ( | mifi_cdm_reader * | reader, |
const char * | dimName | ||
) |
Get the size of a dimension
reader | the data source |
dimName | the name of the dimension |
int mifi_get_double_data | ( | mifi_cdm_reader * | reader, |
const char * | varName, | ||
double ** | data, | ||
size_t * | size | ||
) |
get all the data from the dataReader
reader | dataReader to read the data from |
varName | variable name associated with the data |
data | the returned data. It will be allocated automatically, it is the task of the user to free it. Undefined values will be NaN. |
size | the size of the returned data. |
int mifi_get_double_dataslice | ( | mifi_cdm_reader * | reader, |
const char * | varName, | ||
size_t | unLimDimPos, | ||
double ** | data, | ||
size_t * | size | ||
) |
get a slice of data from the dataReader
reader | dataReader to read the data from |
varName | variable name associated with the data |
unLimDimPos | unlimited dimension of the slice |
data | the returned data. It will be allocated automatically, it is the task of the user to free it. Undefined values will be NaN. |
size | the size of the returned data. |
double mifi_get_unique_forecast_reference_time | ( | mifi_cdm_reader * | reader, |
const char * | units | ||
) |
get the unique forecast reference time in a unit
reader | |
units | a unit for point in time, e.g. "seconds since 1970-01-01" |
const char* mifi_get_unlimited_dimension_name | ( | mifi_cdm_reader * | reader | ) |
Get the name of the unlimited dimension
reader |
const char* mifi_get_var_latitude | ( | mifi_cdm_reader * | reader, |
const char * | varName | ||
) |
Get the name of the latitude variable belonging to a parameter. The latitude variable might be a dimension (1D), or an 2D field.
reader | |
varName | The name of a parameter. |
int mifi_get_var_latitude_cpy | ( | mifi_cdm_reader * | reader, |
const char * | varName, | ||
char * | latName, | ||
int | n | ||
) |
Get the name of the latitude variable belonging to a parameter. This function is similar to mifi_get_var_longitude, except that the name is copied to lonName which is expected to have a capacity of n.
reader | |
varName | The name of a parameter. |
latName | The place to copy the longitude name to. |
n | The capacity of latName – 10 means at most 9 characters plus a final 0 byte. |
const char* mifi_get_var_longitude | ( | mifi_cdm_reader * | reader, |
const char * | varName | ||
) |
Get the name of the longitude variable belonging to a parameter. The longitude variable might be a dimension (1D), or an 2D field.
reader | |
varName | The name of a parameter. |
int mifi_get_var_longitude_cpy | ( | mifi_cdm_reader * | reader, |
const char * | varName, | ||
char * | lonName, | ||
int | n | ||
) |
Get the name of the latitude variable belonging to a parameter. This function is similar to mifi_get_var_longitude, except that the name is copied to lonName which is expected to have a capacity of n.
reader | |
varName | The name of a parameter. |
lonName | The place to copy the longitude name to. |
n | The capacity of lonName – 10 means at most 9 characters plus a final 0 byte. |
const char* mifi_get_variable_name | ( | mifi_cdm_reader * | reader, |
size_t | pos | ||
) |
Get the name of a variable from the reader.
reader | the data source |
pos | the position number of the variable, should be between 0 and size-1 |
size_t mifi_get_variable_number | ( | mifi_cdm_reader * | reader | ) |
Get the number of the variables from the reader.
reader | the data source |
unsigned int mifi_get_variable_type | ( | mifi_cdm_reader * | reader, |
const char * | varName | ||
) |
Get the MetNoFimex::CDMDataType datatype for a variable.
reader | the data source |
varName | name of the variable |
int mifi_grib_writer | ( | mifi_cdm_reader * | reader, |
const char * | filename, | ||
const char * | configFile, | ||
int | version | ||
) |
Write the content of the reader to the filename as gribfile.
reader | the data source |
filename | the name of the grib-file to write |
configFile | an optional configFile, use "" or 0 if not needed |
version | the version of the grib-edition. Implemented are 1 or 2. |
int mifi_netcdf_writer | ( | mifi_cdm_reader * | reader, |
const char * | filename, | ||
const char * | configFile, | ||
int | version | ||
) |
Write the content of the reader to the filename.
reader | the data source |
filename | the name of the netcdf-file to write |
configFile | an optional configFile, use "" or 0 if not needed |
version | the version of the netcdf-file. Implemented are 3 or 4. |
mifi_cdm_reader* mifi_new_c_reader | ( | mifi_cdm_reader * | reader | ) |
Get a new reader which allows setting c-callback functions.
reader | the original data-source |
mifi_cdm_reader* mifi_new_cdminterpolator | ( | mifi_cdm_reader * | reader, |
int | method, | ||
const char * | proj_input, | ||
const char * | out_x_axis, | ||
const char * | out_y_axis, | ||
const char * | out_x_axis_unit, | ||
const char * | out_y_axis_unit | ||
) |
change the projection of the reader to this new projection
reader | the original data-source |
method | Interpolation method |
proj_input | input-string for proj4, used as output projection |
out_x_axis | config-string for x_axis, either '1,2,...,5' or 'auto' or 'auto,distance=3.5' |
out_y_axis | config-string for y_axis, either '1,2,...,5' or 'auto' or 'auto,distance=3.5' |
out_x_axis_unit | unit of the output x-axis |
out_y_axis_unit | unit of the output y-axis |
mifi_cdm_reader* mifi_new_io_reader | ( | int | file_type, |
const char * | filename, | ||
const char * | configFile | ||
) |
Get a new reader from a file.
file_type | mifi_filetype constant. To get a CDMReaderWriter, use MIFI_FILETYPE_NETCDF|MIFI_FILETYPE_RW. |
filename | name of the felt-file |
configFile | configuration file for the felt-file |
mifi_cdm_reader* mifi_new_lonlat_interpolator | ( | mifi_cdm_reader * | reader, |
int | method, | ||
int | n, | ||
const double * | lonVals, | ||
const double * | latVals | ||
) |
change the projection of the reader to this new projection
reader | the original data-source |
method | Interpolation method |
n | number of latitude-longitude points |
lonVals | array of size n with longitude positions |
latVals | array of size n with latitude positions |
mifi_cdm_reader* mifi_new_ncml_modifier | ( | mifi_cdm_reader * | reader, |
const char * | ncmlFile | ||
) |
Modify a reader using a ncml file.
reader | the data/cdm source |
ncmlFile | name of the ncml config file |
mifi_slicebuilder* mifi_new_slicebuilder | ( | mifi_cdm_reader * | reader, |
const char * | varName | ||
) |
Create a new slice_builder for the reader and the variable. It will try to attach a coordinate-system if possible
reader | |
varName |
int mifi_nullcdm_writer | ( | mifi_cdm_reader * | reader | ) |
Fetch the whole data belonging to the cdm, but don't write it anywhere.
reader | the data source |
int mifi_set_callback_double | ( | mifi_cdm_reader * | c_reader, |
const char * | varName, | ||
doubleDatasliceCallbackPtr | callback | ||
) |
Add a callback for a variable. The variable will be converted to datatype double.
c_reader | the reader as created by mifi_new_c_reader |
varName | the name of the variable |
callback | a function-ptr to the callback function |
const char* mifi_slicebuilder_dimname | ( | mifi_slicebuilder * | sb, |
int | pos | ||
) |
Get the name of the dimension of the slicebuilder at a certain position.
sb | |
pos |
int mifi_slicebuilder_dimname_cpy | ( | mifi_slicebuilder * | sb, |
int | pos, | ||
char * | dimName, | ||
int | n | ||
) |
Get the projection of the slicebuilder. This function is similar to mifi_slicebuilder_get_proj4, except that the name is copied to proj4 which is expected to have a capacity of n.
sb | |
pos | |
dimName | The place to copy the dimension name to. |
n | The capacity of dimName – 10 means at most 9 characters plus a final 0 byte. |
int mifi_slicebuilder_get_axistype | ( | mifi_slicebuilder * | sb, |
int * | axistype | ||
) |
const char* mifi_slicebuilder_get_proj4 | ( | mifi_slicebuilder * | sb | ) |
Get the projection of the slicebuilder, if it belongs to a coordinate-system with projection.
sb |
int mifi_slicebuilder_get_proj4_cpy | ( | mifi_slicebuilder * | sb, |
char * | proj4, | ||
int | n | ||
) |
Get the projection of the slicebuilder. This function is similar to mifi_slicebuilder_get_proj4, except that the name is copied to proj4 which is expected to have a capacity of n.
sb | |
proj4 | The place to copy the projection information to. |
n | The capacity of proj4 – 10 means at most 9 characters plus a final 0 byte. |
int mifi_slicebuilder_get_start_size | ( | mifi_slicebuilder * | sb, |
unsigned int * | start, | ||
unsigned int * | size | ||
) |
Get the current start positions and dimension-sizes for all dimensions.
sb | |
start | pre-allocated array of size ndims |
size | pre-allocated array of size ndims |
int mifi_slicebuilder_has_CS | ( | mifi_slicebuilder * | sb | ) |
Check if the slicebuilder is connected to a coordinate-system.
sb |
int mifi_slicebuilder_ndims | ( | mifi_slicebuilder * | sb | ) |
Get the number of dimensions (i.e. the rank) of the slicebuilder.
sb |
int mifi_slicebuilder_set_dim_start_size | ( | mifi_slicebuilder * | sb, |
const char * | dimName, | ||
unsigned int | start, | ||
unsigned int | size | ||
) |
Set the start-position (starting with 0) and size of a named dimension.
sb | |
dimName | |
start | |
size |
int mifi_write_scaled_double_dataslice | ( | mifi_cdm_reader * | rwreader, |
const char * | varName, | ||
mifi_slicebuilder * | sb, | ||
const char * | units, | ||
double * | data, | ||
size_t | size | ||
) |
Write data to the variable on disk
rwreader | the data-sink, should be opened with mifi_new_io_reader() with MIFI_FILETYPE_RW|MIFI_FILETYPE_NETCDF |
varName | variable-name to read |
sb | The slicebuilder to restrict dimensions. It is possible to reuse a slicebuilder for several variables with the same dimensions. |
units | Units of the data. Scaling and unit-conversion will be done automatically. Use units = "" if you don't want any units-conversion. Units need to be udunits-compatible. |
data | Preallocated data. The total size must be identical to the slicebuilders total size. |
size | The size of data. |