add_fvar
– PFIO utility routine to create a variable and set attributes
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(FileMetadata), | intent(inout) | :: | cf | |||
character(len=*), | intent(in) | :: | vname | |||
integer, | intent(in) | :: | vtype | |||
character(len=*), | intent(in) | :: | dims | |||
character(len=*), | intent(in), | optional | :: | units | ||
character(len=*), | intent(in), | optional | :: | long_name | ||
integer, | intent(out), | optional | :: | rc |
subroutine add_fvar(cf, vname, vtype, dims, units, long_name ,rc) type(FileMetadata), intent(inout) :: cf integer, intent(in) :: vtype character(len=*), intent(in) :: vname character(len=*), intent(in) :: dims character(len=*), optional, intent(in) :: units character(len=*), optional, intent(in) :: long_name integer, optional, intent(out) :: rc integer :: status type(Variable) :: fvar fvar = Variable(type=vtype, dimensions=TRIM(dims)) if (present(units)) call fvar%add_attribute('units', TRIM(units)) if (present(long_name)) call fvar%add_attribute('long_name', TRIM(long_name)) call fvar%add_attribute("scale_factor", 1.0) call fvar%add_attribute("add_offset", 0.0) !if (mod(pe_id,2) == 0) then ! call fvar%add_attribute("missing_value", -9999.0) !else ! call fvar%add_attribute("missing_value", pfio_missing_value) !endif call fvar%add_attribute("missing_value", pfio_missing_value) call fvar%add_attribute("_FillValue", pfio_fill_value) call fvar%add_attribute('valid_range', pfio_valid_range) call fvar%add_attribute("vmin", pfio_vmin) call fvar%add_attribute("vmax", pfio_vmax) call cf%add_variable(TRIM(vname), fvar, rc=status) _VERIFY(status) end subroutine add_fvar