libsim Versione 7.2.4

◆ gridinfo_init()

subroutine gridinfo_init ( type(gridinfo_def), intent(out) this,
type(grid_id), intent(in), optional gaid,
type(griddim_def), intent(in), optional griddim,
type(datetime), intent(in), optional time,
type(vol7d_timerange), intent(in), optional timerange,
type(vol7d_level), intent(in), optional level,
type(volgrid6d_var), intent(in), optional var,
logical, intent(in), optional clone,
character(len=*), intent(in), optional categoryappend )
private

Constructor, it creates a new instance of the object.

All the additional parameters are optional and they will be initialised to the corresponding missing value if not provided.

Parametri
[out]thisobject to be initialized
[in]gaididentificator of the grid to be described
[in]griddimgrid descriptor
[in]timetime dimension descriptor
[in]timerangetimerange (forecast, analysis, statistically processed) dimension descriptor
[in]levelvertical level dimension descriptor
[in]varphysical variable dimension descriptor
[in]cloneif provided and .TRUE., the gaid will be cloned and not simply copied into the gridinfo object
[in]categoryappendappend this suffix to log4fortran namespace category

Definizione alla linea 690 del file gridinfo_class.F90.

692
693 IF (timerange%p1 >= timerange%p2) THEN ! forecast-like
694 CALL code_referencetime(this)
695 ELSE IF (timerange%p1 == 0) THEN ! analysis-like
696! ready for coding with general convention
697 CALL getenv('LIBSIM_G2COSMO_BEHAVIOR', env_var)
698 g2cosmo_behavior = len_trim(env_var) > 0
699 CALL grib_get(gaid,'centre',centre)
700 IF (g2cosmo_behavior .AND. centre == 78) THEN ! DWD analysis exception
701 CALL code_referencetime(this)
702 ELSE ! cosmo or old simc convention
703 CALL code_referencetime(this-timedelta_new(sec=timerange%p2))
704 ENDIF
705 ELSE ! bad timerange
706 CALL l4f_log( l4f_error, 'Timerange with 0>p1>p2 cannot be exported in grib2')
707 CALL raise_error()
708 ENDIF
709
710ELSE
711
712 CALL l4f_log(l4f_error,'GribEditionNumber '//t2c(editionnumber)//' not supported')
713 CALL raise_error()
714
715ENDIF
716
717CONTAINS
718
719SUBROUTINE code_referencetime(reftime)
720TYPE(datetime),INTENT(in) :: reftime
721
722INTEGER :: date,time
723CHARACTER(len=17) :: date_time
724
725! datetime is AAAAMMGGhhmmssmsc
726CALL getval(reftime, simpledate=date_time)
727READ(date_time(:8),'(I8)')date
728READ(date_time(9:12),'(I4)')time
729CALL grib_set(gaid,'dataDate',date)
730CALL grib_set(gaid,'dataTime',time)
731
732END SUBROUTINE code_referencetime
733
734END SUBROUTINE time_export_gribapi
735
736
737SUBROUTINE level_import_gribapi(this, gaid)
738TYPE(vol7d_level),INTENT(out) :: this ! vol7d_level object
739INTEGER,INTENT(in) :: gaid ! grib_api id of the grib loaded in memory to import
740
741INTEGER :: EditionNumber,level1,l1,level2,l2
742INTEGER :: ltype,ltype1,scalef1,scalev1,ltype2,scalef2,scalev2
743
744call grib_get(gaid,'GRIBEditionNumber',editionnumber)
745
746if (editionnumber == 1)then
747
748 call grib_get(gaid,'indicatorOfTypeOfLevel',ltype)
749 call grib_get(gaid,'topLevel',l1)
750 call grib_get(gaid,'bottomLevel',l2)
751
752 call level_g1_to_g2(ltype,l1,l2,ltype1,scalef1,scalev1,ltype2,scalef2,scalev2)
753
754else if (editionnumber == 2)then
755
756 call grib_get(gaid,'typeOfFirstFixedSurface',ltype1)
757 call grib_get(gaid,'scaleFactorOfFirstFixedSurface',scalef1)
758 call grib_get(gaid,'scaledValueOfFirstFixedSurface',scalev1)
759 IF (scalef1 == -1 .OR. scalev1 == -1) THEN

Generated with Doxygen.