libsim Versione 7.2.6

◆ count_distinct_ana()

integer function count_distinct_ana ( type(vol7d_ana), dimension(:), intent(in) vect,
logical, dimension(:), intent(in), optional mask,
logical, intent(in), optional back )

conta gli elementi distinti in vect

Definizione alla linea 635 del file vol7d_ana_class.F90.

636! Copyright (C) 2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
637! authors:
638! Davide Cesari <dcesari@arpa.emr.it>
639! Paolo Patruno <ppatruno@arpa.emr.it>
640
641! This program is free software; you can redistribute it and/or
642! modify it under the terms of the GNU General Public License as
643! published by the Free Software Foundation; either version 2 of
644! the License, or (at your option) any later version.
645
646! This program is distributed in the hope that it will be useful,
647! but WITHOUT ANY WARRANTY; without even the implied warranty of
648! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
649! GNU General Public License for more details.
650
651! You should have received a copy of the GNU General Public License
652! along with this program. If not, see <http://www.gnu.org/licenses/>.
653#include "config.h"
654
655!> Classe per la gestione dell'anagrafica di stazioni meteo e affini.
656!! Questo modulo definisce una classe in grado di rappresentare
657!! le caratteristiche di una stazione meteo fissa o mobile.
658!! \ingroup vol7d
659MODULE vol7d_ana_class
660USE kinds
663IMPLICIT NONE
664
665!> Lunghezza della stringa che indica l'identificativo del volo.
666INTEGER,PARAMETER :: vol7d_ana_lenident=20
667
668!> Definisce l'anagrafica di una stazione.
669!! I membri di \a vol7d_ana sono pubblici e quindi liberamente
670!! accessibili e scrivibili, ma è comunque consigliato assegnarli tramite
671!! il costruttore ::init.
672TYPE vol7d_ana
673 TYPE(geo_coord) :: coord !< coordinata per una stazione fissa
674 CHARACTER(len=vol7d_ana_lenident) :: ident !< identificativo per una stazione mobile (es. aereo)
675END TYPE vol7d_ana
676
677!> Valore mancante per vo7d_ana.
678TYPE(vol7d_ana),PARAMETER :: vol7d_ana_miss=vol7d_ana(geo_coord_miss,cmiss)
679
680!> Costruttore per la classe vol7d_ana.
681!! Deve essere richiamato
682!! per tutti gli oggetti di questo tipo definiti in un programma.
683INTERFACE init
684 MODULE PROCEDURE vol7d_ana_init
685END INTERFACE
686
687!> Distruttore per la classe vol7d_ana.
688!! Distrugge l'oggetto in maniera pulita, assegnandogli un valore mancante.
689INTERFACE delete
690 MODULE PROCEDURE vol7d_ana_delete
691END INTERFACE
692
693!> Logical equality operator for objects of \a vol7d_ana class.
694!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
695!! of any shape.
696INTERFACE OPERATOR (==)
697 MODULE PROCEDURE vol7d_ana_eq
698END INTERFACE
699
700!> Logical inequality operator for objects of \a vol7d_ana class.
701!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
702!! of any shape.
703INTERFACE OPERATOR (/=)
704 MODULE PROCEDURE vol7d_ana_ne
705END INTERFACE
706
707
708!> Logical greater-than operator for objects of \a vol7d_ana class.
709!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
710!! of any shape.
711!! Comparison is performed first on \a ident, then on coord
712INTERFACE OPERATOR (>)
713 MODULE PROCEDURE vol7d_ana_gt
714END INTERFACE
715
716!> Logical less-than operator for objects of \a vol7d_ana class.
717!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
718!! of any shape.
719!! Comparison is performed first on \a ident, then on coord
720INTERFACE OPERATOR (<)
721 MODULE PROCEDURE vol7d_ana_lt
722END INTERFACE
723
724!> Logical greater-equal operator for objects of \a vol7d_ana class.
725!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
726!! of any shape.
727!! Comparison is performed first on \a ident, then on coord
728INTERFACE OPERATOR (>=)
729 MODULE PROCEDURE vol7d_ana_ge
730END INTERFACE
731
732!> Logical less-equal operator for objects of \a vol7d_ana class.
733!! It is defined as \a ELEMENTAL thus it works also with conformal arrays
734!! of any shape.
735!! Comparison is performed first on \a ident, then on coord
736INTERFACE OPERATOR (<=)
737 MODULE PROCEDURE vol7d_ana_le
738END INTERFACE
739
740
741!> check for missing value
742INTERFACE c_e
743 MODULE PROCEDURE vol7d_ana_c_e
744END INTERFACE
745
746!> Legge un oggetto vol7d_ana o un vettore di oggetti vol7d_ana da
747!! un file \c FORMATTED o \c UNFORMATTED.
748INTERFACE read_unit
749 MODULE PROCEDURE vol7d_ana_read_unit, vol7d_ana_vect_read_unit
750END INTERFACE
751
752!> Scrive un oggetto vol7d_ana o un vettore di oggetti vol7d_ana su
753!! un file \c FORMATTED o \c UNFORMATTED.
754INTERFACE write_unit
755 MODULE PROCEDURE vol7d_ana_write_unit, vol7d_ana_vect_write_unit
756END INTERFACE
757
758#define VOL7D_POLY_TYPE TYPE(vol7d_ana)
759#define VOL7D_POLY_TYPES _ana
760#define ENABLE_SORT
761#include "array_utilities_pre.F90"
762
763!> Represent ana object in a pretty string
764INTERFACE to_char
765 MODULE PROCEDURE to_char_ana
766END INTERFACE
767
768!> Print object
769INTERFACE display
770 MODULE PROCEDURE display_ana
771END INTERFACE
772
773CONTAINS
774
775!> Inizializza un oggetto \a vol7d_ana con i parametri opzionali forniti.
776!! Se non viene passato nessun parametro opzionale l'oggetto è
777!! inizializzato a valore mancante.
778SUBROUTINE vol7d_ana_init(this, lon, lat, ident, ilon, ilat)
779TYPE(vol7d_ana),INTENT(INOUT) :: this !< oggetto da inizializzare
780REAL(kind=fp_geo),INTENT(in),OPTIONAL :: lon !< longitudine
781REAL(kind=fp_geo),INTENT(in),OPTIONAL :: lat !< latitudine
782CHARACTER(len=*),INTENT(in),OPTIONAL :: ident !< identificativo del volo
783INTEGER(kind=int_l),INTENT(in),OPTIONAL :: ilon !< integer longitude (nint(lon*1.d5)
784INTEGER(kind=int_l),INTENT(in),OPTIONAL :: ilat !< integer latitude (nint(lat*1.d5)
785
786CALL init(this%coord, lon=lon, lat=lat , ilon=ilon, ilat=ilat)
787IF (PRESENT(ident)) THEN
788 this%ident = ident
789ELSE
790 this%ident = cmiss
791ENDIF
792
793END SUBROUTINE vol7d_ana_init
794
795
796!> Distrugge l'oggetto in maniera pulita, assegnandogli un valore mancante.
797SUBROUTINE vol7d_ana_delete(this)
798TYPE(vol7d_ana),INTENT(INOUT) :: this !< oggetto da distruggre
799
800CALL delete(this%coord)
801this%ident = cmiss
802
803END SUBROUTINE vol7d_ana_delete
804
805
806
807character(len=80) function to_char_ana(this)
808
809TYPE(vol7d_ana),INTENT(in) :: this
810
811to_char_ana="ANA: "//&
812 to_char(getlon(this%coord),miss="Missing lon",form="(f11.5)")//&
813 to_char(getlat(this%coord),miss="Missing lat",form="(f11.5)")//&
814 t2c(this%ident,miss="Missing ident")
815
816return
817
818end function to_char_ana
819
820
821subroutine display_ana(this)
822
823TYPE(vol7d_ana),INTENT(in) :: this
824
825print*, trim(to_char(this))
826
827end subroutine display_ana
828
829
830ELEMENTAL FUNCTION vol7d_ana_eq(this, that) RESULT(res)
831TYPE(vol7d_ana),INTENT(IN) :: this, that
832LOGICAL :: res
833
834res = this%coord == that%coord .AND. this%ident == that%ident
835
836END FUNCTION vol7d_ana_eq
837
838
839ELEMENTAL FUNCTION vol7d_ana_ne(this, that) RESULT(res)
840TYPE(vol7d_ana),INTENT(IN) :: this, that
841LOGICAL :: res
842
843res = .NOT.(this == that)
844
845END FUNCTION vol7d_ana_ne
846
847
848ELEMENTAL FUNCTION vol7d_ana_gt(this, that) RESULT(res)
849TYPE(vol7d_ana),INTENT(IN) :: this, that
850LOGICAL :: res
851
852res = this%ident > that%ident
853
854if ( this%ident == that%ident) then
855 res =this%coord > that%coord
856end if
857
858END FUNCTION vol7d_ana_gt
859
860
861ELEMENTAL FUNCTION vol7d_ana_ge(this, that) RESULT(res)
862TYPE(vol7d_ana),INTENT(IN) :: this, that
863LOGICAL :: res
864
865res = .not. this < that
866
867END FUNCTION vol7d_ana_ge
868
869
870ELEMENTAL FUNCTION vol7d_ana_lt(this, that) RESULT(res)
871TYPE(vol7d_ana),INTENT(IN) :: this, that
872LOGICAL :: res
873
874res = this%ident < that%ident
875
876if ( this%ident == that%ident) then
877 res = this%coord < that%coord
878end if
879
880END FUNCTION vol7d_ana_lt
881
882
883ELEMENTAL FUNCTION vol7d_ana_le(this, that) RESULT(res)
884TYPE(vol7d_ana),INTENT(IN) :: this, that
885LOGICAL :: res
886
887res = .not. (this > that)
888
889END FUNCTION vol7d_ana_le
890
891
892
893ELEMENTAL FUNCTION vol7d_ana_c_e(this) RESULT(c_e)
894TYPE(vol7d_ana),INTENT(IN) :: this
895LOGICAL :: c_e
896c_e = this /= vol7d_ana_miss
897END FUNCTION vol7d_ana_c_e
898
899
900!> This method reads from a Fortran file unit the contents of the
901!! object \a this. The record to be read must have been written with
902!! the ::write_unit method. The method works both on formatted and
903!! unformatted files.
904SUBROUTINE vol7d_ana_read_unit(this, unit)
905TYPE(vol7d_ana),INTENT(out) :: this !< object to be read
906INTEGER, INTENT(in) :: unit !< unit from which to read, it must be an opened Fortran file unit
907
908CALL vol7d_ana_vect_read_unit((/this/), unit)
909
910END SUBROUTINE vol7d_ana_read_unit
911
912
913!> This method reads from a Fortran file unit the contents of the
914!! object \a this. The record to be read must have been written with
915!! the ::write_unit method. The method works both on formatted and
916!! unformatted files.
917SUBROUTINE vol7d_ana_vect_read_unit(this, unit)
918TYPE(vol7d_ana) :: this(:) !< object to be read
919INTEGER, INTENT(in) :: unit !< unit from which to read, it must be an opened Fortran file unit
920
921CHARACTER(len=40) :: form
922
923CALL read_unit(this%coord, unit)
924INQUIRE(unit, form=form)
925IF (form == 'FORMATTED') THEN
926 READ(unit,'(A)')this(:)%ident
927ELSE
928 READ(unit)this(:)%ident
929ENDIF
930
931END SUBROUTINE vol7d_ana_vect_read_unit
932
933
934!> This method writes on a Fortran file unit the contents of the
935!! object \a this. The record can successively be read by the
936!! ::read_unit method. The method works both on formatted and
937!! unformatted files.
938SUBROUTINE vol7d_ana_write_unit(this, unit)
939TYPE(vol7d_ana),INTENT(in) :: this !< object to be written
940INTEGER, INTENT(in) :: unit !< unit where to write, it must be an opened Fortran file unit
941
942CALL vol7d_ana_vect_write_unit((/this/), unit)
943
944END SUBROUTINE vol7d_ana_write_unit
945
946
947!> This method writes on a Fortran file unit the contents of the
948!! object \a this. The record can successively be read by the
949!! ::read_unit method. The method works both on formatted and
950!! unformatted files.
951SUBROUTINE vol7d_ana_vect_write_unit(this, unit)
952TYPE(vol7d_ana),INTENT(in) :: this(:) !< object to be written
953INTEGER, INTENT(in) :: unit !< unit where to write, it must be an opened Fortran file unit
954
955CHARACTER(len=40) :: form
956
957CALL write_unit(this%coord, unit)
958INQUIRE(unit, form=form)
959IF (form == 'FORMATTED') THEN
960 WRITE(unit,'(A)')this(:)%ident
961ELSE
962 WRITE(unit)this(:)%ident
963ENDIF
964
965END SUBROUTINE vol7d_ana_vect_write_unit
966
967
968#include "array_utilities_inc.F90"
969
970
971END MODULE vol7d_ana_class
check for missing value
Distruttore per la classe vol7d_ana.
Costruttore per la classe vol7d_ana.
Legge un oggetto vol7d_ana o un vettore di oggetti vol7d_ana da un file FORMATTED o UNFORMATTED.
Represent ana object in a pretty string.
Scrive un oggetto vol7d_ana o un vettore di oggetti vol7d_ana su un file FORMATTED o UNFORMATTED.
Classes for handling georeferenced sparse points in geographical corodinates.
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 dell'anagrafica di stazioni meteo e affini.
Definisce l'anagrafica di una stazione.

Generated with Doxygen.