libsim Versione 8.0.0

◆ 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 )

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

Generated with Doxygen.