get_file_times Subroutine

subroutine get_file_times(filename, itime, alltimes, tseries, timeInterval, tint, tsteps, rc)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename
integer, intent(in) :: itime(2)
logical, intent(in) :: alltimes
type(ESMF_Time), intent(inout), allocatable :: tseries(:)
type(ESMF_TimeInterval), intent(inout) :: timeInterval
integer, intent(out) :: tint
integer, intent(out) :: tsteps
integer, intent(out), optional :: rc

Calls

proc~~get_file_times~2~~CallsGraph proc~get_file_times~2 get_file_times ESMF_TimeIntervalGet ESMF_TimeIntervalGet proc~get_file_times~2->ESMF_TimeIntervalGet ESMF_TimeIntervalSet ESMF_TimeIntervalSet proc~get_file_times~2->ESMF_TimeIntervalSet ESMF_TimeSet ESMF_TimeSet proc~get_file_times~2->ESMF_TimeSet none~get_dimension FileMetadata%get_dimension proc~get_file_times~2->none~get_dimension proc~create FileMetadataUtils%create proc~get_file_times~2->proc~create proc~get_time_info FileMetadataUtils%get_time_info proc~get_file_times~2->proc~get_time_info proc~mapl_return MAPL_Return proc~get_file_times~2->proc~mapl_return proc~mapl_verify MAPL_Verify proc~get_file_times~2->proc~mapl_verify proc~unpackdatetime UnpackDateTime proc~get_file_times~2->proc~unpackdatetime none~get_dimension->proc~mapl_return at at none~get_dimension->at find find none~get_dimension->find proc~get_time_info->ESMF_TimeIntervalSet proc~get_time_info->ESMF_TimeSet proc~get_time_info->proc~mapl_return proc~get_time_info->proc~mapl_verify ESMF_TimeGet ESMF_TimeGet proc~get_time_info->ESMF_TimeGet interface~mapl_assert MAPL_Assert proc~get_time_info->interface~mapl_assert none~get_attribute Variable%get_attribute proc~get_time_info->none~get_attribute none~get_coordinate_data CoordinateVariable%get_coordinate_data proc~get_time_info->none~get_coordinate_data none~get_coordinate_variable FileMetadata%get_coordinate_variable proc~get_time_info->none~get_coordinate_variable none~get_value UnlimitedEntity%get_value proc~get_time_info->none~get_value proc~get_coordinate_info FileMetadataUtils%get_coordinate_info proc~get_time_info->proc~get_coordinate_info proc~get_file_name FileMetadataUtils%get_file_name proc~get_time_info->proc~get_file_name proc~mapl_return->at insert insert proc~mapl_return->insert proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception proc~mapl_verify->proc~mapl_throw_exception none~get_attribute->proc~mapl_return none~get_attribute->interface~mapl_assert none~at~226 StringAttributeMap%at none~get_attribute->none~at~226 none~get_coordinate_data->proc~mapl_return none~get_coordinate_variable->proc~mapl_return none~get_coordinate_variable->interface~mapl_assert none~at~139 StringVariableMap%at none~get_coordinate_variable->none~at~139 none~get_value->proc~mapl_return proc~get_coordinate_info->none~get_dimension proc~get_coordinate_info->proc~mapl_return proc~get_coordinate_info->proc~mapl_verify proc~get_coordinate_info->interface~mapl_assert proc~get_coordinate_info->none~get_attribute proc~get_coordinate_info->none~get_coordinate_data proc~get_coordinate_info->none~get_coordinate_variable proc~get_coordinate_info->none~get_value proc~get_coordinate_info->proc~get_file_name none~get_ith_dimension Variable%get_ith_dimension proc~get_coordinate_info->none~get_ith_dimension proc~var_has_attr FileMetadataUtils%var_has_attr proc~get_coordinate_info->proc~var_has_attr proc~get_file_name->proc~mapl_return none~find~35 StringVariableMap%find none~at~139->none~find~35 none~find~59 StringAttributeMap%find none~at~226->none~find~59 none~get_ith_dimension->proc~mapl_return none~get_ith_dimension->at proc~var_has_attr->proc~mapl_return proc~var_has_attr->proc~mapl_verify proc~var_has_attr->interface~mapl_assert proc~var_has_attr->proc~get_file_name none~get_variable FileMetadata%get_variable proc~var_has_attr->none~get_variable none~is_attribute_present Variable%is_attribute_present proc~var_has_attr->none~is_attribute_present

Called by

proc~~get_file_times~2~~CalledByGraph proc~get_file_times~2 get_file_times proc~main~2 main proc~main~2->proc~get_file_times~2 program~regrid_util Regrid_Util program~regrid_util->proc~main~2

Source Code

   subroutine get_file_times(filename,itime,alltimes,tseries,timeInterval,tint,tsteps,rc)
      character(len=*), intent(in) :: filename
      integer, intent(in) :: itime(2)
      logical, intent(in) :: alltimes
      type(ESMF_Time), allocatable, intent(inout) :: tseries(:)
      type(ESMF_TimeInterval), intent(inout) :: timeInterval
      integer, intent(out) :: tint
      integer, intent(out) :: tsteps
      integer, intent(out), optional :: rc

      integer :: status
      integer :: second,minute,hour,day,month,year
      type(NetCDF4_fileFormatter) :: formatter
      type(FileMetadata) :: basic_metadata
      type(FileMetadataUtils) :: metadata

      call formatter%open(trim(filename),pFIO_Read,_RC)
      basic_metadata=formatter%read(_RC)
      call metadata%create(basic_metadata,trim(filename))

      call formatter%close(_RC)

      tsteps = metadata%get_dimension('time',_RC)
      call metadata%get_time_info(timeVector=tSeries,_RC)

      if (.not.allTimes) then
         tSteps=1
         call UnpackDateTIme(itime,year,month,day,hour,minute,second)
         deallocate(tSeries)
         allocate(tSeries(1))
         call ESMF_TimeSet(tSeries(1), yy=year, mm=month, dd=day,  h=hour,  m=minute, s=second,_RC)
      end if
      if (tSteps == 1) then
         call ESMF_TimeIntervalSet( TimeInterval, h=6, m=0, s=0, _RC )
      else
         TimeInterval=tSeries(2)-tSeries(1)
      end if
      call ESMF_TimeIntervalGet(TimeInterval,h=hour,m=minute,s=second,_RC)
      tint=hour*10000+minute*100+second

      _RETURN(_SUCCESS)

   end subroutine get_file_times