libsim Versione 7.2.0

◆ gridinfo_import_from_file()

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

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

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

Generated with Doxygen.