libsim Versione 7.1.11

◆ vol7d_var_delete()

elemental subroutine vol7d_var_delete ( type(vol7d_var), intent(inout)  this)

Distrugge l'oggetto in maniera pulita, assegnandogli un valore mancante.

Parametri
[in,out]thisoggetto da distruggre

Definizione alla linea 418 del file vol7d_var_class.F90.

419! Copyright (C) 2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
420! authors:
421! Davide Cesari <dcesari@arpa.emr.it>
422! Paolo Patruno <ppatruno@arpa.emr.it>
423
424! This program is free software; you can redistribute it and/or
425! modify it under the terms of the GNU General Public License as
426! published by the Free Software Foundation; either version 2 of
427! the License, or (at your option) any later version.
428
429! This program is distributed in the hope that it will be useful,
430! but WITHOUT ANY WARRANTY; without even the implied warranty of
431! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
432! GNU General Public License for more details.
433
434! You should have received a copy of the GNU General Public License
435! along with this program. If not, see <http://www.gnu.org/licenses/>.
436#include "config.h"
437
442MODULE vol7d_var_class
443USE kinds
446IMPLICIT NONE
447
456TYPE vol7d_var
457 CHARACTER(len=10) :: btable=cmiss
458 CHARACTER(len=65) :: description=cmiss
459 CHARACTER(len=24) :: unit=cmiss
460 INTEGER :: scalefactor=imiss
461
462 INTEGER :: r=imiss
463 INTEGER :: d=imiss
464 INTEGER :: i=imiss
465 INTEGER :: b=imiss
466 INTEGER :: c=imiss
467 INTEGER :: gribhint(4)=imiss
468END TYPE vol7d_var
469
471TYPE(vol7d_var),PARAMETER :: vol7d_var_miss= &
472 vol7d_var(cmiss,cmiss,cmiss,imiss,imiss,imiss,imiss,imiss,imiss, &
473 (/imiss,imiss,imiss,imiss/))
474
478INTERFACE init
479 MODULE PROCEDURE vol7d_var_init
480END INTERFACE
481
484INTERFACE delete
485 MODULE PROCEDURE vol7d_var_delete
486END INTERFACE
487
493INTERFACE OPERATOR (==)
494 MODULE PROCEDURE vol7d_var_eq
495END INTERFACE
496
502INTERFACE OPERATOR (/=)
503 MODULE PROCEDURE vol7d_var_ne, vol7d_var_nesv
504END INTERFACE
505
507INTERFACE c_e
508 MODULE PROCEDURE vol7d_var_c_e
509END INTERFACE
510
511#define VOL7D_POLY_TYPE TYPE(vol7d_var)
512#define VOL7D_POLY_TYPES _var
513#include "array_utilities_pre.F90"
514
516INTERFACE display
517 MODULE PROCEDURE display_var, display_var_vect
518END INTERFACE
519
520
521TYPE vol7d_var_features
522 TYPE(vol7d_var) :: var
523 REAL :: posdef
524 INTEGER :: vartype
525END TYPE vol7d_var_features
526
527TYPE(vol7d_var_features),ALLOCATABLE :: var_features(:)
528
529! constants for vol7d_vartype
530INTEGER,PARAMETER :: var_ord=0
531INTEGER,PARAMETER :: var_dir360=1
532INTEGER,PARAMETER :: var_press=2
533INTEGER,PARAMETER :: var_ucomp=3
534INTEGER,PARAMETER :: var_vcomp=4
535INTEGER,PARAMETER :: var_wcomp=5
536
537
538CONTAINS
539
545elemental SUBROUTINE vol7d_var_init(this, btable, description, unit, scalefactor)
546TYPE(vol7d_var),INTENT(INOUT) :: this
547CHARACTER(len=*),INTENT(in),OPTIONAL :: btable
548CHARACTER(len=*),INTENT(in),OPTIONAL :: description
549CHARACTER(len=*),INTENT(in),OPTIONAL :: unit
550INTEGER,INTENT(in),OPTIONAL :: scalefactor
551
552IF (PRESENT(btable)) THEN
553 this%btable = btable
554ELSE
555 this%btable = cmiss
556 this%description = cmiss
557 this%unit = cmiss
558 this%scalefactor = imiss
559 RETURN
560ENDIF
561IF (PRESENT(description)) THEN
562 this%description = description
563ELSE
564 this%description = cmiss
565ENDIF
566IF (PRESENT(unit)) THEN
567 this%unit = unit
568ELSE
569 this%unit = cmiss
570ENDIF
571if (present(scalefactor)) then
572 this%scalefactor = scalefactor
573else
574 this%scalefactor = imiss
575endif
576
577this%r = -1
578this%d = -1
579this%i = -1
580this%b = -1
581this%c = -1
582
583END SUBROUTINE vol7d_var_init
584
585
586ELEMENTAL FUNCTION vol7d_var_new(btable, description, unit, scalefactor) RESULT(this)
587CHARACTER(len=*),INTENT(in),OPTIONAL :: btable
588CHARACTER(len=*),INTENT(in),OPTIONAL :: description
589CHARACTER(len=*),INTENT(in),OPTIONAL :: unit
590INTEGER,INTENT(in),OPTIONAL :: scalefactor
591
592TYPE(vol7d_var) :: this
593
594CALL init(this, btable, description, unit, scalefactor)
595
596END FUNCTION vol7d_var_new
597
598
600elemental SUBROUTINE vol7d_var_delete(this)
601TYPE(vol7d_var),INTENT(INOUT) :: this
602
603this%btable = cmiss
604this%description = cmiss
605this%unit = cmiss
606this%scalefactor = imiss
607
608END SUBROUTINE vol7d_var_delete
609
610
611ELEMENTAL FUNCTION vol7d_var_eq(this, that) RESULT(res)
612TYPE(vol7d_var),INTENT(IN) :: this, that
613LOGICAL :: res
614
615res = this%btable == that%btable
616
617END FUNCTION vol7d_var_eq
618
619
620ELEMENTAL FUNCTION vol7d_var_ne(this, that) RESULT(res)
621TYPE(vol7d_var),INTENT(IN) :: this, that
622LOGICAL :: res
623
624res = .NOT.(this == that)
625
626END FUNCTION vol7d_var_ne
627
628
629FUNCTION vol7d_var_nesv(this, that) RESULT(res)
630TYPE(vol7d_var),INTENT(IN) :: this, that(:)
631LOGICAL :: res(SIZE(that))
632
633INTEGER :: i
634
635DO i = 1, SIZE(that)
636 res(i) = .NOT.(this == that(i))
637ENDDO
638
639END FUNCTION vol7d_var_nesv
640
641
642
644subroutine display_var(this)
645
646TYPE(vol7d_var),INTENT(in) :: this
647
648print*,"VOL7DVAR: ",this%btable,trim(this%description)," : ",this%unit,&
649 " scale factor",this%scalefactor
650
651end subroutine display_var
652
653
655subroutine display_var_vect(this)
656
657TYPE(vol7d_var),INTENT(in) :: this(:)
658integer :: i
659
660do i=1,size(this)
661 call display_var(this(i))
662end do
663
664end subroutine display_var_vect
665
666FUNCTION vol7d_var_c_e(this) RESULT(c_e)
667TYPE(vol7d_var),INTENT(IN) :: this
668LOGICAL :: c_e
669c_e = this /= vol7d_var_miss
670END FUNCTION vol7d_var_c_e
671
672
681SUBROUTINE vol7d_var_features_init()
682INTEGER :: un, i, n
683TYPE(csv_record) :: csv
684CHARACTER(len=1024) :: line
685
686IF (ALLOCATED(var_features)) RETURN
687
688un = open_package_file('varbufr.csv', filetype_data)
689n=0
690DO WHILE(.true.)
691 READ(un,*,END=100)
692 n = n + 1
693ENDDO
694
695100 CONTINUE
696
697rewind(un)
698ALLOCATE(var_features(n))
699
700DO i = 1, n
701 READ(un,'(A)',END=200)line
702 CALL init(csv, line)
703 CALL csv_record_getfield(csv, var_features(i)%var%btable)
704 CALL csv_record_getfield(csv)
705 CALL csv_record_getfield(csv)
706 CALL csv_record_getfield(csv, var_features(i)%posdef)
707 CALL csv_record_getfield(csv, var_features(i)%vartype)
708 CALL delete(csv)
709ENDDO
710
711200 CONTINUE
712CLOSE(un)
713
714END SUBROUTINE vol7d_var_features_init
715
716
720SUBROUTINE vol7d_var_features_delete()
721IF (ALLOCATED(var_features)) DEALLOCATE(var_features)
722END SUBROUTINE vol7d_var_features_delete
723
724
731ELEMENTAL FUNCTION vol7d_var_features_vartype(this) RESULT(vartype)
732TYPE(vol7d_var),INTENT(in) :: this
733INTEGER :: vartype
734
735INTEGER :: i
736
737vartype = imiss
738
739IF (ALLOCATED(var_features)) THEN
740 DO i = 1, SIZE(var_features)
741 IF (this == var_features(i)%var) THEN
742 vartype = var_features(i)%vartype
743 RETURN
744 ENDIF
745 ENDDO
746ENDIF
747
748END FUNCTION vol7d_var_features_vartype
749
750
761ELEMENTAL SUBROUTINE vol7d_var_features_posdef_apply(this, val)
762TYPE(vol7d_var),INTENT(in) :: this
763REAL,INTENT(inout) :: val
764
765INTEGER :: i
766
767IF (ALLOCATED(var_features)) THEN
768 DO i = 1, SIZE(var_features)
769 IF (this == var_features(i)%var) THEN
770 IF (c_e(var_features(i)%posdef)) val = max(var_features(i)%posdef, val)
771 RETURN
772 ENDIF
773 ENDDO
774ENDIF
775
776END SUBROUTINE vol7d_var_features_posdef_apply
777
778
783ELEMENTAL FUNCTION vol7d_vartype(this) RESULT(vartype)
784TYPE(vol7d_var),INTENT(in) :: this
785
786INTEGER :: vartype
787
788vartype = var_ord
789SELECT CASE(this%btable)
790CASE('B01012', 'B11001', 'B11043', 'B22001') ! direction, degree true
791 vartype = var_dir360
792CASE('B07004', 'B10004', 'B10051', 'B10060') ! pressure, Pa
793 vartype = var_press
794CASE('B11003', 'B11200') ! u-component
795 vartype = var_ucomp
796CASE('B11004', 'B11201') ! v-component
797 vartype = var_vcomp
798CASE('B11005', 'B11006') ! w-component
799 vartype = var_wcomp
800END SELECT
801
802END FUNCTION vol7d_vartype
803
804
805#include "array_utilities_inc.F90"
806
807
808END MODULE vol7d_var_class
Distruttore per la classe vol7d_var.
display on the screen a brief content of object
Costruttore per la classe vol7d_var.
Utilities for managing files.
Definition of constants to be used for declaring variables of a desired type.
Definition: kinds.F90:251
Definitions of constants and functions for working with missing values.
Classe per la gestione delle variabili osservate da stazioni meteo e affini.
Definisce una variabile meteorologica osservata o un suo attributo.

Generated with Doxygen.