libsim  Versione 7.2.6

◆ import_from_gridinfovv()

subroutine import_from_gridinfovv ( type(volgrid6d), dimension(:), pointer  this,
type(arrayof_gridinfo), intent(in)  gridinfov,
integer, intent(in), optional  dup_mode,
logical, intent(in), optional  clone,
logical, intent(in), optional  decode,
integer, intent(in), optional  time_definition,
character(len=*), dimension(:), intent(in), optional  anavar,
character(len=*), intent(in), optional  categoryappend 
)

Import an array of gridinfo objects into an array of volgrid6d objects.

This method imports an array of gridded fields from an arrayof_gridinfo object into a suitable number of volgrid6d objects. The number of volgrid6d allocated is determined by the number of different grids encountered in arrayof_gridinfo. Unlike the import for a single gridinfo, here the volgrid6d object is a non-associated pointer to a 1-d array of uninitialized objects, and all the dimension descriptors in each of the objects are allocated and assigned within the method according to the data contained in gridinfov. If the anavar array argument is provided, all the input messages whose variable maps to one of the B-table variables contained in anavar are treated as time-independent (AKA anagraphic data, station data, etc.), thus their time and timerange are ignored and they are replicated for every time and timerange present in the corresponding data volume.

Parametri
thisobject in which to import
[in]gridinfovarray of gridinfo objects to be imported
[in]dup_modedetermines 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]cloneif provided and .TRUE. , clone the gaid's from gridinfo to this
[in]decodeif provided and .FALSE. the data volume in the elements of this is not allocated and successive work will be performed on grid_id's
[in]time_definition0=time is reference time; 1=time is validity time
[in]anavarlist of variables (B-table code equivalent) to be treated as time-independent data
[in]categoryappendappend this suffix to log4fortran namespace category

Definizione alla linea 1269 del file volgrid6d_class.F90.

