| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(t_ncfile), | intent(inout) | :: | sf |
self |
||
| character(len=*), | intent(in) | :: | varname_in |
name of the variable |
||
| integer, | intent(in) | :: | n_attr |
number of attributes |
||
| character(len=*), | intent(in) | :: | attrs_names(:) |
Array of attribute names |
||
| character(len=*), | intent(in) | :: | attr_values(:) |
double input |
SUBROUTINE ncfile_put_attributes_char(sf,varname_in,n_attr,attrs_names,attr_values) ! MODULES IMPLICIT NONE !------------------------------------------------------------------------------------------------------------------------------- ! INPUT VARIABLES CHARACTER(LEN=*),INTENT(IN) :: varname_in !! name of the variable INTEGER, INTENT(IN) :: n_attr !! number of attributes CHARACTER(LEN=*),INTENT(IN) :: attrs_names(:) !! Array of attribute names CHARACTER(LEN=*),INTENT(IN) :: attr_values(:) !! double input !------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES CLASS(t_ncfile),INTENT(INOUT):: sf !! self ! LOCAL VARIABLES INTEGER :: varid !! ID of the variable INTEGER :: i !! iterable !=============================================================================================================================== CALL mpi_check_single_access() #if NETCDF DO i=1,n_attr sf%ioError = nf90_INQ_VARID(sf%nc_id, TRIM(varname_in), varid) CALL sf%handle_error("find varid during attribute write for '"//TRIM(varname_in)//"'") sf%ioError = nf90_put_att(sf%nc_id, varid, TRIM(attrs_names(i)), TRIM(attr_values(i))) CALL sf%handle_error("Putting attribute '"//TRIM(attrs_names(i))//"'") END DO #else CALL abort(__STAMP__,& "cannot write array, BUILD_NETCDF=OFF") #endif /*NETCDF*/ END SUBROUTINE ncfile_put_attributes_char