|
libsim Versione 8.0.0
|
◆ gridinfo_init()
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.
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
|