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 FileMetadata%add_variable proc~add_fvar->none~add_variable 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->at begin begin none~add_variable->begin get get none~add_variable->get interface~mapl_assert MAPL_Assert none~add_variable->interface~mapl_assert next next none~add_variable->next none~get_const_value Variable%get_const_value none~add_variable->none~get_const_value none~get_dimensions~2 Variable%get_dimensions none~add_variable->none~get_dimensions~2 none~get_shape UnlimitedEntity%get_shape none~add_variable->none~get_shape none~insert~42 StringVariableMap%insert none~add_variable->none~insert~42 none~is_empty UnlimitedEntity%is_empty none~add_variable->none~is_empty proc~mapl_return MAPL_Return none~add_variable->proc~mapl_return push_back push_back none~add_variable->push_back proc~mapl_throw_exception MAPL_throw_exception proc~mapl_verify->proc~mapl_throw_exception none~add_attribute_1d~2->proc~mapl_return none~insert~106 StringAttributeMap%insert none~add_attribute_1d~2->none~insert~106 none~get_shape->proc~mapl_return none~insert_pair~3 StringVariableMap%insert_pair none~insert~42->none~insert_pair~3 none~is_empty->proc~mapl_return none~get_value UnlimitedEntity%get_value none~is_empty->none~get_value proc~mapl_return->at proc~mapl_return->proc~mapl_throw_exception insert insert proc~mapl_return->insert none~get_value->proc~mapl_return none~insert_pair~10 StringAttributeMap%insert_pair none~insert~106->none~insert_pair~10

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~2 main program~main~2->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