MI - Fimex
|
Fimex Fortran90 interface. More...
Functions/Subroutines | |
integer function | set_filetype (filetype_name, flag) |
translate the filetype from string to internal number More... | |
integer function | open_file (this, infile, config, filetype, varName) |
Open a new data-soure. More... | |
integer function | new_interpolator (this, fio, method, proj_input, out_x_axis, out_y_axis, out_is_degree) |
Create a new interpolated data-soure from an existing FimexIO. More... | |
integer function | new_lonlat_interpolator (this, fio, method, lonvals, latvals) |
Create a new interpolated data-soure from an existing FimexIO. More... | |
real(kind=c_double) function | get_unique_forecast_reference_time (this, unit) |
Get the files unique forecast_reference_time. More... | |
character(len=1024) function | get_file_ulim_dimension_name (this) |
Get the name of the unlimited dimension (in most cases, time-dimension) More... | |
integer(kind=c_long_long) function | get_file_dimensions_size (this) |
Get the number of dimensions in the file. More... | |
character(len=1024) function | get_file_dimension_name (this, pos) |
Get the name of the dimension at position pos. More... | |
integer(kind=c_long_long) function | get_variables_size (this) |
Get the number of variables in the file. More... | |
character(len=1024) function | get_variable_name (this, pos) |
Get the name of the variable at position pos. More... | |
integer(kind=c_long) function | get_variable_type (this, varName) |
Get the type of a variable This function will read the type of a variable as the CDM_* enum. More... | |
integer function | get_dimensions (this, varName) |
Get the number of dimensions of a variable. This function will internally initialize a slicebuilder, too, so all data and dimension-fetching will be against this variable. More... | |
character(len=1024) function | get_dimname (this, pos) |
Get the dimension-name at a position Get the dimension at a position between 1 and get_dimensions() The position is directly related to the position in the return arrays of get_dimension_start_size() More... | |
integer(kind=c_long) function | get_dimension_size (this, dimName) |
Get the global size of a file's dimension Get the dimension-size of a dimension of the file. More... | |
integer function | get_dimension_start_size (this, start, vsize) |
Get the current start-position and current size for the current variable dimensions. Get the start-position and size for each dimension of the variable set with the last get_dimensions() call. Initially, start is 0 for each dimension and size is the full dimension size. This can be changed with reduce_dimension(). More... | |
integer function | get_axistypes (this, atypes) |
Get the types of the axes. The types are the same as in MetNoFimex::CoordinateAxis::AxisType. Compare against AXIS_Time, AXIS_GeoX, ... enumerated constants. More... | |
character(len=1024) function | get_var_longitude (this, varName) |
Get the name of the variable with longitude values for the variable varName the data-variable. More... | |
character(len=1024) function | get_var_latitude (this, varName) |
Get the name of the variable with latitude values for the variable varName the data-variable. More... | |
integer function | reduce_dimension (this, dimName, start, dsize) |
Reduce the dimension by setting a start and size. More... | |
integer function | read_data (this, varname, field, cunit) |
Read data to a 1-d field. To work with n-d arrays, use the fortran rank remapping feature of fortran2003: More... | |
integer function | write_data (this, varname, field, cunit) |
Write data to a file. More... | |
integer function | close_file (this) |
Cleanup internally kept handles and close the file. More... | |
Fimex Fortran90 interface.
The Fimex F90 interface is devided into two parts. Functions starting with c_mifi are wrapper functions against the Fimex C-interface c_fimex.h . Functions without prefix define a high level F90 interface, which should generally be used
Besides the documented functions, the following constants can be used: AXIS_Undefined = 0, AXIS_GeoX, AXIS_GeoY, AXIS_GeoZ, AXIS_Time, AXIS_Lon, AXIS_Lat, AXIS_Pressure, AXIS_Height, AXIS_ReferenceTime INTERPOL_NEAREST_NEIGHBOR = 0, INTERPOL_BILINEAR, INTERPOL_BICUBIC, INTERPOL_COORD_NN, INTERPOL_COORD_NN_KD, INTERPOL_FORWARD_SUM, INTERPOL_FORWARD_MEAN, INTERPOL_FORWARD_MEDIAN, INTERPOL_FORWARD_MAX, INTERPOL_FORWARD_MIN FILETYPE_UNKNOWN=-1, FILETYPE_FELT, FILETYPE_NETCDF,& FILETYPE_NCML, FILETYPE_GRIB, FILETYPE_WDB, FILETYPE_METGM,& FILETYPE_RW=1024
The fimex.f90 interface is currently not precompiled with building fimex. Please copy the fimex.f90 file to your f90-project and compile it from there, and link with ''-lfimex''.
An example to run against this module can be found in modules/F90/fortran_test.f90
integer function fimex::close_file | ( | class(fimexio), intent(inout) | this | ) |
Cleanup internally kept handles and close the file.
integer function fimex::get_axistypes | ( | class(fimexio), intent(in) | this, |
integer(kind=c_int), dimension(:), intent(inout), allocatable, target | atypes | ||
) |
Get the types of the axes. The types are the same as in MetNoFimex::CoordinateAxis::AxisType. Compare against AXIS_Time, AXIS_GeoX, ... enumerated constants.
atypes | pre-allocated integer array of size ndims |
integer(kind=c_long) function fimex::get_dimension_size | ( | class(fimexio), intent(in) | this, |
character(len=*), intent(in) | dimName | ||
) |
Get the global size of a file's dimension Get the dimension-size of a dimension of the file.
dimName | the dimensions name |
integer function fimex::get_dimension_start_size | ( | class(fimexio), intent(in) | this, |
integer(kind=c_int), dimension(:), intent(inout), allocatable, target | start, | ||
integer(kind=c_int), dimension(:), intent(inout), allocatable, target | vsize | ||
) |
Get the current start-position and current size for the current variable dimensions. Get the start-position and size for each dimension of the variable set with the last get_dimensions() call. Initially, start is 0 for each dimension and size is the full dimension size. This can be changed with reduce_dimension().
start | pre-allocated array of size get_dimensions(), returns usually 0,0,0,... |
vsize | pre-allocated array of size get_dimensions(), returns the sizes of the dimension |
integer function fimex::get_dimensions | ( | class(fimexio), intent(inout) | this, |
character(len=*), intent(in) | varName | ||
) |
Get the number of dimensions of a variable. This function will internally initialize a slicebuilder, too, so all data and dimension-fetching will be against this variable.
varName | variable name |
character(len=1024) function fimex::get_dimname | ( | class(fimexio), intent(in) | this, |
integer, intent(in) | pos | ||
) |
Get the dimension-name at a position Get the dimension at a position between 1 and get_dimensions() The position is directly related to the position in the return arrays of get_dimension_start_size()
pos | Position in the dimensions-array, 1 <= pos <= get_dimensions() |
character(len=1024) function fimex::get_file_dimension_name | ( | class(fimexio), intent(in) | this, |
integer, value | pos | ||
) |
Get the name of the dimension at position pos.
pos | position of dimension 1 <= pos <= dimension_number() |
integer(kind=c_long_long) function fimex::get_file_dimensions_size | ( | class(fimexio), intent(in) | this | ) |
Get the number of dimensions in the file.
character(len=1024) function fimex::get_file_ulim_dimension_name | ( | class(fimexio), intent(in) | this | ) |
Get the name of the unlimited dimension (in most cases, time-dimension)
real(kind=c_double) function fimex::get_unique_forecast_reference_time | ( | class(fimexio), intent(inout) | this, |
character(len=*), intent(in), optional | unit | ||
) |
Get the files unique forecast_reference_time.
unit | optional time-unite, defaults to 'seconds since 1970-01-01 +0000' |
character(len=1024) function fimex::get_var_latitude | ( | class(fimexio), intent(in) | this, |
character(len=*), intent(in) | varName | ||
) |
Get the name of the variable with latitude values for the variable varName the data-variable.
pos | position of variable 1 <= pos <= variable_number() |
character(len=1024) function fimex::get_var_longitude | ( | class(fimexio), intent(in) | this, |
character(len=*), intent(in) | varName | ||
) |
Get the name of the variable with longitude values for the variable varName the data-variable.
pos | position of variable 1 <= pos <= variable_number() |
character(len=1024) function fimex::get_variable_name | ( | class(fimexio), intent(in) | this, |
integer, value | pos | ||
) |
Get the name of the variable at position pos.
pos | position of variable 1 <= pos <= variable_number() |
integer(kind=c_long) function fimex::get_variable_type | ( | class(fimexio), intent(in) | this, |
character(len=*), intent(in) | varName | ||
) |
Get the type of a variable This function will read the type of a variable as the CDM_* enum.
varName | variable name |
integer(kind=c_long_long) function fimex::get_variables_size | ( | class(fimexio), intent(in) | this | ) |
Get the number of variables in the file.
integer function fimex::new_interpolator | ( | class(fimexio), intent(out) | this, |
class(fimexio), intent(in) | fio, | ||
integer, intent(in) | method, | ||
character(len=*), intent(in) | proj_input, | ||
character(len=*), intent(in) | out_x_axis, | ||
character(len=*), intent(in) | out_y_axis, | ||
logical, intent(in) | out_is_degree | ||
) |
Create a new interpolated data-soure from an existing FimexIO.
this | the new FimexIO object. It must be closed with close_file. |
fio | the input data-source |
method | one of INTERPOL_bilinear, INTERPOL_.... methods |
proj_input | a proj4 text string |
out_x_axis | a description string of the x-axis, e.g. "10,20,...,1000", see MetNoFimex::SpatialAxisSpec |
out_y_axis | a description string of the y-axis, e.g. "10,20,...,1000", see MetNoFimex::SpatialAxisSpec |
out_is_degree | output-axis are in degree (true) or meter (false) |
integer function fimex::new_lonlat_interpolator | ( | class(fimexio), intent(out) | this, |
class(fimexio), intent(in) | fio, | ||
integer, intent(in) | method, | ||
real(kind=c_double), dimension(:), intent(in), allocatable, target | lonvals, | ||
real(kind=c_double), dimension(:), intent(in), allocatable, target | latvals | ||
) |
Create a new interpolated data-soure from an existing FimexIO.
this | the new FimexIO object. It must be closed with close_file. |
fio | the input data-source |
method | one of INTERPOL_bilinear, INTERPOL_.... methods |
lonvals | longitude positions |
latvals | longitude positions |
integer function fimex::open_file | ( | class(fimexio), intent(out) | this, |
character(len=*), intent(in) | infile, | ||
character(len=*), intent(in) | config, | ||
integer, intent(in) | filetype, | ||
character(len=*), intent(in), optional | varName | ||
) |
Open a new data-soure.
this | the new FimexIO object. |
infile | filename (or URL) of input |
config | configuration-file, use "" if not applicable |
filetype | see set_filetype(), to open a file read-writable use IOR(FILETYPE_NETCDF,FILETYPE_RW) |
varName | optional varname, if used, will call get_dimensions() and return the number of dimensions |
integer function fimex::read_data | ( | class(fimexio), intent(in) | this, |
character(len=*), intent(in) | varname, | ||
real(kind=c_double), dimension(:), intent(inout), allocatable, target | field, | ||
character(len=*), intent(in), optional | cunit | ||
) |
Read data to a 1-d field. To work with n-d arrays, use the fortran rank remapping feature of fortran2003:
varName | the variable name to read, must be similar or equal to the one set in get_dimensions() |
field | the preallocated multi-dimensional field |
cunit | the unit to read the variable in. "" or unset ignore units. |
integer function fimex::reduce_dimension | ( | class(fimexio), intent(in) | this, |
character(len=*), intent(in) | dimName, | ||
integer(kind=c_int), intent(in) | start, | ||
integer(kind=c_int), intent(in) | dsize | ||
) |
Reduce the dimension by setting a start and size.
dimName | dimension name, e.g. retrieved by get_dimname() |
start | start-position in the dimension to retrieve the data, first position is 0! |
dsize | size of the dimension. This may not be too large, e.g. start+size must be < total dimension size |
integer function fimex::set_filetype | ( | character(len=*), intent(in) | filetype_name, |
integer, intent(in), optional | flag | ||
) |
translate the filetype from string to internal number
filetype_name | filetype as "fimex", "netcdf", "grib", ... |
Referenced by fimex2d_example(), and fortran_test().
integer function fimex::write_data | ( | class(fimexio), intent(in) | this, |
character(len=*), intent(in) | varname, | ||
real(kind=c_double), dimension(:), intent(inout), allocatable, target | field, | ||
character(len=*), intent(in), optional | cunit | ||
) |
Write data to a file.
varName | the variable name to write, must be similar or equal to the one set in get_dimensions() |
field | the data, which must be 1d-allocatable |
cunit | the unit the variable is currently in. "" or unset ignores units. |