libsim Versione 7.2.6

◆ volgrid6d_write_on_file()

subroutine volgrid6d_write_on_file ( type(volgrid6d), intent(in) this,
integer, intent(inout), optional unit,
character(len=*), intent(in), optional description,
character(len=*), intent(in), optional filename,
character(len=*), intent(out), optional filename_auto )

Scrittura su file di un volume Volgrid6d.

Scrittura su file unformatted di un intero volume Volgrid6d. Il volume viene serializzato e scritto su file. Il file puo' essere aperto opzionalmente dall'utente. Si possono passare opzionalmente unità e nome del file altrimenti assegnati internamente a dei default; se assegnati internamente tali parametri saranno in output. Se non viene fornito il nome file viene utilizzato un file di default con nome pari al nome del programma in esecuzione con postfisso ".vg6d". Come parametro opzionale c'è la description che insieme alla data corrente viene inserita nell'header del file.

Parametri
[in]thisvolume volgrid6d da scrivere
[in,out]unitunità su cui scrivere; se passata =0 ritorna il valore rielaborato (default =rielaborato internamente con getlun )
[in]filenamenome del file su cui scrivere
[out]filename_autonome del file generato se "filename" è omesso
[in]descriptiondescrizione del volume

Definizione alla linea 806 del file volgrid6d_class.F90.

807!! volgrid6d_alloc(). If the \a force argument is missing or \a
808!! .FALSE. , the volgrid6d object dimension descriptors (time,
809!! timerange, vertical level, physical variable) must already have
810!! space for the corresponding values coming from gridinfo, otherwise
811!! the object will be rejected; this means that all the volgrid6d
812!! dimension descriptors should be correctly assigned. If \a force is
813!! \a .TRUE. , the gridinfo dimension descriptors that do not fit into
814!! available descriptors in the \a volgrid6d structure, will be
815!! accomodated in a empty (i.e. equal to missing value) descriptor, if
816!! available, otherwise the gridinfo will be rejected. The
817!! descriptor of the grid in the \a volgrid object is assigned to the
818!! descriptor contained in \a gridinfo if it is missing in \a volgrid,
819!! otherwise it is checked and the object is rejected if grids do not
820!! match.
821SUBROUTINE import_from_gridinfo(this, gridinfo, force, dup_mode, clone, &
822 isanavar)
823TYPE(volgrid6d),INTENT(inout) :: this !< object in which to import
824TYPE(gridinfo_def),INTENT(in) :: gridinfo !< gridinfo object to be imported
825LOGICAL,INTENT(in),OPTIONAL :: force !< if provided and \c .TRUE., the gridinfo is forced into an empty element of \a this, if required and possible
826INTEGER,INTENT(in),OPTIONAL :: dup_mode !< determines the behavior in case of duplicate metadata: if \a dup_mode is not provided or 0, a duplicate field overwrites, if \a dup_mode is 1, duplicate fields are merged with priority to the last
827LOGICAL , INTENT(in),OPTIONAL :: clone !< if provided and \c .TRUE. , clone the gaid's from \a gridinfo to \a this
828LOGICAL,INTENT(IN),OPTIONAL :: isanavar !< if provides and \a .TRUE., the gridinfo object is treated as time-independent and replicated for every time and timerange
829
830CHARACTER(len=255) :: type
831INTEGER :: itime0, itimerange0, itime1, itimerange1, itime, itimerange, &
832 ilevel, ivar, ldup_mode
833LOGICAL :: dup
834TYPE(datetime) :: correctedtime
835TYPE(vol7d_timerange) :: correctedtimerange
836REAL,ALLOCATABLE :: tmpgrid(:,:)
837
838IF (PRESENT(dup_mode)) THEN
839 ldup_mode = dup_mode
840ELSE
841 ldup_mode = 0
842ENDIF
843
844call get_val(this%griddim,proj_type=type)
845
846#ifdef DEBUG
847call l4f_category_log(this%category,l4f_debug,"import_from_gridinfo: "//trim(type))
848#endif
849
850if (.not. c_e(type))then
851 call copy(gridinfo%griddim, this%griddim)
852! ho gia` fatto init, altrimenti non potrei fare la get_val(this%griddim)
853! per cui meglio non ripetere
854! call init(this,gridinfo%griddim,categoryappend)
855 CALL volgrid6d_alloc_vol(this, ini=.true.) ! decode?
856
857else if (.not. (this%griddim == gridinfo%griddim ))then
858
859 CALL l4f_category_log(this%category,l4f_error, &
860 "volgrid and gridinfo grid type or size are different, gridinfo rejected")
861 CALL raise_error()
862 RETURN
863
864end if
865
866! Cerco gli indici del campo da inserire, se non trovo metto nel primo missing
867ilevel = index(this%level, gridinfo%level)
868IF (ilevel == 0 .AND. optio_log(force)) THEN
869 ilevel = index(this%level, vol7d_level_miss)
870 IF (ilevel /= 0) this%level(ilevel) = gridinfo%level
871ENDIF
872
873IF (ilevel == 0) THEN
874 CALL l4f_category_log(this%category,l4f_error, &
875 "volgrid6d: level not valid for volume, gridinfo rejected")
876 CALL raise_error()
877 RETURN
878ENDIF
879
880IF (optio_log(isanavar)) THEN ! assign to all times and timeranges
881 itime0 = 1
882 itime1 = SIZE(this%time)
883 itimerange0 = 1
884 itimerange1 = SIZE(this%timerange)
885ELSE ! usual case
886 correctedtime = gridinfo%time
887 IF (this%time_definition == 1 .OR. this%time_definition == 2) correctedtime = correctedtime + &
888 timedelta_new(sec=gridinfo%timerange%p1)
889 itime0 = index(this%time, correctedtime)
890 IF (itime0 == 0 .AND. optio_log(force)) THEN
891 itime0 = index(this%time, datetime_miss)
892 IF (itime0 /= 0) this%time(itime0) = correctedtime
893 ENDIF
894 IF (itime0 == 0) THEN
Index method.

Generated with Doxygen.