|
|
◆ import_from_gridinfo()
| subroutine 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 |
|
) |
| |
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 1026 del file volgrid6d_class.F90.
1027 CALL l4f_category_log(this%category,l4f_debug, "original gaid cloned to a new one") 1030 gaid = this%gaid(ilevel,itime,itimerange,ivar) 1034 IF (this%time_definition == 1 .OR. this%time_definition == 2) THEN 1035 correctedtime = this%time(itime) - & 1036 timedelta_new(sec=this%timerange(itimerange)%p1) 1038 correctedtime = this%time(itime) 1041 CALL init(gridinfo,gaid, this%griddim, correctedtime, this%timerange(itimerange), & 1042 this%level(ilevel), this%var(ivar)) 1045 CALL export(gridinfo%griddim, gridinfo%gaid) 1047 IF ( ASSOCIATED(this%voldati)) THEN 1048 CALL encode_gridinfo(gridinfo, this%voldati(:,:,ilevel,itime,itimerange,ivar)) 1049 ELSE IF (usetemplate) THEN 1051 CALL volgrid_get_vol_2d(this, ilevel, itime, itimerange, ivar, voldati) 1052 CALL encode_gridinfo(gridinfo, voldati) 1056 END SUBROUTINE export_to_gridinfo 1076 SUBROUTINE import_from_gridinfovv(this, gridinfov, dup_mode, clone, decode, & 1077 time_definition, anavar, categoryappend) 1078 TYPE(volgrid6d), POINTER :: this(:) 1079 TYPE(arrayof_gridinfo), INTENT(in) :: gridinfov 1080 INTEGER, INTENT(in), OPTIONAL :: dup_mode 1081 LOGICAL , INTENT(in), OPTIONAL :: clone 1082 LOGICAL, INTENT(in), OPTIONAL :: decode 1083 INTEGER, INTENT(IN), OPTIONAL :: time_definition 1084 CHARACTER(len=*), INTENT(IN), OPTIONAL :: anavar(:) 1085 CHARACTER(len=*), INTENT(in), OPTIONAL :: categoryappend 1087 INTEGER :: i, j, stallo 1088 INTEGER :: ngrid, ntime, ntimerange, nlevel, nvar, ltime_definition 1089 TYPE(l4f_handle) :: category 1090 CHARACTER(len=512) :: a_name 1091 TYPE(datetime), ALLOCATABLE :: correctedtime(:) 1092 LOGICAL, ALLOCATABLE :: isanavar(:) 1093 TYPE(vol7d_var) :: lvar 1094 TYPE(vol7d_timerange), ALLOCATABLE :: correctedtimerange(:) 1097 if ( present(categoryappend)) then 1098 call l4f_launcher(a_name,a_name_append=trim(subcategory)// "."//trim(categoryappend)) 1100 call l4f_launcher(a_name,a_name_append=trim(subcategory)) 1102 category=l4f_category_get_handle(a_name) 1105 call l4f_category_log(category,l4f_debug, "start import_from_gridinfovv") 1108 IF ( PRESENT(time_definition)) THEN 1109 ltime_definition = max(min(time_definition, 2), 0) 1111 ltime_definition = 0 1114 ngrid=count_distinct(gridinfov%array(1:gridinfov%arraysize)%griddim,back=.true.) 1115 CALL l4f_category_log(category,l4f_info, t2c(ngrid)// & 1116 ' different grid definition(s) found in input data') 1118 ALLOCATE(this(ngrid),stat=stallo) 1119 IF (stallo /= 0) THEN 1120 CALL l4f_category_log(category,l4f_fatal, "allocating memory") 1121 CALL raise_fatal_error() 1124 IF ( PRESENT(categoryappend)) THEN 1125 CALL init(this(i), time_definition=ltime_definition, categoryappend=trim(categoryappend)// "-vol"//t2c(i)) 1127 CALL init(this(i), time_definition=ltime_definition, categoryappend= "vol"//t2c(i)) 1131 this(:)%griddim=pack_distinct(gridinfov%array(1:gridinfov%arraysize)%griddim, & 1135 ALLOCATE(isanavar(gridinfov%arraysize)) 1136 isanavar(:) = .false. 1137 IF ( PRESENT(anavar)) THEN 1138 DO i = 1, gridinfov%arraysize 1139 DO j = 1, SIZE(anavar) 1140 lvar = convert(gridinfov%array(i)%var) 1141 IF (lvar%btable == anavar(j)) THEN 1142 isanavar(i) = .true. 1147 CALL l4f_category_log(category,l4f_info,t2c(count(isanavar))// '/'// & 1148 t2c(gridinfov%arraysize)// ' constant-data messages found in input data') 1151 IF (ltime_definition == 1 .OR. ltime_definition == 2) THEN 1152 ALLOCATE(correctedtime(gridinfov%arraysize)) 1153 correctedtime(:) = gridinfov%array(1:gridinfov%arraysize)%time 1154 DO i = 1, gridinfov%arraysize 1155 correctedtime(i) = correctedtime(i) + & 1156 timedelta_new(sec=gridinfov%array(i)%timerange%p1) 1159 IF (ltime_definition == 2) THEN 1160 ALLOCATE(correctedtimerange(gridinfov%arraysize)) 1161 correctedtimerange(:) = gridinfov%array(1:gridinfov%arraysize)%timerange 1162 correctedtimerange(:)%p1 = 0 1166 IF ( PRESENT(anavar)) THEN 1167 j = count((this(i)%griddim == gridinfov%array(1:gridinfov%arraysize)%griddim) & 1168 .AND. .NOT.isanavar(:)) 1170 CALL l4f_category_log(category, l4f_fatal, 'grid n.'//t2c(i)// & 1171 ' has only constant data, this is not allowed') 1172 CALL l4f_category_log(category, l4f_fatal, 'please check anavar argument') 1173 CALL raise_fatal_error() 1176 IF (ltime_definition == 1 .OR. ltime_definition == 2) THEN 1177 ntime = count_distinct(correctedtime, &
|