|
libsim Versione 8.0.0
|
◆ 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 1903 del file vol7d_class.F90. 1912
1913!> Sorts the sortable dimensions in the volume \a this only when necessary.
1914!! Most of the times, the time, timerange and level dimensions in a
1915!! vol7d object are correctly sorted; on the other side many methods
1916!! strictly rely on this fact in order to work correctly. This method
1917!! performs a quick check and sorts the required dimensions only if
1918!! they are not sorted in ascending order yet, improving safety
1919!! without impairing much performance.
1920SUBROUTINE vol7d_smart_sort(this, lsort_time, lsort_timerange, lsort_level)
1921TYPE(vol7d),INTENT(INOUT) :: this !< object to be sorted
1922LOGICAL,OPTIONAL,INTENT(in) :: lsort_time !< if present and \a .TRUE., sort time dimension if it is not sorted in ascending order
1923LOGICAL,OPTIONAL,INTENT(in) :: lsort_timerange !< if present and \a .TRUE., sort timerange dimension if it is not sorted in ascending order
1924LOGICAL,OPTIONAL,INTENT(in) :: lsort_level !< if present and \a .TRUE., sort vertical level dimension if it is not sorted in ascending order
1925
1926INTEGER :: i
1927LOGICAL :: to_be_sorted
1928
1929to_be_sorted = .false.
1930CALL vol7d_alloc_vol(this) ! usual safety check
1931
1932IF (optio_log(lsort_time)) THEN
1933 DO i = 2, SIZE(this%time)
1934 IF (this%time(i) < this%time(i-1)) THEN
1935 to_be_sorted = .true.
1936 EXIT
1937 ENDIF
1938 ENDDO
1939ENDIF
1940IF (optio_log(lsort_timerange)) THEN
1941 DO i = 2, SIZE(this%timerange)
1942 IF (this%timerange(i) < this%timerange(i-1)) THEN
1943 to_be_sorted = .true.
1944 EXIT
1945 ENDIF
1946 ENDDO
1947ENDIF
1948IF (optio_log(lsort_level)) THEN
1949 DO i = 2, SIZE(this%level)
1950 IF (this%level(i) < this%level(i-1)) THEN
1951 to_be_sorted = .true.
1952 EXIT
1953 ENDIF
1954 ENDDO
1955ENDIF
1956
1957IF (to_be_sorted) CALL vol7d_reform(this, &
1958 lsort_time=lsort_time, lsort_timerange=lsort_timerange, lsort_level=lsort_level )
1959
1960END SUBROUTINE vol7d_smart_sort
1961
1962!> Filter the contents of a volume keeping only desired data.
1963!! This subroutine filters a vol7d object by keeping only a subset of
1964!! the data contained. It can keep only times within a specified
1965!! interval, only station networks contained in a list and only
1966!! specified station or data variables. If a filter parameter is not
1967!! provided, no filtering will take place according to that criterion.
1968!! The volume is reallocated keeping only the desired data.
1969SUBROUTINE vol7d_filter(this, avl, vl, nl, s_d, e_d)
1970TYPE(vol7d),INTENT(inout) :: this !< volume to be filtered
1971CHARACTER(len=*),INTENT(in),OPTIONAL :: avl(:) !< list of station variables to be kept, if not provided or of zero length, all variables are kept
1972CHARACTER(len=*),INTENT(in),OPTIONAL :: vl(:) !< list of data variables to be kept, if not provided or of zero length, all variables are kept
1973TYPE(vol7d_network),OPTIONAL :: nl(:) !< list of station networks to be kept, if not provided or of zero length, all networks are kept
1974TYPE(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
1975TYPE(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
1976
1977INTEGER :: i
1978
1979IF (PRESENT(avl)) THEN
1980 IF (SIZE(avl) > 0) THEN
1981
1982 IF (ASSOCIATED(this%anavar%r)) THEN
1983 DO i = 1, SIZE(this%anavar%r)
1984 IF (all(this%anavar%r(i)%btable /= avl)) this%anavar%r(i) = vol7d_var_miss
1985 ENDDO
1986 ENDIF
1987
1988 IF (ASSOCIATED(this%anavar%i)) THEN
1989 DO i = 1, SIZE(this%anavar%i)
1990 IF (all(this%anavar%i(i)%btable /= avl)) this%anavar%i(i) = vol7d_var_miss
1991 ENDDO
1992 ENDIF
1993
1994 IF (ASSOCIATED(this%anavar%b)) THEN
1995 DO i = 1, SIZE(this%anavar%b)
1996 IF (all(this%anavar%b(i)%btable /= avl)) this%anavar%b(i) = vol7d_var_miss
1997 ENDDO
1998 ENDIF
1999
2000 IF (ASSOCIATED(this%anavar%d)) THEN
2001 DO i = 1, SIZE(this%anavar%d)
2002 IF (all(this%anavar%d(i)%btable /= avl)) this%anavar%d(i) = vol7d_var_miss
|