|
◆ 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 1027 del file volgrid6d_class.F90.
1030 IF ( ASSOCIATED(this%voldati)) THEN 1031 CALL encode_gridinfo(gridinfo, this%voldati(:,:,ilevel,itime,itimerange 1032 ELSE IF (usetemplate) THEN 1034 CALL volgrid_get_vol_2d(this, ilevel, itime, itimerange, ivar, voldati 1035 CALL encode_gridinfo(gridinfo, voldati) 1039 END SUBROUTINE export_to_gridinfo 1059 SUBROUTINE import_from_gridinfovv(this, gridinfov, dup_mode, clone, decode, & 1060 time_definition, anavar, categoryappend) 1061 TYPE(volgrid6d), POINTER :: this(:) 1062 TYPE(arrayof_gridinfo), INTENT(in) :: gridinfov 1063 INTEGER, INTENT(in), OPTIONAL :: dup_mode 1064 LOGICAL , INTENT(in), OPTIONAL :: clone 1065 LOGICAL, INTENT(in), OPTIONAL :: decode 1066 INTEGER, INTENT(IN), OPTIONAL :: time_definition 1070 INTEGER :: i, j, stallo 1071 INTEGER :: ngrid, ntime, ntimerange, nlevel, nvar 1074 TYPE(datetime), ALLOCATABLE :: correctedtime(:) 1075 LOGICAL, ALLOCATABLE :: isanavar(:) 1076 TYPE(vol7d_var) :: lvar 1079 if ( present(categoryappend)) then 1080 call l4f_launcher(a_name,a_name_append=trim(subcategory)// "."//trim(categoryappend 1082 call l4f_launcher(a_name,a_name_append=trim(subcategory)) 1090 ngrid=count_distinct(gridinfov%array(1:gridinfov%arraysize)%griddim,back 1092 ' different grid definition(s) found in input data') 1094 ALLOCATE(this(ngrid),stat=stallo) 1095 IF (stallo /= 0) THEN 1096 CALL l4f_category_log(category,l4f_fatal, "allocating memory") 1097 CALL raise_fatal_error() 1100 IF ( PRESENT(categoryappend)) THEN 1101 CALL init(this(i), time_definition=time_definition, categoryappend=trim "-vol" 1103 CALL init(this(i), time_definition=time_definition, categoryappend= "vol" 1107 this(:)%griddim=pack_distinct(gridinfov%array(1:gridinfov%arraysize)%griddim 1111 ALLOCATE(isanavar(gridinfov%arraysize)) 1112 isanavar(:) = .false. 1113 IF ( PRESENT(anavar)) THEN 1114 DO i = 1, gridinfov%arraysize 1115 DO j = 1, SIZE(anavar) 1116 lvar = convert(gridinfov%array(i)%var) 1117 IF (lvar%btable == anavar(j)) THEN 1118 isanavar(i) = .true. 1123 CALL l4f_category_log(category,l4f_info, t2c(count(isanavar))// '/'// & 1124 t2c(gridinfov%arraysize)// ' constant-data messages found in input data' 1128 ALLOCATE(correctedtime(gridinfov%arraysize)) 1130 IF ( PRESENT(time_definition)) THEN 1131 IF (time_definition == 1) THEN 1132 DO i = 1, gridinfov%arraysize 1133 correctedtime(i) = correctedtime(i) + & 1134 timedelta_new(sec=gridinfov%array(i)%timerange%p1) 1140 IF ( PRESENT(anavar)) THEN 1141 j = count((this(i)%griddim == gridinfov%array(1:gridinfov%arraysize)%griddim 1144 CALL l4f_category_log(category, l4f_fatal, 'grid n.'// t2c(i)// & 1145 ' has only constant data, this is not allowed') 1146 CALL l4f_category_log(category, l4f_fatal, 'please check anavar argument' 1147 CALL raise_fatal_error() 1150 ntime = count_distinct(correctedtime, & 1151 mask=(this(i)%griddim == gridinfov%array(1:gridinfov%arraysize)%griddim 1164 CALL l4f_category_log(this(i)%category,l4f_debug, "alloc volgrid6d index: " 1167 CALL volgrid6d_alloc(this(i),this(i)%griddim%dim,ntime=ntime, & 1168 ntimerange=ntimerange,nlevel=nlevel,nvar=nvar) 1170 this(i)%time = pack_distinct(correctedtime, ntime, & 1171 mask=(this(i)%griddim == gridinfov%array(1:gridinfov%arraysize)%griddim 1173 CALL sort(this(i)%time) 1175 this(i)%timerange = pack_distinct(gridinfov%array( & Functions that return a trimmed CHARACTER representation of the input variable.
Costruttori per le classi datetime e timedelta.
|