libsim Versione 7.2.6
|
◆ vol7d_copy()
Metodo per creare una copia completa e indipendente di un oggetto vol7d. Questo metodo crea un duplicato di tutti i membri di un oggetto vol7d, con la possibilità di rielaborarlo durante la copia. Se l'oggetto da copiare è vuoto non perde tempo inutile. Attenzione, il codice: USE vol7d_class
TYPE(vol7d) :: vol1, vol2
CALL init(vol1)
CALL init(vol2)
... ! riempio vol1
vol2 = vol1
Classe per la gestione di un volume completo di dati osservati. Definition vol7d_class.F90:273 fa una cosa diversa rispetto a: USE vol7d_class
TYPE(vol7d) :: vol1, vol2
CALL init(vol1)
CALL init(vol2)
... ! riempio vol1
CALL vol7d_copy(vol1, vol2)
nel primo caso, infatti, l'operatore di assegnazione copia solo i componenti statici di vol1 nei corrispondenti elementi di vol2, mentre i componenti che sono allocati dinamicamente (cioè quelli che in vol7d hanno l'attributo
Definizione alla linea 1902 del file vol7d_class.F90. 1911
1912!> Sorts the sortable dimensions in the volume \a this only when necessary.
1913!! Most of the times, the time, timerange and level dimensions in a
1914!! vol7d object are correctly sorted; on the other side many methods
1915!! strictly rely on this fact in order to work correctly. This method
1916!! performs a quick check and sorts the required dimensions only if
1917!! they are not sorted in ascending order yet, improving safety
1918!! without impairing much performance.
1919SUBROUTINE vol7d_smart_sort(this, lsort_time, lsort_timerange, lsort_level)
1920TYPE(vol7d),INTENT(INOUT) :: this !< object to be sorted
1921LOGICAL,OPTIONAL,INTENT(in) :: lsort_time !< if present and \a .TRUE., sort time dimension if it is not sorted in ascending order
1922LOGICAL,OPTIONAL,INTENT(in) :: lsort_timerange !< if present and \a .TRUE., sort timerange dimension if it is not sorted in ascending order
1923LOGICAL,OPTIONAL,INTENT(in) :: lsort_level !< if present and \a .TRUE., sort vertical level dimension if it is not sorted in ascending order
1924
1925INTEGER :: i
1926LOGICAL :: to_be_sorted
1927
1928to_be_sorted = .false.
1929CALL vol7d_alloc_vol(this) ! usual safety check
1930
1931IF (optio_log(lsort_time)) THEN
1932 DO i = 2, SIZE(this%time)
1933 IF (this%time(i) < this%time(i-1)) THEN
1934 to_be_sorted = .true.
1935 EXIT
1936 ENDIF
1937 ENDDO
1938ENDIF
1939IF (optio_log(lsort_timerange)) THEN
1940 DO i = 2, SIZE(this%timerange)
1941 IF (this%timerange(i) < this%timerange(i-1)) THEN
1942 to_be_sorted = .true.
1943 EXIT
1944 ENDIF
1945 ENDDO
1946ENDIF
1947IF (optio_log(lsort_level)) THEN
1948 DO i = 2, SIZE(this%level)
1949 IF (this%level(i) < this%level(i-1)) THEN
1950 to_be_sorted = .true.
1951 EXIT
1952 ENDIF
1953 ENDDO
1954ENDIF
1955
1956IF (to_be_sorted) CALL vol7d_reform(this, &
1957 lsort_time=lsort_time, lsort_timerange=lsort_timerange, lsort_level=lsort_level )
1958
1959END SUBROUTINE vol7d_smart_sort
1960
1961!> Filter the contents of a volume keeping only desired data.
1962!! This subroutine filters a vol7d object by keeping only a subset of
1963!! the data contained. It can keep only times within a specified
1964!! interval, only station networks contained in a list and only
1965!! specified station or data variables. If a filter parameter is not
1966!! provided, no filtering will take place according to that criterion.
1967!! The volume is reallocated keeping only the desired data.
1968SUBROUTINE vol7d_filter(this, avl, vl, nl, s_d, e_d)
1969TYPE(vol7d),INTENT(inout) :: this !< volume to be filtered
1970CHARACTER(len=*),INTENT(in),OPTIONAL :: avl(:) !< list of station variables to be kept, if not provided or of zero length, all variables are kept
1971CHARACTER(len=*),INTENT(in),OPTIONAL :: vl(:) !< list of data variables to be kept, if not provided or of zero length, all variables are kept
1972TYPE(vol7d_network),OPTIONAL :: nl(:) !< list of station networks to be kept, if not provided or of zero length, all networks are kept
1973TYPE(datetime),INTENT(in),OPTIONAL :: s_d !< initial time interval for time filtering, if not provided or equal to missing data no lower limit is imposed
1974TYPE(datetime),INTENT(in),OPTIONAL :: e_d !< final time interval for time filtering, if not provided or equal to missing data no upper limit is imposed
1975
1976INTEGER :: i
1977
1978IF (PRESENT(avl)) THEN
1979 IF (SIZE(avl) > 0) THEN
1980
1981 IF (ASSOCIATED(this%anavar%r)) THEN
1982 DO i = 1, SIZE(this%anavar%r)
1983 IF (all(this%anavar%r(i)%btable /= avl)) this%anavar%r(i) = vol7d_var_miss
1984 ENDDO
1985 ENDIF
1986
1987 IF (ASSOCIATED(this%anavar%i)) THEN
1988 DO i = 1, SIZE(this%anavar%i)
1989 IF (all(this%anavar%i(i)%btable /= avl)) this%anavar%i(i) = vol7d_var_miss
1990 ENDDO
1991 ENDIF
1992
1993 IF (ASSOCIATED(this%anavar%b)) THEN
1994 DO i = 1, SIZE(this%anavar%b)
1995 IF (all(this%anavar%b(i)%btable /= avl)) this%anavar%b(i) = vol7d_var_miss
1996 ENDDO
1997 ENDIF
1998
1999 IF (ASSOCIATED(this%anavar%d)) THEN
2000 DO i = 1, SIZE(this%anavar%d)
2001 IF (all(this%anavar%d(i)%btable /= avl)) this%anavar%d(i) = vol7d_var_miss
|