libsim  Versione 7.2.1

◆ gridinfo_import_from_file()

subroutine gridinfo_import_from_file ( type(arrayof_gridinfo this,
character(len=*), intent(in)  filename,
character(len=*), intent(in), optional  categoryappend 
)

Import an array of gridinfo from a file.

It receives a (possibly unallocated) array of gridinfo objects which will be extended by a number of elements equal to the number of gridded messages/bands found in the file provided and it will be filled with all the data found. In case of error, the gridinfo object will not be allocated, so the success can be tested by checking thisarraysize.

Parametri
thisarray of gridinfo objects which will be allocated/extended and into which data will be imported
[in]filenamename of file to open and import, in the form [driver:]pathname
[in]categoryappendappend this suffix to log4fortran namespace category

Definizione alla linea 904 del file gridinfo_class.F90.

905 
906 IF (editionnumber == 1 ) THEN
907 ! Convert vol7d_timerange members to grib1 with reasonable time unit
908  CALL grib_get(gaid,'indicatorOfUnitOfTimeRange',currentunit)
909  CALL timerange_v7d_to_g1(this%timerange, this%p1, this%p2, &
910  tri, p1_g1, p2_g1, unit)
911 ! Set the native keys
912  CALL grib_set(gaid,'timeRangeIndicator',tri)
913  CALL grib_set(gaid,'P1',p1_g1)
914  CALL grib_set(gaid,'P2',p2_g1)
915  CALL grib_set(gaid,'indicatorOfUnitOfTimeRange',unit)
916 
917 ELSE IF (editionnumber == 2) THEN
918  CALL grib_get(gaid,'productDefinitionTemplateNumber', pdtn)
919 
920  IF (this%timerange == 254) THEN ! point in time -> template 4.0
921  IF (pdtn < 0 .OR. pdtn > 7) &
922  CALL grib_set(gaid,'productDefinitionTemplateNumber', 0)
923 ! Set reasonable time unit
924  CALL timerange_v7d_to_g2(this%p1,p1,unit)
925 ! Set the native keys
926  CALL grib_set(gaid,'indicatorOfUnitOfTimeRange',unit)
927  CALL grib_set(gaid,'forecastTime',p1)
928 
929  ELSE IF (this%timerange >= 0 .AND. this%timerange < 254) THEN
930 ! statistically processed -> template 4.8
931  IF (pdtn < 8 .OR. pdtn > 14) &
932  CALL grib_set(gaid,'productDefinitionTemplateNumber', 8)
933 
934  IF (this%p1 >= this%p2) THEN ! forecast-like
935 ! Set reasonable time unit
936  CALL timerange_v7d_to_g2(this%p1-this%p2,p1,unit)
937  CALL grib_set(gaid,'indicatorOfUnitOfTimeRange',unit)
938  CALL grib_set(gaid,'forecastTime',p1)
939  CALL code_endoftimeinterval(reftime+timedelta_new(sec=this%p1))
940 ! Successive times processed have same start time of forecast,
941 ! forecast time is incremented
942  CALL grib_set(gaid,'typeOfStatisticalProcessing',this%timerange)
943 ! typeOfTimeIncrement to be replaced with a check that typeOfProcessedData /= 0
944  CALL grib_set(gaid,'typeOfTimeIncrement',2)
945  CALL timerange_v7d_to_g2(this%p2,p2,unit)
946  CALL grib_set(gaid,'indicatorOfUnitForTimeRange',unit)
947  CALL grib_set(gaid,'lengthOfTimeRange',p2)
948 
949  ELSE IF (this%p1 == 0) THEN ! analysis-like
950 ! Set reasonable time unit
951  CALL timerange_v7d_to_g2(this%p2,p2,unit)
952  CALL grib_set(gaid,'indicatorOfUnitOfTimeRange',unit)
953  CALL grib_set(gaid,'forecastTime',0)
954  CALL code_endoftimeinterval(reftime)
955 ! Successive times processed have same forecast time, start time of
956 ! forecast is incremented
957  CALL grib_set(gaid,'typeOfStatisticalProcessing',this%timerange)
958 ! typeOfTimeIncrement to be replaced with typeOfProcessedData

Generated with Doxygen.