libsim  Versione8.0.0

◆ import_from_gridinfovv()

subroutine volgrid6d_class::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 
)
private

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 1276 del file volgrid6d_class.F90.

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

Generated with Doxygen.