1271 TYPE(grid_id),INTENT(in),OPTIONAL :: gaid_template
1272 LOGICAL,INTENT(in),OPTIONAL :: clone
1273 
1274 INTEGER :: i ,itime, itimerange, ilevel, ivar
1275 INTEGER :: ntime, ntimerange, nlevel, nvar
1276 TYPE(gridinfo_def) :: gridinfol
1277 
1278 #ifdef DEBUG
1279 CALL l4f_category_log(this%category,l4f_debug,"start export_to_gridinfov")
1280 #endif
1281 
1282 ! this is necessary in order not to repeatedly and uselessly copy the
1283 ! same array of coordinates for each 2d grid during export, the
1284 ! side-effect is that the computed projection in this is lost
1285 CALL dealloc(this%griddim%dim)
1286 
1287 i=0
1288 ntime=size(this%time)
1289 ntimerange=size(this%timerange)
1290 nlevel=size(this%level)
1291 nvar=size(this%var)
1292 
1293 DO itime=1,ntime
1294  DO itimerange=1,ntimerange
1295  DO ilevel=1,nlevel
1296  DO ivar=1,nvar
1297 
1298  CALL init(gridinfol)
1299  CALL export(this, gridinfol, itime, itimerange, ilevel, ivar, &
1300  gaid_template=gaid_template, clone=clone)
1301  IF (c_e(gridinfol%gaid)) THEN
1302  CALL insert(gridinfov, gridinfol)
1303  ELSE
1304  CALL delete(gridinfol)
1305  ENDIF
1306 
1307  ENDDO
1308  ENDDO
1309  ENDDO
1310 ENDDO
1311 
1312 END SUBROUTINE export_to_gridinfov
1313 
1314 
1320 SUBROUTINE export_to_gridinfovv(this, gridinfov, gaid_template, clone)
1321 !, &
1322 ! categoryappend)
1323 TYPE(volgrid6d),INTENT(inout) :: this(:)
1324 TYPE(arrayof_gridinfo),INTENT(inout) :: gridinfov
1325 TYPE(grid_id),INTENT(in),OPTIONAL :: gaid_template
1326 LOGICAL,INTENT(in),OPTIONAL :: clone
1327 
1328 INTEGER :: i
1329 
1330 DO i = 1, SIZE(this)
1331 #ifdef DEBUG
1332  CALL l4f_category_log(this(i)%category,l4f_debug, &
1333  "export_to_gridinfovv grid index: "//t2c(i))
1334 #endif
1335  CALL export(this(i), gridinfov, gaid_template=gaid_template, clone=clone)
1336 ENDDO
1337 
1338 END SUBROUTINE export_to_gridinfovv
1339 
1340 
1350 SUBROUTINE volgrid6d_import_from_file(this, filename, dup_mode, decode, &
1351  time_definition, anavar, categoryappend)
1352 TYPE(volgrid6d),POINTER :: this(:)
1353 CHARACTER(len=*),INTENT(in) :: filename
1354 INTEGER,INTENT(in),OPTIONAL :: dup_mode
1355 LOGICAL,INTENT(in),OPTIONAL :: decode
1356 INTEGER,INTENT(IN),OPTIONAL :: time_definition
1357 CHARACTER(len=*),INTENT(IN),OPTIONAL :: anavar(:)
1358 character(len=*),INTENT(in),OPTIONAL :: categoryappend
1359 
1360 TYPE(arrayof_gridinfo) :: gridinfo
1361 INTEGER :: category
1362 CHARACTER(len=512) :: a_name
1363 
1364 NULLIFY(this)
1365 
1366 IF (PRESENT(categoryappend))THEN
1367  CALL l4f_launcher(a_name,a_name_append= &
1368  trim(subcategory)//"."//trim(categoryappend))
1369 ELSE
1370  CALL l4f_launcher(a_name,a_name_append=trim(subcategory))
1371 ENDIF
1372 category=l4f_category_get(a_name)
1373 
1374 CALL import(gridinfo, filename=filename, categoryappend=categoryappend)
1375 
1376 IF (gridinfo%arraysize > 0) THEN
1377 
1378  CALL import(this, gridinfo, dup_mode=dup_mode, clone=.true., decode=decode, &
1379  time_definition=time_definition, anavar=anavar, &
1380  categoryappend=categoryappend)
1381 
1382  CALL l4f_category_log(category,l4f_info,"deleting gridinfo")
1383  CALL delete(gridinfo)
1384 
1385 ELSE
1386  CALL l4f_category_log(category,l4f_info,"file does not contain gridded data")
1387 ENDIF
1388 
1389 ! close logger
1390 CALL l4f_category_delete(category)
1391 
1392 END SUBROUTINE volgrid6d_import_from_file
1393 
1394 
1402 SUBROUTINE volgrid6d_export_to_file(this, filename, gaid_template, categoryappend)
1403 TYPE(volgrid6d) :: this(:)
1404 CHARACTER(len=*),INTENT(in) :: filename
1405 TYPE(grid_id),INTENT(in),OPTIONAL :: gaid_template
1406 character(len=*),INTENT(in),OPTIONAL :: categoryappend
1407 
1408 TYPE(arrayof_gridinfo) :: gridinfo
1409 INTEGER :: category
1410 CHARACTER(len=512) :: a_name
1411 
1412 IF (PRESENT(categoryappend)) THEN
1413  CALL l4f_launcher(a_name,a_name_append=trim(subcategory)//"."//trim(categoryappend))
1414 ELSE
1415  CALL l4f_launcher(a_name,a_name_append=trim(subcategory))
1416 ENDIF
1417 category=l4f_category_get(a_name)
1418 
1419 #ifdef DEBUG
1420 CALL l4f_category_log(category,l4f_debug,"start export to file")
1421 #endif
1422 
1423 CALL l4f_category_log(category,l4f_info,"writing volgrid6d to grib file: "//trim(filename))
1424 
1425 !IF (ASSOCIATED(this)) THEN
1426  CALL export(this, gridinfo, gaid_template=gaid_template, clone=.true.)
1427  IF (gridinfo%arraysize > 0) THEN
1428  CALL export(gridinfo, filename)
1429  CALL delete(gridinfo)
1430  ENDIF
1431 !ELSE
1432 ! CALL l4f_category_log(category,L4F_INFO,"volume volgrid6d is not associated")
1433 !ENDIF
1434 
1435 ! close logger
1436 CALL l4f_category_delete(category)
1437 
1438 END SUBROUTINE volgrid6d_export_to_file
1439 
1440 
1444 SUBROUTINE volgrid6dv_delete(this)
1445 TYPE(volgrid6d),POINTER :: this(:)
1446 
1447 INTEGER :: i
1448 
1449 IF (ASSOCIATED(this)) THEN
1450  DO i = 1, SIZE(this)
1451 #ifdef DEBUG
1452  CALL l4f_category_log(this(i)%category,l4f_debug, &
1453  "delete volgrid6d vector index: "//trim(to_char(i)))
1454 #endif
1455  CALL delete(this(i))
1456  ENDDO
1457  DEALLOCATE(this)

Generated with Doxygen.