Programma esempio semplice per gridinfo e volgrid6d. Programma che importa da file un vettore di gridinfo poi lo importa in volgrid6d. Da volgrid6d viene di nuovo creato un vettore di gridinfo per poi exportare su file.
29 type(l4f_handle) :: category
30 character(len=512):: a_name
31 type(arrayof_gridinfo) :: gridinfoin, gridinfoout
32 type(volgrid6d),
pointer :: volgrid(:)
34 TYPE(grid_file_id) :: ifile
35 TYPE(grid_id) :: gaid, gaid_template
39 call l4f_launcher(a_name,a_name_force=
"demo3")
45 category=l4f_category_get_handle(a_name//
".main")
50 ifile = grid_file_id_new(
'../data/in.grb',
'r')
51 ngrib = grid_file_id_count(ifile)
54 "Numero totale di grib: "//
to_char(ngrib))
57 CALL insert(gridinfoin, nelem=ngrib)
63 gaid = grid_id_new(ifile)
64 IF (.NOT.
c_e(gaid))
EXIT 68 CALL init (gridinfoin%array(ngrib), gaid=gaid, categoryappend=trim(
to_char(ngrib)))
69 CALL import(gridinfoin%array(ngrib))
77 call import(volgrid, gridinfoin, categoryappend=
"volume di test")
85 gaid_template = grid_id_new(grib_api_template=
"regular_ll_sfc_grib1")
87 call l4f_category_log(category,l4f_info,
"export a un grib fatto come voglio io")
89 call export(volgrid, gridinfoout, gaid_template=gaid_template)
91 ifile = grid_file_id_new(
'out.grb',
'w')
93 do ngrib=1,gridinfoout%arraysize
96 if(
c_e(gridinfoout%array(ngrib)%gaid))
then 97 call export(gridinfoout%array(ngrib))
98 call export(gridinfoout%array(ngrib)%gaid,ifile)
109 call l4f_category_delete(category)