libsim Versione 7.2.6

◆ count_distinct_sorted_ana()

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

conta gli elementi distinti in un sorted array

Definizione alla linea 601 del file vol7d_ana_class.F90.

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