add_fvar Subroutine

subroutine add_fvar(cf, vname, vtype, dims, units, long_name, rc)

add_fvar – PFIO utility routine to create a variable and set attributes

Arguments

Type IntentOptional 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

Calls

proc~~add_fvar~~CallsGraph proc~add_fvar add_fvar none~add_attribute~3 Variable%add_attribute proc~add_fvar->none~add_attribute~3 none~add_variable~2 FileMetadata%add_variable proc~add_fvar->none~add_variable~2 proc~mapl_abort MAPL_abort proc~add_fvar->proc~mapl_abort proc~mapl_verify MAPL_Verify proc~add_fvar->proc~mapl_verify none~add_attribute_1d~2 Variable%add_attribute_1d none~add_attribute~3->none~add_attribute_1d~2 at at none~add_variable~2->at begin begin none~add_variable~2->begin interface~mapl_assert MAPL_Assert none~add_variable~2->interface~mapl_assert next next none~add_variable~2->next none~get_const_value Variable%get_const_value none~add_variable~2->none~get_const_value none~get_dimensions~3 Variable%get_dimensions none~add_variable~2->none~get_dimensions~3 none~get_shape UnlimitedEntity%get_shape none~add_variable~2->none~get_shape none~insert~198 StringVariableMap%insert none~add_variable~2->none~insert~198 none~is_empty UnlimitedEntity%is_empty none~add_variable~2->none~is_empty of of none~add_variable~2->of proc~mapl_return MAPL_Return none~add_variable~2->proc~mapl_return push_back push_back none~add_variable~2->push_back mpi_abort mpi_abort proc~mapl_abort->mpi_abort proc~mapl_throw_exception MAPL_throw_exception proc~mapl_verify->proc~mapl_throw_exception none~add_attribute_1d~2->proc~mapl_return none~insert~179 StringAttributeMap%insert none~add_attribute_1d~2->none~insert~179 none~get_shape->proc~mapl_return none~insert_pair~16 StringVariableMap%insert_pair none~insert~198->none~insert_pair~16 none~is_empty->proc~mapl_return none~get_value~23 UnlimitedEntity%get_value none~is_empty->none~get_value~23 proc~mapl_return->at proc~mapl_return->proc~mapl_throw_exception insert insert proc~mapl_return->insert none~get_value~23->proc~mapl_return none~insert_pair~15 StringAttributeMap%insert_pair none~insert~179->none~insert_pair~15

Called by

proc~~add_fvar~~CalledByGraph proc~add_fvar add_fvar proc~create_file_metada create_file_metada proc~create_file_metada->proc~add_fvar program~main~7 main program~main~7->proc~create_file_metada

Source Code

   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