ROMS
Loading...
Searching...
No Matches
mod_pio_netcdf::pio_netcdf_get_satt Interface Reference

Public Member Functions

subroutine pio_netcdf_get_satt_g (ng, model, ncname, varid, attname, attvalue, foundit, piofile)
 
subroutine pio_netcdf_get_satt_v (ng, model, ncname, piovar, attname, attvalue, foundit, piofile)
 

Detailed Description

Definition at line 84 of file mod_pio_netcdf.F.

Member Function/Subroutine Documentation

◆ pio_netcdf_get_satt_g()

subroutine mod_pio_netcdf::pio_netcdf_get_satt::pio_netcdf_get_satt_g ( integer, intent(in) ng,
integer, intent(in) model,
character (len=*), intent(in) ncname,
integer, intent(in) varid,
character (len=*), dimension(:), intent(in) attname,
character (len=*), dimension(:), intent(out) attvalue,
logical, dimension(:), intent(out) foundit,
type (file_desc_t), intent(in), optional piofile )

Definition at line 2728 of file mod_pio_netcdf.F.

2731!
2732!=======================================================================
2733! !
2734! This routine gets requested global string attribute(s). !
2735! !
2736! On Input: !
2737! !
2738! ng Nested grid number (integer) !
2739! model Calling model identifier (integer) !
2740! ncname NetCDF file name (string) !
2741! varid Global attribute ID (integer, PIO_global) !
2742! pioVar PIO variable descriptor, TYPE(Var_desc_t) !
2743! pioVar%varID Variable ID !
2744! pioVar%ncid File ID !
2745! varid Variable ID for variable attribute or !
2746! NF90_GLOBAL for a global attribute (integer) !
2747! AttName Attribute name to read (string array) !
2748! pioFile PIO file descriptor, TYPE(File_desc_t), OPTIONAL !
2749! pioFile%fh file handler !
2750! pioFile%iosystem IO system descriptor (struct) !
2751! !
2752! On Ouput: !
2753! !
2754! AttValue Attribute value (string array) !
2755! foundit Switch (T/F) activated when the requested !
2756! attribute is found (logical array) !
2757! !
2758!=======================================================================
2759!
2760! Imported variable declarations.
2761!
2762 integer, intent(in) :: ng, model
2763 integer, intent(in) :: varid
2764!
2765 character (len=*), intent(in) :: ncname
2766 character (len=*), intent(in) :: AttName(:)
2767!
2768 logical, intent(out) :: foundit(:)
2769!
2770 character (len=*), intent(out) :: AttValue(:)
2771!
2772 TYPE (File_desc_t), intent(in), optional :: pioFile
2773!
2774! Local variable declarations.
2775!
2776 integer :: i, j, my_natts, natts, status
2777!
2778 character (len=40) :: my_Aname
2779 character (len=40) :: my_Vname
2780
2781 character (len=*), parameter :: MyFile = &
2782 & __FILE__//", pio_netcdf_get_satt"
2783!
2784 TYPE (File_desc_t) :: my_pioFile
2785!
2786!-----------------------------------------------------------------------
2787! Inquire ID of requested variable.
2788!-----------------------------------------------------------------------
2789!
2790! Get number of variable attributes to process and initialize.
2791!
2792 natts=ubound(attname, dim=1)
2793 DO i=1,natts
2794 foundit(i)=.false.
2795 attvalue(i)=' '
2796 END DO
2797!
2798! If appropriate, open file for reading.
2799!
2800 IF (.not.PRESENT(piofile)) THEN
2801 CALL pio_netcdf_open (ng, model, trim(ncname), 0, my_piofile)
2802 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2803 ELSE
2804 my_piofile=piofile
2805 END IF
2806!
2807! Inquire about requested attribute value.
2808!
2809 status=pio_inquire(my_piofile, &
2810 & nattributes = my_natts)
2811 IF (status.eq.pio_noerr) THEN
2812 DO j=1,my_natts
2813 status=pio_inq_attname(my_piofile, varid, j, my_aname)
2814 IF (status.eq.pio_noerr) THEN
2815 DO i=1,natts
2816 IF (trim(my_aname).eq.trim(attname(i))) THEN
2817 status=pio_get_att(my_piofile, varid, &
2818 & trim(attname(i)), attvalue(i))
2819 IF (founderror(status, pio_noerr, &
2820 & __line__, myfile)) THEN
2821 IF (master) WRITE (stdout,10) trim(attname(i)), &
2822 & trim(my_vname), &
2823 & trim(ncname), &
2824 & trim(sourcefile)
2825 exit_flag=2
2826 ioerror=status
2827 END IF
2828 foundit(i)=.true.
2829 EXIT
2830 END IF
2831 END DO
2832 ELSE
2833 IF (master) WRITE (stdout,20) j, &
2834 & trim(my_vname), &
2835 & trim(ncname), &
2836 & trim(sourcefile)
2837 exit_flag=2
2838 ioerror=status
2839 EXIT
2840 END IF
2841 END DO
2842 ELSE
2843 IF (master) WRITE (stdout,30) trim(my_vname), &
2844 & trim(ncname), &
2845 & trim(sourcefile)
2846 exit_flag=2
2847 ioerror=status
2848 END IF
2849!
2850! If applicable, close input NetCDF file.
2851!
2852 IF (.not.PRESENT(piofile)) THEN
2853 CALL pio_netcdf_close (ng, model, my_piofile, ncname, .false.)
2854 END IF
2855!
2856 10 FORMAT (/,' PIO_NETCDF_GET_SATT_G - error while reading ', &
2857 & 'attribute:',1x,a,'for variable',1x,a, &
2858 & /,25x,'in input file:',2x,a,/,23x,'call from:',2x,a)
2859 20 FORMAT (/,' PIO_NETCDF_GET_SATT_G - error while inquiring ', &
2860 & 'attribute:',1x,i2.2,'for variable',1x,a, &
2861 & /,25x,'in input file:',2x,a,/,23x,'call from:',2x,a)
2862 30 FORMAT (/,' PIO_NETCDF_GET_SATT_G - error while inquiring', &
2863 & ' number of attributes for variable:',1x,a, &
2864 & /,25x,'in input file:',2x,a,/,19x,'call from:',2x,a)
2865!
2866 RETURN

