|
◆ import_from_gridinfo()
subroutine volgrid6d_class::import_from_gridinfo |
( |
type(volgrid6d), intent(inout) |
this, |
|
|
type(gridinfo_def), intent(in) |
gridinfo, |
|
|
logical, intent(in), optional |
force, |
|
|
integer, intent(in), optional |
dup_mode, |
|
|
logical, intent(in), optional |
clone, |
|
|
logical, intent(in), optional |
isanavar |
|
) |
| |
|
private |
Import a single gridinfo object into a volgrid6d object.
This methods imports a single gridded field from a gridinfo object into a volgrid6d object, inserting it into the multidimensional structure of volgrid6d. The volgrid6d object must have been already initialized and the dimensions specified with volgrid6d_alloc(). If the force argument is missing or .FALSE. , the volgrid6d object dimension descriptors (time, timerange, vertical level, physical variable) must already have space for the corresponding values coming from gridinfo, otherwise the object will be rejected; this means that all the volgrid6d dimension descriptors should be correctly assigned. If force is .TRUE. , the gridinfo dimension descriptors that do not fit into available descriptors in the volgrid6d structure, will be accomodated in a empty (i.e. equal to missing value) descriptor, if available, otherwise the gridinfo will be rejected. The descriptor of the grid in the volgrid object is assigned to the descriptor contained in gridinfo if it is missing in volgrid, otherwise it is checked and the object is rejected if grids do not match.
- Parametri
-
[in,out] | this | object in which to import |
[in] | gridinfo | gridinfo object to be imported |
[in] | force | if provided and .TRUE., the gridinfo is forced into an empty element of this, if required and possible |
[in] | dup_mode | determines the behavior in case of duplicate metadata: if dup_mode is not provided or 0, a duplicate field overwrites, if dup_mode is 1, duplicate fields are merged with priority to the last |
[in] | clone | if provided and .TRUE. , clone the gaid's from gridinfo to this |
[in] | isanavar | if provides and .TRUE., the gridinfo object is treated as time-independent and replicated for every time and timerange |
Definizione alla linea 1021 del file volgrid6d_class.F90.
1022 CALL l4f_category_log(this%category,l4f_debug, "original gaid cloned to a new one") 1025 gaid = this%gaid(ilevel,itime,itimerange,ivar) 1029 IF (this%time_definition == 1 .OR. this%time_definition == 2) THEN 1030 correctedtime = this%time(itime) - & 1031 timedelta_new(sec=this%timerange(itimerange)%p1) 1033 correctedtime = this%time(itime) 1036 CALL init(gridinfo,gaid, this%griddim, correctedtime, this%timerange(itimerange), & 1037 this%level(ilevel), this%var(ivar)) 1040 CALL export(gridinfo%griddim, gridinfo%gaid) 1042 IF ( ASSOCIATED(this%voldati)) THEN 1043 CALL encode_gridinfo(gridinfo, this%voldati(:,:,ilevel,itime,itimerange,ivar)) 1044 ELSE IF (usetemplate) THEN 1046 CALL volgrid_get_vol_2d(this, ilevel, itime, itimerange, ivar, voldati) 1047 CALL encode_gridinfo(gridinfo, voldati) 1051 END SUBROUTINE export_to_gridinfo 1071 SUBROUTINE import_from_gridinfovv(this, gridinfov, dup_mode, clone, decode, & 1072 time_definition, anavar, categoryappend) 1073 TYPE(volgrid6d), POINTER :: this(:) 1074 TYPE(arrayof_gridinfo), INTENT(in) :: gridinfov 1075 INTEGER, INTENT(in), OPTIONAL :: dup_mode 1076 LOGICAL , INTENT(in), OPTIONAL :: clone 1077 LOGICAL, INTENT(in), OPTIONAL :: decode 1078 INTEGER, INTENT(IN), OPTIONAL :: time_definition 1079 CHARACTER(len=*), INTENT(IN), OPTIONAL :: anavar(:) 1080 CHARACTER(len=*), INTENT(in), OPTIONAL :: categoryappend 1082 INTEGER :: i, j, stallo 1083 INTEGER :: ngrid, ntime, ntimerange, nlevel, nvar, ltime_definition 1085 CHARACTER(len=512) :: a_name 1086 TYPE(datetime), ALLOCATABLE :: correctedtime(:) 1087 LOGICAL, ALLOCATABLE :: isanavar(:) 1088 TYPE(vol7d_var) :: lvar 1089 TYPE(vol7d_timerange), ALLOCATABLE :: correctedtimerange(:) 1092 if ( present(categoryappend)) then 1093 call l4f_launcher(a_name,a_name_append=trim(subcategory)// "."//trim(categoryappend)) 1095 call l4f_launcher(a_name,a_name_append=trim(subcategory)) 1097 category=l4f_category_get(a_name) 1100 call l4f_category_log(category,l4f_debug, "start import_from_gridinfovv") 1103 IF ( PRESENT(time_definition)) THEN 1104 ltime_definition = max(min(time_definition, 2), 0) 1106 ltime_definition = 0 1109 ngrid=count_distinct(gridinfov%array(1:gridinfov%arraysize)%griddim,back=.true.) 1110 CALL l4f_category_log(category,l4f_info, t2c(ngrid)// & 1111 ' different grid definition(s) found in input data') 1113 ALLOCATE(this(ngrid),stat=stallo) 1114 IF (stallo /= 0) THEN 1115 CALL l4f_category_log(category,l4f_fatal, "allocating memory") 1116 CALL raise_fatal_error() 1119 IF ( PRESENT(categoryappend)) THEN 1120 CALL init(this(i), time_definition=ltime_definition, categoryappend=trim(categoryappend)// "-vol"//t2c(i)) 1122 CALL init(this(i), time_definition=ltime_definition, categoryappend= "vol"//t2c(i)) 1126 this(:)%griddim=pack_distinct(gridinfov%array(1:gridinfov%arraysize)%griddim, & 1130 ALLOCATE(isanavar(gridinfov%arraysize)) 1131 isanavar(:) = .false. 1132 IF ( PRESENT(anavar)) THEN 1133 DO i = 1, gridinfov%arraysize 1134 DO j = 1, SIZE(anavar) 1135 lvar = convert(gridinfov%array(i)%var) 1136 IF (lvar%btable == anavar(j)) THEN 1137 isanavar(i) = .true. 1142 CALL l4f_category_log(category,l4f_info,t2c(count(isanavar))// '/'// & 1143 t2c(gridinfov%arraysize)// ' constant-data messages found in input data') 1146 IF (ltime_definition == 1 .OR. ltime_definition == 2) THEN 1147 ALLOCATE(correctedtime(gridinfov%arraysize)) 1148 correctedtime(:) = gridinfov%array(1:gridinfov%arraysize)%time 1149 DO i = 1, gridinfov%arraysize 1150 correctedtime(i) = correctedtime(i) + & 1151 timedelta_new(sec=gridinfov%array(i)%timerange%p1) 1154 IF (ltime_definition == 2) THEN 1155 ALLOCATE(correctedtimerange(gridinfov%arraysize)) 1156 correctedtimerange(:) = gridinfov%array(1:gridinfov%arraysize)%timerange 1157 correctedtimerange(:)%p1 = 0 1161 IF ( PRESENT(anavar)) THEN 1162 j = count((this(i)%griddim == gridinfov%array(1:gridinfov%arraysize)%griddim) & 1163 .AND. .NOT.isanavar(:)) 1165 CALL l4f_category_log(category, l4f_fatal, 'grid n.'//t2c(i)// & 1166 ' has only constant data, this is not allowed') 1167 CALL l4f_category_log(category, l4f_fatal, 'please check anavar argument') 1168 CALL raise_fatal_error() 1171 IF (ltime_definition == 1 .OR. ltime_definition == 2) THEN 1172 ntime = count_distinct(correctedtime, &
|