libsim  Versione7.2.6

◆ 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 905 del file gridinfo_class.F90.

905 
906 CALL init(this, statproc, p1, p2)
907 
908 END SUBROUTINE timerange_import_gribapi
909 
910 
911 SUBROUTINE timerange_export_gribapi(this, gaid, reftime)
912 TYPE(vol7d_timerange),INTENT(in) :: this ! vol7d_timerange object
913 INTEGER,INTENT(in) :: gaid ! grib_api id of the grib loaded in memory to export
914 TYPE(datetime) :: reftime ! reference time of data, used for coding correct end of statistical processing period in grib2
915 
916 INTEGER :: EditionNumber, centre, tri, currentunit, unit, p1_g1, p2_g1, p1, p2, pdtn
917 CHARACTER(len=8) :: env_var
918 LOGICAL :: g2cosmo_behavior
919 
920 CALL grib_get(gaid,'GRIBEditionNumber',EditionNumber)
921 
922 IF (editionnumber == 1 ) THEN
923 ! Convert vol7d_timerange members to grib1 with reasonable time unit
924  CALL grib_get(gaid,'indicatorOfUnitOfTimeRange',currentunit)
925  CALL timerange_v7d_to_g1(this%timerange, this%p1, this%p2, &
926  tri, p1_g1, p2_g1, unit)
927 ! Set the native keys
928  CALL grib_set(gaid,'timeRangeIndicator',tri)
929  CALL grib_set(gaid,'P1',p1_g1)
930  CALL grib_set(gaid,'P2',p2_g1)
931  CALL grib_set(gaid,'indicatorOfUnitOfTimeRange',unit)
932 
933 ELSE IF (editionnumber == 2) THEN
934  CALL grib_get(gaid,'productDefinitionTemplateNumber', pdtn)
935 
936  IF (this%timerange == 254) THEN ! point in time -> template 4.0
937  IF (pdtn < 0 .OR. pdtn > 7) &
938  CALL grib_set(gaid,'productDefinitionTemplateNumber', 0)
939 ! Set reasonable time unit
940  CALL timerange_v7d_to_g2(this%p1,p1,unit)
941 ! Set the native keys
942  CALL grib_set(gaid,'indicatorOfUnitOfTimeRange',unit)
943  CALL grib_set(gaid,'forecastTime',p1)
944 
945  ELSE IF (this%timerange >= 0 .AND. this%timerange < 254) THEN
946 ! statistically processed -> template 4.8
947  IF (pdtn < 8 .OR. pdtn > 14) &
948  CALL grib_set(gaid,'productDefinitionTemplateNumber', 8)
949 
950  IF (this%p1 >= this%p2) THEN ! forecast-like
951 ! Set reasonable time unit
952  CALL timerange_v7d_to_g2(this%p1-this%p2,p1,unit)
953  CALL grib_set(gaid,'indicatorOfUnitOfTimeRange',unit)
954  CALL grib_set(gaid,'forecastTime',p1)
955  CALL code_endoftimeinterval(reftime+timedelta_new(sec=this%p1))
956 ! Successive times processed have same start time of forecast,
957 ! forecast time is incremented
958  CALL grib_set(gaid,'typeOfStatisticalProcessing',this%timerange)
959 ! typeOfTimeIncrement to be replaced with a check that typeOfProcessedData /= 0
960  CALL grib_set(gaid,'typeOfTimeIncrement',2)
961  CALL timerange_v7d_to_g2(this%p2,p2,unit)
962  CALL grib_set(gaid,'indicatorOfUnitForTimeRange',unit)
963  CALL grib_set(gaid,'lengthOfTimeRange',p2)
964 
965  ELSE IF (this%p1 == 0) THEN ! analysis-like
966 ! Set reasonable time unit

Generated with Doxygen.