libsim Versione 7.2.6

◆ arrayof_vol7d_timerange_remove()

subroutine, private arrayof_vol7d_timerange_remove ( type(arrayof_vol7d_timerange) this,
integer, intent(in), optional nelem,
integer, intent(in), optional pos )
private

Method for removing elements of the array at a desired position.

If necessary, the array is reallocated to reduce space.

Parametri
thisarray object in which an element has to be removed
[in]nelemnumber of elements to remove, if not provided, a single element is removed
[in]posposition of the element to be removed, if it is out of range, it is clipped, if it is not provided, objects are removed at the end

Definizione alla linea 1994 del file vol7d_timerange_class.F90.

1999! Copyright (C) 2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
2000! authors:
2001! Davide Cesari <dcesari@arpa.emr.it>
2002! Paolo Patruno <ppatruno@arpa.emr.it>
2003
2004! This program is free software; you can redistribute it and/or
2005! modify it under the terms of the GNU General Public License as
2006! published by the Free Software Foundation; either version 2 of
2007! the License, or (at your option) any later version.
2008
2009! This program is distributed in the hope that it will be useful,
2010! but WITHOUT ANY WARRANTY; without even the implied warranty of
2011! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2012! GNU General Public License for more details.
2013
2014! You should have received a copy of the GNU General Public License
2015! along with this program. If not, see <http://www.gnu.org/licenses/>.
2016#include "config.h"
2017
2018!> Classe per la gestione degli intervalli temporali di osservazioni
2019!! meteo e affini.
2020!! Questo modulo definisce una classe in grado di rappresentare
2021!! l'intervallo di tempo a cui si riferisce un'osservazione meteo,
2022!! ad es. valore istantaneo, cumulato, medio, ecc., prendendo in prestito
2023!! concetti dal formato grib.
2024!! \ingroup vol7d
2026USE kinds
2029IMPLICIT NONE
2030
2031!> Definisce l'intervallo temporale di un'osservazione meteo.
2032!! I membri di \a vol7d_timerange sono pubblici e quindi liberamente
2033!! accessibili e scrivibili, ma è comunque consigliato assegnarli tramite
2034!! il costruttore ::init.
2035TYPE vol7d_timerange
2036 INTEGER :: timerange !< proprietà statistiche del dato (es. 0=media, 1=cumulazione, 2=massimo, 3=minimo, 4=differenza... 254=dato istantaneo) tratte dalla code table 4.10 del formato WMO grib edizione 2, vedi http://www.wmo.int/pages/prog/www/WMOCodes/WMO306_vI2/LatestVERSION/WMO306_vI2_GRIB2_CodeFlag_en.pdf
2037 INTEGER :: p1 !< termine del periodo di validità del dato, in secondi, a partire dall'istante di riferimento (0 per dati osservati o analizzati)
2038 INTEGER :: p2 !< durata del periodo di validità del dato, in secondi (0 per dati istantanei)
2039END TYPE vol7d_timerange
2040
2041!> Valore mancante per vol7d_timerange.
2042TYPE(vol7d_timerange),PARAMETER :: vol7d_timerange_miss= &
2043 vol7d_timerange(imiss,imiss,imiss)
2044
2045!> Costruttore per la classe vol7d_timerange.
2046!! Deve essere richiamato
2047!! per tutti gli oggetti di questo tipo definiti in un programma.
2048INTERFACE init
2049 MODULE PROCEDURE vol7d_timerange_init
2050END INTERFACE
2051
2052!> Distruttore per la classe vol7d_timerange.
2053!! Distrugge l'oggetto in maniera pulita, assegnandogli un valore mancante.
2054INTERFACE delete
2055 MODULE PROCEDURE vol7d_timerange_delete
2056END INTERFACE
2057
2058!> Logical equality operator for objects of \a vol7d_timerange class.
2059!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
2060!! of any shape.
2061INTERFACE OPERATOR (==)
2062 MODULE PROCEDURE vol7d_timerange_eq
2063END INTERFACE
2064
2065!> Logical inequality operator for objects of \a vol7d_timerange class.
2066!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
2067!! of any shape.
2068INTERFACE OPERATOR (/=)
2069 MODULE PROCEDURE vol7d_timerange_ne
2070END INTERFACE
2071
2072!> Logical greater-than operator for objects of \a vol7d_timerange class.
2073!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
2074!! of any shape.
2075INTERFACE OPERATOR (>)
2076 MODULE PROCEDURE vol7d_timerange_gt
2077END INTERFACE
2078
2079!> Logical less-than operator for objects of \a vol7d_timerange class.
2080!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
2081!! of any shape.
2082INTERFACE OPERATOR (<)
2083 MODULE PROCEDURE vol7d_timerange_lt
2084END INTERFACE
2085
2086!> Logical greater-equal operator for objects of \a vol7d_timerange class.
2087!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
2088!! of any shape.
2089INTERFACE OPERATOR (>=)
2090 MODULE PROCEDURE vol7d_timerange_ge
2091END INTERFACE
2092
2093!> Logical less-equal operator for objects of \a vol7d_timerange class.
2094!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
2095!! of any shape.
2096INTERFACE OPERATOR (<=)
2097 MODULE PROCEDURE vol7d_timerange_le
2098END INTERFACE
2099
2100!> Logical almost equality operator for objects of \a vol7d_timerange class.
2101!! If one component is missing it is not used in comparison.
2102INTERFACE OPERATOR (.almosteq.)
2103 MODULE PROCEDURE vol7d_timerange_almost_eq
2104END INTERFACE
2105
2106
2107! da documentare in inglese assieme al resto
2108!> to be documented
2109INTERFACE c_e
2110 MODULE PROCEDURE vol7d_timerange_c_e
2111END INTERFACE
2112
2113#define VOL7D_POLY_TYPE TYPE(vol7d_timerange)
2114#define VOL7D_POLY_TYPES _timerange
2115#define ENABLE_SORT
2116#include "array_utilities_pre.F90"
2117
2118!>Print object
2119INTERFACE display
2120 MODULE PROCEDURE display_timerange
2121END INTERFACE
2122
2123!>Represent timerange object in a pretty string
2124INTERFACE to_char
2125 MODULE PROCEDURE to_char_timerange
2126END INTERFACE
2127
2128#define ARRAYOF_ORIGTYPE TYPE(vol7d_timerange)
2129#define ARRAYOF_TYPE arrayof_vol7d_timerange
2130#define ARRAYOF_ORIGEQ 1
2131#include "arrayof_pre.F90"
2132
2133
2134type(vol7d_timerange) :: almost_equal_timeranges(2)=(/&
2135 vol7d_timerange(254,0,imiss),&
2136 vol7d_timerange(3,0,3600)/)
2137
2138
2139! from arrayof
2140PUBLIC insert, append, remove, packarray
2141PUBLIC insert_unique, append_unique
2142PUBLIC almost_equal_timeranges
2143
2144CONTAINS
2145
2146
2147!> Inizializza un oggetto \a vol7d_timerange con i parametri opzionali forniti.
2148!! Questa è la versione \c FUNCTION, in stile F2003, del costruttore, da preferire
2149!! rispetto alla versione \c SUBROUTINE \c init.
2150!! Se non viene passato nessun parametro opzionale l'oggetto è
2151!! inizializzato a valore mancante.
2152FUNCTION vol7d_timerange_new(timerange, p1, p2) RESULT(this)
2153INTEGER,INTENT(IN),OPTIONAL :: timerange !< tipo di intervallo temporale
2154INTEGER,INTENT(IN),OPTIONAL :: p1 !< valore per il primo istante temporale
2155INTEGER,INTENT(IN),OPTIONAL :: p2 !< valore per il secondo istante temporale
2156
2157TYPE(vol7d_timerange) :: this !< oggetto da inizializzare
2158
2159CALL init(this, timerange, p1, p2)
2160
2161END FUNCTION vol7d_timerange_new
2162
2163
2164!> Inizializza un oggetto \a vol7d_timerange con i parametri opzionali forniti.
2165!! Se non viene passato nessun parametro opzionale l'oggetto è
2166!! inizializzato a valore mancante.
2167SUBROUTINE vol7d_timerange_init(this, timerange, p1, p2)
2168TYPE(vol7d_timerange),INTENT(INOUT) :: this !< oggetto da inizializzare
2169INTEGER,INTENT(IN),OPTIONAL :: timerange !< tipo di intervallo temporale
2170INTEGER,INTENT(IN),OPTIONAL :: p1 !< valore per il primo istante temporale
2171INTEGER,INTENT(IN),OPTIONAL :: p2 !< valore per il secondo istante temporale
2172
2173IF (PRESENT(timerange)) THEN
2174 this%timerange = timerange
2175ELSE
2176 this%timerange = imiss
2177 this%p1 = imiss
2178 this%p2 = imiss
2179 RETURN
2180ENDIF
2181!!$IF (timerange == 1) THEN ! p1 sempre 0
2182!!$ this%p1 = 0
2183!!$ this%p2 = imiss
2184!!$ELSE IF (timerange == 0 .OR. timerange == 10) THEN ! solo p1
2185!!$ IF (PRESENT(p1)) THEN
2186!!$ this%p1 = p1
2187!!$ ELSE
2188!!$ this%p1 = 0
2189!!$ ENDIF
2190!!$ this%p2 = imiss
2191!!$ELSE ! tutti gli altri
2192 IF (PRESENT(p1)) THEN
2193 this%p1 = p1
2194 ELSE
2195 this%p1 = imiss
2196 ENDIF
2197 IF (PRESENT(p2)) THEN
2198 this%p2 = p2
2199 ELSE
2200 this%p2 = imiss
2201 ENDIF
2202!!$END IF
2203
2204END SUBROUTINE vol7d_timerange_init
2205
2206
2207!> Distrugge l'oggetto in maniera pulita, assegnandogli un valore mancante.
2208SUBROUTINE vol7d_timerange_delete(this)
2209TYPE(vol7d_timerange),INTENT(INOUT) :: this
2210
2211this%timerange = imiss
2212this%p1 = imiss
2213this%p2 = imiss
2214
2215END SUBROUTINE vol7d_timerange_delete
2216
2217
2218SUBROUTINE display_timerange(this)
2219TYPE(vol7d_timerange),INTENT(in) :: this
2220
2221print*,to_char_timerange(this)
2222
2223END SUBROUTINE display_timerange
2224
2225
2226FUNCTION to_char_timerange(this)
2227#ifdef HAVE_DBALLE
2228USE dballef
2229#endif
2230TYPE(vol7d_timerange),INTENT(in) :: this
2231CHARACTER(len=80) :: to_char_timerange
2232
2233#ifdef HAVE_DBALLE
2234INTEGER :: handle, ier
2235
2236handle = 0
2237ier = idba_messaggi(handle,"/dev/null", "w", "BUFR")
2238ier = idba_spiegat(handle,this%timerange,this%p1,this%p2,to_char_timerange)
2239ier = idba_fatto(handle)
2240
2241to_char_timerange="Timerange: "//to_char_timerange
2242
2243#else
2244
2245to_char_timerange="Timerange: "//trim(to_char(this%timerange))//" P1: "//&
2246 trim(to_char(this%p1))//" P2: "//trim(to_char(this%p2))
2247
2248#endif
2249
2250END FUNCTION to_char_timerange
2251
2252
2253ELEMENTAL FUNCTION vol7d_timerange_eq(this, that) RESULT(res)
2254TYPE(vol7d_timerange),INTENT(IN) :: this, that
2255LOGICAL :: res
2256
2257
2258res = &
2259 this%timerange == that%timerange .AND. &
2260 this%p1 == that%p1 .AND. (this%p2 == that%p2 .OR. &
2261 this%timerange == 254)
2262
2263END FUNCTION vol7d_timerange_eq
2264
2265
2266ELEMENTAL FUNCTION vol7d_timerange_almost_eq(this, that) RESULT(res)
2267TYPE(vol7d_timerange),INTENT(IN) :: this, that
2268LOGICAL :: res
2269
2270IF (.not. c_e(this%timerange) .or. .not. c_e(that%timerange) .or. this%timerange == that%timerange .AND. &
2271 this%p1 == that%p1 .AND. &
2272 this%p2 == that%p2) THEN
2273 res = .true.
2274ELSE
2275 res = .false.
2276ENDIF
2277
2278END FUNCTION vol7d_timerange_almost_eq
2279
2280
2281ELEMENTAL FUNCTION vol7d_timerange_ne(this, that) RESULT(res)
2282TYPE(vol7d_timerange),INTENT(IN) :: this, that
2283LOGICAL :: res
2284
2285res = .NOT.(this == that)
2286
2287END FUNCTION vol7d_timerange_ne
2288
2289
2290ELEMENTAL FUNCTION vol7d_timerange_gt(this, that) RESULT(res)
2291TYPE(vol7d_timerange),INTENT(IN) :: this, that
2292LOGICAL :: res
2293
2294IF (this%timerange > that%timerange .OR. &
2295 (this%timerange == that%timerange .AND. this%p1 > that%p1) .OR. &
2296 (this%timerange == that%timerange .AND. this%p1 == that%p1 .AND. &
2297 this%p2 > that%p2)) THEN
2298 res = .true.
2299ELSE
2300 res = .false.
2301ENDIF
2302
2303END FUNCTION vol7d_timerange_gt
2304
2305
2306ELEMENTAL FUNCTION vol7d_timerange_lt(this, that) RESULT(res)
2307TYPE(vol7d_timerange),INTENT(IN) :: this, that
2308LOGICAL :: res
2309
2310IF (this%timerange < that%timerange .OR. &
2311 (this%timerange == that%timerange .AND. this%p1 < that%p1) .OR. &
2312 (this%timerange == that%timerange .AND. this%p1 == that%p1 .AND. &
2313 this%p2 < that%p2)) THEN
2314 res = .true.
2315ELSE
2316 res = .false.
2317ENDIF
2318
2319END FUNCTION vol7d_timerange_lt
2320
2321
2322ELEMENTAL FUNCTION vol7d_timerange_ge(this, that) RESULT(res)
2323TYPE(vol7d_timerange),INTENT(IN) :: this, that
2324LOGICAL :: res
2325
2326IF (this == that) THEN
2327 res = .true.
2328ELSE IF (this > that) THEN
2329 res = .true.
2330ELSE
2331 res = .false.
2332ENDIF
2333
2334END FUNCTION vol7d_timerange_ge
2335
2336
2337ELEMENTAL FUNCTION vol7d_timerange_le(this, that) RESULT(res)
2338TYPE(vol7d_timerange),INTENT(IN) :: this, that
2339LOGICAL :: res
2340
2341IF (this == that) THEN
2342 res = .true.
2343ELSE IF (this < that) THEN
2344 res = .true.
2345ELSE
2346 res = .false.
2347ENDIF
2348
2349END FUNCTION vol7d_timerange_le
2350
2351
2352ELEMENTAL FUNCTION vol7d_timerange_c_e(this) RESULT(c_e)
2353TYPE(vol7d_timerange),INTENT(IN) :: this
2354LOGICAL :: c_e
2355c_e = this /= vol7d_timerange_miss
2356END FUNCTION vol7d_timerange_c_e
2357
2358
2359#include "array_utilities_inc.F90"
2360
2361#include "arrayof_post.F90"
2362
2363
2364END MODULE vol7d_timerange_class
Quick method to append an element to the array.
Distruttore per la classe vol7d_timerange.
Costruttore per la classe vol7d_timerange.
Method for inserting elements of the array at a desired position.
Method for packing the array object reducing at a minimum the memory occupation, without destroying i...
Method for removing elements of the array at a desired position.
Represent timerange object in a pretty string.
Utilities for CHARACTER variables.
Definition of constants to be used for declaring variables of a desired type.
Definition kinds.F90:245
Definitions of constants and functions for working with missing values.
Classe per la gestione degli intervalli temporali di osservazioni meteo e affini.
Definisce l'intervallo temporale di un'osservazione meteo.

Generated with Doxygen.