libsim Versione 7.2.6
|
◆ 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. 692SUBROUTINE time_export_gribapi(this, gaid, timerange)
693TYPE(datetime),INTENT(in) :: this ! datetime object
694INTEGER,INTENT(in) :: gaid ! grib_api id of the grib loaded in memory to export
695TYPE(vol7d_timerange) :: timerange ! timerange, used for grib2 coding of statistically processed analysed data
696
697INTEGER :: EditionNumber, centre
698CHARACTER(len=8) :: env_var
699LOGICAL :: g2cosmo_behavior
700
701CALL grib_get(gaid,'GRIBEditionNumber',editionnumber)
702
703IF (editionnumber == 1) THEN
704
705 CALL code_referencetime(this)
706
707ELSE 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
726ELSE
727
728 CALL l4f_log(l4f_error,'GribEditionNumber '//t2c(editionnumber)//' not supported')
729 CALL raise_error()
730
731ENDIF
732
733CONTAINS
734
735SUBROUTINE code_referencetime(reftime)
736TYPE(datetime),INTENT(in) :: reftime
737
738INTEGER :: date,time
739CHARACTER(len=17) :: date_time
740
741! datetime is AAAAMMGGhhmmssmsc
742CALL getval(reftime, simpledate=date_time)
743READ(date_time(:8),'(I8)')date
744READ(date_time(9:12),'(I4)')time
745CALL grib_set(gaid,'dataDate',date)
746CALL grib_set(gaid,'dataTime',time)
747
748END SUBROUTINE code_referencetime
749
750END SUBROUTINE time_export_gribapi
751
752
753SUBROUTINE level_import_gribapi(this, gaid)
754TYPE(vol7d_level),INTENT(out) :: this ! vol7d_level object
755INTEGER,INTENT(in) :: gaid ! grib_api id of the grib loaded in memory to import
756
757INTEGER :: EditionNumber,level1,l1,level2,l2
758INTEGER :: ltype,ltype1,scalef1,scalev1,ltype2,scalef2,scalev2
759
|