libsim  Versione7.2.6

◆ gridinfo_init()

subroutine gridinfo_class::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 702 del file gridinfo_class.F90.

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

Generated with Doxygen.