FORCES
FORtran lib for Comp. Env. Sys.
|
Extended dump_netcdf for multiple variables. More...
Public Member Functions | |
subroutine | var2nc_1d_i4 (f_name, arr, dnames, v_name, dim_unlimited, long_name, units, missing_value, attributes, create, ncid, nrec) |
subroutine | var2nc_1d_sp (f_name, arr, dnames, v_name, dim_unlimited, long_name, units, missing_value, attributes, create, ncid, nrec) |
subroutine | var2nc_1d_dp (f_name, arr, dnames, v_name, dim_unlimited, long_name, units, missing_value, attributes, create, ncid, nrec) |
subroutine | var2nc_2d_i4 (f_name, arr, dnames, v_name, dim_unlimited, long_name, units, missing_value, attributes, create, ncid, nrec) |
subroutine | var2nc_2d_sp (f_name, arr, dnames, v_name, dim_unlimited, long_name, units, missing_value, attributes, create, ncid, nrec) |
subroutine | var2nc_2d_dp (f_name, arr, dnames, v_name, dim_unlimited, long_name, units, missing_value, attributes, create, ncid, nrec) |
subroutine | var2nc_3d_i4 (f_name, arr, dnames, v_name, dim_unlimited, long_name, units, missing_value, attributes, create, ncid, nrec) |
subroutine | var2nc_3d_sp (f_name, arr, dnames, v_name, dim_unlimited, long_name, units, missing_value, attributes, create, ncid, nrec) |
subroutine | var2nc_3d_dp (f_name, arr, dnames, v_name, dim_unlimited, long_name, units, missing_value, attributes, create, ncid, nrec) |
subroutine | var2nc_4d_i4 (f_name, arr, dnames, v_name, dim_unlimited, long_name, units, missing_value, attributes, create, ncid, nrec) |
subroutine | var2nc_4d_sp (f_name, arr, dnames, v_name, dim_unlimited, long_name, units, missing_value, attributes, create, ncid, nrec) |
subroutine | var2nc_4d_dp (f_name, arr, dnames, v_name, dim_unlimited, long_name, units, missing_value, attributes, create, ncid, nrec) |
subroutine | var2nc_5d_i4 (f_name, arr, dnames, v_name, dim_unlimited, long_name, units, missing_value, attributes, create, ncid, nrec) |
subroutine | var2nc_5d_sp (f_name, arr, dnames, v_name, dim_unlimited, long_name, units, missing_value, attributes, create, ncid, nrec) |
subroutine | var2nc_5d_dp (f_name, arr, dnames, v_name, dim_unlimited, long_name, units, missing_value, attributes, create, ncid, nrec) |
Extended dump_netcdf for multiple variables.
Write different variables including attributes to netcdf file. The attributes are restricted to long_name, units, and missing_value. It is also possible to append variables when an unlimited dimension is specified.
Example
Let <field> be some three dimensional array
The simplest call to write <field> to a file is
With attributes it looks like
or alternatively
To be able to dynamically write <field>, an unlimited dimension needs to be specified (in this example field could also be only two dimensional)
Now one can append an arbitrary number of time steps, e.g., the next 9 and the time has to be added again before
You can also write another variable sharing the same dimensions
The netcdf file can stay open after the first call and subsequent calls can use the file unit
One can also give the start record number (on the unlimited dimension)
That's it, enjoy!
Literature
The manual of the used netcdf fortran library can be found in Robert Pincus & Ross Rew, The netcdf Fortran 90 Interface Guide
[in] | character(*) :: f_name | filename |
[in] | integer(i4)/real(sp,dp) :: arr(:[,:[,:[,:[,:]]]]) | array to write |
[in] | character(*) :: dnames(:) | dimension names |
[in] | character(*) :: v_name | variable name |
[in] | integer(i4), optional :: dim_unlimited | index of unlimited dimension |
[in] | character(*), optional :: long_name | attribute |
[in] | character(*), optional :: units | attribute |
[in] | integer(i4)/real(sp,dp), optional :: missing_value | attribute |
[in] | character(256), dimension(:,:), optional :: attributes | two dimensional array of attributes size of first dimension equals number of attributes first entry of second dimension equals attribute name (e.g. long_name) second entry of second dimension equals attribute value (e.g. precipitation) every attribute is written as string with the exception of missing_value |
[in] | logical, optional :: create | flag - specify whether a output file should be created, default |
[in,out] | integer(i4)/real(sp,dp), optional :: ncid | if not given filename will be opened and closed if given and <0 then file will be opened and ncid will return the file unit. if given and >0 then file is assumed open and ncid is used as file unit. |
[in] | integer(i4), optional :: nrec | if given: start point on unlimited dimension. |
Definition at line 303 of file mo_ncwrite.f90.
subroutine mo_ncwrite::var2nc::var2nc_1d_dp | ( | character(len = *), intent(in) | f_name, |
real(dp), dimension(:), intent(in) | arr, | ||
character(len = *), dimension(:), intent(in) | dnames, | ||
character(len = *), intent(in) | v_name, | ||
integer(i4), intent(in), optional | dim_unlimited, | ||
character(len = *), intent(in), optional | long_name, | ||
character(len = *), intent(in), optional | units, | ||
real(dp), intent(in), optional | missing_value, | ||
character(256), dimension(:, :), intent(in), optional | attributes, | ||
logical, intent(in), optional | create, | ||
integer(i4), intent(inout), optional | ncid, | ||
integer(i4), intent(in), optional | nrec | ||
) |
Definition at line 3103 of file mo_ncwrite.f90.
subroutine mo_ncwrite::var2nc::var2nc_1d_i4 | ( | character(len = *), intent(in) | f_name, |
integer(i4), dimension(:), intent(in) | arr, | ||
character(len = *), dimension(:), intent(in) | dnames, | ||
character(len = *), intent(in) | v_name, | ||
integer(i4), intent(in), optional | dim_unlimited, | ||
character(len = *), intent(in), optional | long_name, | ||
character(len = *), intent(in), optional | units, | ||
integer(i4), intent(in), optional | missing_value, | ||
character(256), dimension(:, :), intent(in), optional | attributes, | ||
logical, intent(in), optional | create, | ||
integer(i4), intent(inout), optional | ncid, | ||
integer(i4), intent(in), optional | nrec | ||
) |
Definition at line 2762 of file mo_ncwrite.f90.
subroutine mo_ncwrite::var2nc::var2nc_1d_sp | ( | character(len = *), intent(in) | f_name, |
real(sp), dimension(:), intent(in) | arr, | ||
character(len = *), dimension(:), intent(in) | dnames, | ||
character(len = *), intent(in) | v_name, | ||
integer(i4), intent(in), optional | dim_unlimited, | ||
character(len = *), intent(in), optional | long_name, | ||
character(len = *), intent(in), optional | units, | ||
real(sp), intent(in), optional | missing_value, | ||
character(256), dimension(:, :), intent(in), optional | attributes, | ||
logical, intent(in), optional | create, | ||
integer(i4), intent(inout), optional | ncid, | ||
integer(i4), intent(in), optional | nrec | ||
) |
Definition at line 2933 of file mo_ncwrite.f90.
subroutine mo_ncwrite::var2nc::var2nc_2d_dp | ( | character(len = *), intent(in) | f_name, |
real(dp), dimension(:, :), intent(in) | arr, | ||
character(len = *), dimension(:), intent(in) | dnames, | ||
character(len = *), intent(in) | v_name, | ||
integer(i4), intent(in), optional | dim_unlimited, | ||
character(len = *), intent(in), optional | long_name, | ||
character(len = *), intent(in), optional | units, | ||
real(dp), intent(in), optional | missing_value, | ||
character(256), dimension(:, :), intent(in), optional | attributes, | ||
logical, intent(in), optional | create, | ||
integer(i4), intent(inout), optional | ncid, | ||
integer(i4), intent(in), optional | nrec | ||
) |
Definition at line 3633 of file mo_ncwrite.f90.
subroutine mo_ncwrite::var2nc::var2nc_2d_i4 | ( | character(len = *), intent(in) | f_name, |
integer(i4), dimension(:, :), intent(in) | arr, | ||
character(len = *), dimension(:), intent(in) | dnames, | ||
character(len = *), intent(in) | v_name, | ||
integer(i4), intent(in), optional | dim_unlimited, | ||
character(len = *), intent(in), optional | long_name, | ||
character(len = *), intent(in), optional | units, | ||
integer(i4), intent(in), optional | missing_value, | ||
character(256), dimension(:, :), intent(in), optional | attributes, | ||
logical, intent(in), optional | create, | ||
integer(i4), intent(inout), optional | ncid, | ||
integer(i4), intent(in), optional | nrec | ||
) |
Definition at line 3273 of file mo_ncwrite.f90.
subroutine mo_ncwrite::var2nc::var2nc_2d_sp | ( | character(len = *), intent(in) | f_name, |
real(sp), dimension(:, :), intent(in) | arr, | ||
character(len = *), dimension(:), intent(in) | dnames, | ||
character(len = *), intent(in) | v_name, | ||
integer(i4), intent(in), optional | dim_unlimited, | ||
character(len = *), intent(in), optional | long_name, | ||
character(len = *), intent(in), optional | units, | ||
real(sp), intent(in), optional | missing_value, | ||
character(256), dimension(:, :), intent(in), optional | attributes, | ||
logical, intent(in), optional | create, | ||
integer(i4), intent(inout), optional | ncid, | ||
integer(i4), intent(in), optional | nrec | ||
) |
Definition at line 3453 of file mo_ncwrite.f90.
subroutine mo_ncwrite::var2nc::var2nc_3d_dp | ( | character(len = *), intent(in) | f_name, |
real(dp), dimension(:, :, :), intent(in) | arr, | ||
character(len = *), dimension(:), intent(in) | dnames, | ||
character(len = *), intent(in) | v_name, | ||
integer(i4), intent(in), optional | dim_unlimited, | ||
character(len = *), intent(in), optional | long_name, | ||
character(len = *), intent(in), optional | units, | ||
real(dp), intent(in), optional | missing_value, | ||
character(256), dimension(:, :), intent(in), optional | attributes, | ||
logical, intent(in), optional | create, | ||
integer(i4), intent(inout), optional | ncid, | ||
integer(i4), intent(in), optional | nrec | ||
) |
Definition at line 4174 of file mo_ncwrite.f90.
subroutine mo_ncwrite::var2nc::var2nc_3d_i4 | ( | character(len = *), intent(in) | f_name, |
integer(i4), dimension(:, :, :), intent(in) | arr, | ||
character(len = *), dimension(:), intent(in) | dnames, | ||
character(len = *), intent(in) | v_name, | ||
integer(i4), intent(in), optional | dim_unlimited, | ||
character(len = *), intent(in), optional | long_name, | ||
character(len = *), intent(in), optional | units, | ||
integer(i4), intent(in), optional | missing_value, | ||
character(256), dimension(:, :), intent(in), optional | attributes, | ||
logical, intent(in), optional | create, | ||
integer(i4), intent(inout), optional | ncid, | ||
integer(i4), intent(in), optional | nrec | ||
) |
Definition at line 3813 of file mo_ncwrite.f90.
subroutine mo_ncwrite::var2nc::var2nc_3d_sp | ( | character(len = *), intent(in) | f_name, |
real(sp), dimension(:, :, :), intent(in) | arr, | ||
character(len = *), dimension(:), intent(in) | dnames, | ||
character(len = *), intent(in) | v_name, | ||
integer(i4), intent(in), optional | dim_unlimited, | ||
character(len = *), intent(in), optional | long_name, | ||
character(len = *), intent(in), optional | units, | ||
real(sp), intent(in), optional | missing_value, | ||
character(256), dimension(:, :), intent(in), optional | attributes, | ||
logical, intent(in), optional | create, | ||
integer(i4), intent(inout), optional | ncid, | ||
integer(i4), intent(in), optional | nrec | ||
) |
Definition at line 3993 of file mo_ncwrite.f90.
subroutine mo_ncwrite::var2nc::var2nc_4d_dp | ( | character(len = *), intent(in) | f_name, |
real(dp), dimension(:, :, :, :), intent(in) | arr, | ||
character(len = *), dimension(:), intent(in) | dnames, | ||
character(len = *), intent(in) | v_name, | ||
integer(i4), intent(in), optional | dim_unlimited, | ||
character(len = *), intent(in), optional | long_name, | ||
character(len = *), intent(in), optional | units, | ||
real(dp), intent(in), optional | missing_value, | ||
character(256), dimension(:, :), intent(in), optional | attributes, | ||
logical, intent(in), optional | create, | ||
integer(i4), intent(inout), optional | ncid, | ||
integer(i4), intent(in), optional | nrec | ||
) |
Definition at line 4718 of file mo_ncwrite.f90.
subroutine mo_ncwrite::var2nc::var2nc_4d_i4 | ( | character(len = *), intent(in) | f_name, |
integer(i4), dimension(:, :, :, :), intent(in) | arr, | ||
character(len = *), dimension(:), intent(in) | dnames, | ||
character(len = *), intent(in) | v_name, | ||
integer(i4), intent(in), optional | dim_unlimited, | ||
character(len = *), intent(in), optional | long_name, | ||
character(len = *), intent(in), optional | units, | ||
integer(i4), intent(in), optional | missing_value, | ||
character(256), dimension(:, :), intent(in), optional | attributes, | ||
logical, intent(in), optional | create, | ||
integer(i4), intent(inout), optional | ncid, | ||
integer(i4), intent(in), optional | nrec | ||
) |
Definition at line 4354 of file mo_ncwrite.f90.
subroutine mo_ncwrite::var2nc::var2nc_4d_sp | ( | character(len = *), intent(in) | f_name, |
real(sp), dimension(:, :, :, :), intent(in) | arr, | ||
character(len = *), dimension(:), intent(in) | dnames, | ||
character(len = *), intent(in) | v_name, | ||
integer(i4), intent(in), optional | dim_unlimited, | ||
character(len = *), intent(in), optional | long_name, | ||
character(len = *), intent(in), optional | units, | ||
real(sp), intent(in), optional | missing_value, | ||
character(256), dimension(:, :), intent(in), optional | attributes, | ||
logical, intent(in), optional | create, | ||
integer(i4), intent(inout), optional | ncid, | ||
integer(i4), intent(in), optional | nrec | ||
) |
Definition at line 4536 of file mo_ncwrite.f90.
subroutine mo_ncwrite::var2nc::var2nc_5d_dp | ( | character(len = *), intent(in) | f_name, |
real(dp), dimension(:, :, :, :, :), intent(in) | arr, | ||
character(len = *), dimension(:), intent(in) | dnames, | ||
character(len = *), intent(in) | v_name, | ||
integer(i4), intent(in), optional | dim_unlimited, | ||
character(len = *), intent(in), optional | long_name, | ||
character(len = *), intent(in), optional | units, | ||
real(dp), intent(in), optional | missing_value, | ||
character(256), dimension(:, :), intent(in), optional | attributes, | ||
logical, intent(in), optional | create, | ||
integer(i4), intent(inout), optional | ncid, | ||
integer(i4), intent(in), optional | nrec | ||
) |
Definition at line 5244 of file mo_ncwrite.f90.
subroutine mo_ncwrite::var2nc::var2nc_5d_i4 | ( | character(len = *), intent(in) | f_name, |
integer(i4), dimension(:, :, :, :, :), intent(in) | arr, | ||
character(len = *), dimension(:), intent(in) | dnames, | ||
character(len = *), intent(in) | v_name, | ||
integer(i4), intent(in), optional | dim_unlimited, | ||
character(len = *), intent(in), optional | long_name, | ||
character(len = *), intent(in), optional | units, | ||
integer(i4), intent(in), optional | missing_value, | ||
character(256), dimension(:, :), intent(in), optional | attributes, | ||
logical, intent(in), optional | create, | ||
integer(i4), intent(inout), optional | ncid, | ||
integer(i4), intent(in), optional | nrec | ||
) |
Definition at line 4900 of file mo_ncwrite.f90.
subroutine mo_ncwrite::var2nc::var2nc_5d_sp | ( | character(len = *), intent(in) | f_name, |
real(sp), dimension(:, :, :, :, :), intent(in) | arr, | ||
character(len = *), dimension(:), intent(in) | dnames, | ||
character(len = *), intent(in) | v_name, | ||
integer(i4), intent(in), optional | dim_unlimited, | ||
character(len = *), intent(in), optional | long_name, | ||
character(len = *), intent(in), optional | units, | ||
real(sp), intent(in), optional | missing_value, | ||
character(256), dimension(:, :), intent(in), optional | attributes, | ||
logical, intent(in), optional | create, | ||
integer(i4), intent(inout), optional | ncid, | ||
integer(i4), intent(in), optional | nrec | ||
) |
Definition at line 5072 of file mo_ncwrite.f90.