References mod_scalars::exit_flag, strings_mod::founderror(), mod_iounits::ioerror, mod_parallel::master, mod_scalars::noerror, mod_pio_netcdf::pio_netcdf_close(), mod_pio_netcdf::pio_netcdf_open(), mod_iounits::sourcefile, and mod_iounits::stdout.

Here is the call graph for this function:

◆ pio_netcdf_get_satt_v()

subroutine mod_pio_netcdf::pio_netcdf_get_satt::pio_netcdf_get_satt_v ( integer, intent(in) ng,
integer, intent(in) model,
character (len=*), intent(in) ncname,
type (var_desc_t), intent(in) piovar,
character (len=*), dimension(:), intent(in) attname,
character (len=*), dimension(:), intent(out) attvalue,
logical, dimension(:), intent(out) foundit,
type (file_desc_t), intent(in), optional piofile )

Definition at line 2869 of file mod_pio_netcdf.F.

2872!
2873!=======================================================================
2874! !
2875! This routine gets requested variable string attribute(s). !
2876! !
2877! On Input: !
2878! !
2879! ng Nested grid number (integer) !
2880! model Calling model identifier (integer) !
2881! ncname NetCDF file name (string) !
2882! pioVar PIO variable descriptor, TYPE(Var_desc_t) !
2883! pioVar%varID Variable ID !
2884! pioVar%ncid File ID !
2885! varid Variable ID for variable attribute or !
2886! NF90_GLOBAL for a global attribute (integer) !
2887! AttName Attribute name to read (string array) !
2888! pioFile PIO file descriptor, TYPE(File_desc_t), OPTIONAL !
2889! pioFile%fh file handler !
2890! pioFile%iosystem IO system descriptor (struct) !
2891! !
2892! On Ouput: !
2893! !
2894! AttValue Attribute value (string array) !
2895! foundit Switch (T/F) activated when the requested !
2896! attribute is found (logical array) !
2897! !
2898!=======================================================================
2899!
2900! Imported variable declarations.
2901!
2902 integer, intent(in) :: ng, model
2903!
2904 character (len=*), intent(in) :: ncname
2905 character (len=*), intent(in) :: AttName(:)
2906!
2907 logical, intent(out) :: foundit(:)
2908!
2909 character (len=*), intent(out) :: AttValue(:)
2910!
2911 TYPE (Var_desc_t), intent(in) :: pioVar
2912 TYPE (File_desc_t), intent(in), optional :: pioFile
2913!
2914! Local variable declarations.
2915!
2916 integer :: i, j, my_natts, natts, status
2917!
2918 character (len=40) :: my_Aname
2919 character (len=40) :: my_Vname
2920
2921 character (len=*), parameter :: MyFile = &
2922 & __FILE__//", pio_netcdf_get_satt"
2923!
2924 TYPE (File_desc_t) :: my_pioFile
2925!
2926!-----------------------------------------------------------------------
2927! Inquire ID of requested variable.
2928!-----------------------------------------------------------------------
2929!
2930! Get number of variable attributes to process and initialize.
2931!
2932 natts=ubound(attname, dim=1)
2933 DO i=1,natts
2934 foundit(i)=.false.
2935 attvalue(i)=' '
2936 END DO
2937!
2938! If appropriate, open file for reading.
2939!
2940 IF (.not.PRESENT(piofile)) THEN
2941 CALL pio_netcdf_open (ng, model, trim(ncname), 0, my_piofile)
2942 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
2943 ELSE
2944 my_piofile=piofile
2945 END IF
2946!
2947! Inquire about requested attribute value.
2948!
2949 IF (piovar%varID.eq.pio_global) THEN
2950 status=pio_inquire(my_piofile, &
2951 & nattributes = my_natts)
2952 ELSE
2953 status=pio_inquire_variable(my_piofile, piovar, &
2954 & name = my_vname, &
2955 & natts = my_natts)
2956 END IF
2957 IF (status.eq.pio_noerr) THEN
2958 DO j=1,my_natts
2959 status=pio_inq_attname(my_piofile, piovar, j, my_aname)
2960 IF (status.eq.pio_noerr) THEN
2961 DO i=1,natts
2962 IF (trim(my_aname).eq.trim(attname(i))) THEN
2963 status=pio_get_att(my_piofile, piovar, &
2964 & trim(attname(i)), attvalue(i))
2965 IF (founderror(status, pio_noerr, &
2966 & __line__, myfile)) THEN
2967 IF (master) WRITE (stdout,10) trim(attname(i)), &
2968 & trim(my_vname), &
2969 & trim(ncname), &
2970 & trim(sourcefile)
2971 exit_flag=2
2972 ioerror=status
2973 END IF
2974 foundit(i)=.true.
2975 EXIT
2976 END IF
2977 END DO
2978 ELSE
2979 IF (master) WRITE (stdout,20) j, &
2980 & trim(my_vname), &
2981 & trim(ncname), &
2982 & trim(sourcefile)
2983 exit_flag=2
2984 ioerror=status
2985 EXIT
2986 END IF
2987 END DO
2988 ELSE
2989 IF (master) WRITE (stdout,30) trim(my_vname), &
2990 & trim(ncname), &
2991 & trim(sourcefile)
2992 exit_flag=2
2993 ioerror=status
2994 END IF
2995!
2996! If applicable, close input NetCDF file.
2997!
2998 IF (.not.PRESENT(piofile)) THEN
2999 CALL pio_netcdf_close (ng, model, my_piofile, ncname, .false.)
3000 END IF
3001!
3002 10 FORMAT (/,' PIO_NETCDF_GET_SATT_V - error while reading ', &
3003 & 'attribute:',1x,a,'for variable',1x,a, &
3004 & /,25x,'in input file:',2x,a,/,23x,'call from:',2x,a)
3005 20 FORMAT (/,' PIO_NETCDF_GET_SATT_V - error while inquiring ', &
3006 & 'attribute:',1x,i2.2,'for variable',1x,a, &
3007 & /,25x,'in input file:',2x,a,/,23x,'call from:',2x,a)
3008 30 FORMAT (/,' PIO_NETCDF_GET_SATT_V - error while inquiring', &
3009 & ' number of attributes for variable:',1x,a, &
3010 & /,25x,'in input file:',2x,a,/,19x,'call from:',2x,a)
3011!
3012 RETURN

References mod_scalars::exit_flag, strings_mod::founderror(), mod_iounits::ioerror, mod_parallel::master, mod_scalars::noerror, mod_pio_netcdf::pio_netcdf_close(), mod_pio_netcdf::pio_netcdf_open(), mod_iounits::sourcefile, and mod_iounits::stdout.

Here is the call graph for this function:

The documentation for this interface was generated from the following file: