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

Public Member Functions

subroutine pio_netcdf_put_lvar_0d (ng, model, ncname, myvarname, a, start, total, piofile, piovar)
 
subroutine pio_netcdf_put_lvar_1d (ng, model, ncname, myvarname, a, start, total, piofile, piovar)
 
subroutine pio_netcdf_put_lvar_2d (ng, model, ncname, myvarname, a, start, total, piofile, piovar)
 

Detailed Description

Definition at line 114 of file mod_pio_netcdf.F.

Member Function/Subroutine Documentation

◆ pio_netcdf_put_lvar_0d()

subroutine mod_pio_netcdf::pio_netcdf_put_lvar::pio_netcdf_put_lvar_0d ( integer, intent(in) ng,
integer, intent(in) model,
character (len=*), intent(in) ncname,
character (len=*), intent(in) myvarname,
logical, intent(in) a,
integer, dimension(:), intent(in) start,
integer, dimension(:), intent(in) total,
type (file_desc_t), intent(in), optional piofile,
type (var_desc_t), intent(in), optional piovar )

Definition at line 7941 of file mod_pio_netcdf.F.

7944!
7945!=======================================================================
7946! !
7947! It writes a logical scalar variable into a NetCDF file. If the file !
7948! descritor is not provided, it opens the file, writes data, and then !
7949! closes the file. !
7950! !
7951! The input logical data is converted to integer such that .FALSE. !
7952! is interpreted as zero, and .TRUE. is interpreted as one. !
7953! !
7954! On Input: !
7955! !
7956! ng Nested grid number (integer) !
7957! model Calling model identifier (integer) !
7958! ncname PIO filename (string) !
7959! myVarName Variable name (string) !
7960! A Data value(s) to be written (logical) !
7961! start Starting index where the first of the data values !
7962! will be written along each dimension (integer) !
7963! total Number of data values to be written along each !
7964! dimension (integer) !
7965! pioFile PIO file descriptor, TYPE(File_desc_t), OPTIONAL !
7966! pioFile%fh file handler !
7967! pioFile%iosystem IO system descriptor (struct) !
7968! pioVar PIO variable descriptor, TYPE(Var_desc_t), OPTIONAL !
7969! pioVar%varID Variable ID !
7970! pioVar%ncid File ID !
7971! !
7972! On Ouput: !
7973! !
7974! exit_flag Error flag (integer) stored in MOD_SCALARS !
7975! ioerror NetCDF return code (integer) stored in MOD_IOUNITS !
7976! !
7977! Notice: This routine must be used to write only nontiled variables. !
7978! !
7979!=======================================================================
7980!
7981! Imported variable declarations.
7982!
7983 integer, intent(in) :: ng, model
7984 integer, intent(in) :: start(:), total(:)
7985!
7986 logical, intent(in) :: A
7987!
7988 character (len=*), intent(in) :: ncname
7989 character (len=*), intent(in) :: myVarName
7990!
7991 TYPE (File_desc_t), intent(in), optional :: pioFile
7992 TYPE (Var_desc_t), intent(in), optional :: pioVar
7993!
7994! Local variable declarations.
7995!
7996 integer :: status
7997 integer :: AI
7998
7999 integer, dimension(1) :: my_AI
8000!
8001 character (len=*), parameter :: MyFile = &
8002 & __FILE__//", pio_netcdf_put_lvar_0d"
8003!
8004 TYPE (File_desc_t) :: my_pioFile
8005 TYPE (Var_desc_t) :: my_pioVar
8006!
8007!-----------------------------------------------------------------------
8008! Read in a floating-point scalar variable.
8009!-----------------------------------------------------------------------
8010!
8011! If file descriptor is not provided, open file for writing.
8012!
8013 IF (.not.PRESENT(piofile)) THEN
8014 CALL pio_netcdf_open (ng, model, trim(ncname), 1, my_piofile)
8015 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
8016 ELSE
8017 my_piofile=piofile
8018 END IF
8019!
8020! If variable descriptor is not provided, inquire its value.
8021!
8022 IF (.not.PRESENT(piovar)) THEN
8023 status=pio_inq_varid(my_piofile, trim(myvarname), my_piovar)
8024 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
8025 IF (master) WRITE (stdout,10) trim(myvarname), trim(ncname), &
8026 & trim(sourcefile)
8027 exit_flag=3
8028 ioerror=status
8029 END IF
8030 ELSE
8031 my_piovar=piovar
8032 END IF
8033!
8034! Convert logical data to integer: .FALSE. is interpreted as zero, and
8035! .TRUE. is interpreted as one.
8036!
8037 IF (a) THEN
8038 ai=1
8039 ELSE
8040 ai=0
8041 END IF
8042!
8043! Write out logical data as integers.
8044!
8045 IF (exit_flag.eq.noerror) THEN
8046 IF ((start(1).eq.0).and.(total(1).eq.0)) THEN
8047 status=pio_put_var(my_piofile, my_piovar, ai)
8048 ELSE
8049 my_ai(1)=ai
8050 status=pio_put_var(my_piofile, my_piovar, start, total, my_ai)
8051 END IF
8052 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
8053 IF (master) WRITE (stdout,20) trim(myvarname), trim(ncname), &
8054 & trim(sourcefile)
8055 exit_flag=3
8056 ioerror=status
8057 END IF
8058 END IF
8059!
8060! Close file.
8061!
8062 IF (.not.PRESENT(piofile)) THEN
8063 CALL pio_netcdf_close (ng, model, my_piofile, ncname, .false.)
8064 END IF
8065!
8066 10 FORMAT (/,' PIO_NETCDF_PUT_LVAR_0D - error while inquiring ', &
8067 & 'descriptor for variable:',2x,a,/,26x,'in input file:', &
8068 & 2x,a,/,26x,'call from:',2x,a)
8069 20 FORMAT (/,'PIO_NETCDF_PUT_LVAR_0D - error while writing ', &
8070 & 'variable:',2x,a,/,26x,'in input file:',2x,a, &
8071 & /,26x,'call from:',2x,a)
8072!
8073 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_put_lvar_1d()

subroutine mod_pio_netcdf::pio_netcdf_put_lvar::pio_netcdf_put_lvar_1d ( integer, intent(in) ng,
integer, intent(in) model,
character (len=*), intent(in) ncname,
character (len=*), intent(in) myvarname,
logical, dimension(:), intent(in) a,
integer, dimension(:), intent(in) start,
integer, dimension(:), intent(in) total,
type (file_desc_t), intent(in), optional piofile,
type (var_desc_t), intent(in), optional piovar )

Definition at line 8076 of file mod_pio_netcdf.F.

8079!
8080!=======================================================================
8081! !
8082! It writes a logical 1D-array variable into a NetCDF file. If the !
8083! file descritor is not provided, it opens the file, writes data, !
8084! and then closes the file. !
8085! !
8086! The input logical data is converted to integer such that .FALSE. !
8087! is interpreted as zero, and .TRUE. is interpreted as one. !
8088! !
8089! On Input: !
8090! !
8091! ng Nested grid number (integer) !
8092! model Calling model identifier (integer) !
8093! ncname PIO filename (string) !
8094! myVarName Variable name (string) !
8095! A Data value(s) to be written (logical) !
8096! start Starting index where the first of the data values !
8097! will be written along each dimension (integer) !
8098! total Number of data values to be written along each !
8099! dimension (integer) !
8100! pioFile PIO file descriptor, TYPE(File_desc_t), OPTIONAL !
8101! pioFile%fh file handler !
8102! pioFile%iosystem IO system descriptor (struct) !
8103! pioVar PIO variable descriptor, TYPE(Var_desc_t), OPTIONAL !
8104! pioVar%varID Variable ID !
8105! pioVar%ncid File ID !
8106! !
8107! On Ouput: !
8108! !
8109! exit_flag Error flag (integer) stored in MOD_SCALARS !
8110! ioerror NetCDF return code (integer) stored in MOD_IOUNITS !
8111! !
8112! Notice: This routine must be used to write only nontiled variables. !
8113! !
8114!=======================================================================
8115!
8116! Imported variable declarations.
8117!
8118 integer, intent(in) :: ng, model
8119 integer, intent(in) :: start(:), total(:)
8120!
8121 logical, intent(in) :: A(:)
8122!
8123 character (len=*), intent(in) :: ncname
8124 character (len=*), intent(in) :: myVarName
8125!
8126 TYPE (File_desc_t), intent(in), optional :: pioFile
8127 TYPE (Var_desc_t), intent(in), optional :: pioVar
8128!
8129! Local variable declarations.
8130!
8131 integer :: i, status
8132
8133 integer, dimension(SIZE(A,1)) :: AI
8134!
8135 character (len=*), parameter :: MyFile = &
8136 & __FILE__//", pio_netcdf_put_lvar_1d"
8137!
8138 TYPE (File_desc_t) :: my_pioFile
8139 TYPE (Var_desc_t) :: my_pioVar
8140!
8141!-----------------------------------------------------------------------
8142! Read in a floating-point scalar variable.
8143!-----------------------------------------------------------------------
8144!
8145! If file descriptor is not provided, open file for writing.
8146!
8147 IF (.not.PRESENT(piofile)) THEN
8148 CALL pio_netcdf_open (ng, model, trim(ncname), 1, my_piofile)
8149 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
8150 ELSE
8151 my_piofile=piofile
8152 END IF
8153!
8154! If variable descriptor is not provided, inquire its value.
8155!
8156 IF (.not.PRESENT(piovar)) THEN
8157 status=pio_inq_varid(my_piofile, trim(myvarname), my_piovar)
8158 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
8159 IF (master) WRITE (stdout,10) trim(myvarname), trim(ncname), &
8160 & trim(sourcefile)
8161 exit_flag=3
8162 ioerror=status
8163 END IF
8164 ELSE
8165 my_piovar=piovar
8166 END IF
8167!
8168! Convert logical data to integer: .FALSE. is interpreted as zero, and
8169! .TRUE. is interpreted as one.
8170!
8171 DO i=1,SIZE(a,1)
8172 IF (a(i)) THEN
8173 ai(i)=1
8174 ELSE
8175 ai(i)=0
8176 END IF
8177 END DO
8178!
8179! Write out logical data as integers.
8180!
8181 IF (exit_flag.eq.noerror) THEN
8182 status=pio_put_var(my_piofile, my_piovar, start, total, ai)
8183 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
8184 IF (master) WRITE (stdout,20) trim(myvarname), trim(ncname), &
8185 & trim(sourcefile)
8186 exit_flag=3
8187 ioerror=status
8188 END IF
8189 END IF
8190!
8191! Close file.
8192!
8193 IF (.not.PRESENT(piofile)) THEN
8194 CALL pio_netcdf_close (ng, model, my_piofile, ncname, .false.)
8195 END IF
8196!
8197 10 FORMAT (/,' PIO_NETCDF_PUT_LVAR_1D - error while inquiring ', &
8198 & 'descriptor for variable:',2x,a,/,26x,'in input file:', &
8199 & 2x,a,/,26x,'call from:',2x,a)
8200 20 FORMAT (/,' PIO_NETCDF_PUT_LVAR_1D - error while writing ', &
8201 & 'variable:',2x,a,/,26x,'in input file:',2x,a, &
8202 & /,26x,'call from:',2x,a)
8203!
8204 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_put_lvar_2d()

subroutine mod_pio_netcdf::pio_netcdf_put_lvar::pio_netcdf_put_lvar_2d ( integer, intent(in) ng,
integer, intent(in) model,
character (len=*), intent(in) ncname,
character (len=*), intent(in) myvarname,
logical, dimension(:,:), intent(in) a,
integer, dimension(:), intent(in) start,
integer, dimension(:), intent(in) total,
type (file_desc_t), intent(in), optional piofile,
type (var_desc_t), intent(in), optional piovar )

Definition at line 8207 of file mod_pio_netcdf.F.

8210!
8211!=======================================================================
8212! !
8213! It writes a logical 2D-array variable into a NetCDF file. If the !
8214! file descritor is not provided, it opens the file, writes data, !
8215! and then closes the file. !
8216! !
8217! The input logical data is converted to integer such that .FALSE. !
8218! is interpreted as zero, and .TRUE. is interpreted as one. !
8219! !
8220! On Input: !
8221! !
8222! ng Nested grid number (integer) !
8223! model Calling model identifier (integer) !
8224! ncname PIO filename (string) !
8225! myVarName Variable name (string) !
8226! A Data value(s) to be written (logical) !
8227! start Starting index where the first of the data values !
8228! will be written along each dimension (integer) !
8229! total Number of data values to be written along each !
8230! dimension (integer) !
8231! pioFile PIO file descriptor, TYPE(File_desc_t), OPTIONAL !
8232! pioFile%fh file handler !
8233! pioFile%iosystem IO system descriptor (struct) !
8234! pioVar PIO variable descriptor, TYPE(Var_desc_t), OPTIONAL !
8235! pioVar%varID Variable ID !
8236! pioVar%ncid File ID !
8237! !
8238! On Ouput: !
8239! !
8240! exit_flag Error flag (integer) stored in MOD_SCALARS !
8241! ioerror NetCDF return code (integer) stored in MOD_IOUNITS !
8242! !
8243! Notice: This routine must be used to write only nontiled variables. !
8244! !
8245!=======================================================================
8246!
8247! Imported variable declarations.
8248!
8249 integer, intent(in) :: ng, model
8250 integer, intent(in) :: start(:), total(:)
8251!
8252 logical, intent(in) :: A(:,:)
8253!
8254 character (len=*), intent(in) :: ncname
8255 character (len=*), intent(in) :: myVarName
8256!
8257 TYPE (File_desc_t), intent(in), optional :: pioFile
8258 TYPE (Var_desc_t), intent(in), optional :: pioVar
8259!
8260! Local variable declarations.
8261!
8262 integer :: i, j, status
8263
8264 integer, dimension(SIZE(A,1),SIZE(A,2)) :: AI
8265!
8266 character (len=*), parameter :: MyFile = &
8267 & __FILE__//", pio_netcdf_put_lvar_2d"
8268!
8269 TYPE (File_desc_t) :: my_pioFile
8270 TYPE (Var_desc_t) :: my_pioVar
8271!
8272!-----------------------------------------------------------------------
8273! Read in a floating-point scalar variable.
8274!-----------------------------------------------------------------------
8275!
8276! If file descriptor is not provided, open file for writing.
8277!
8278 IF (.not.PRESENT(piofile)) THEN
8279 CALL pio_netcdf_open (ng, model, trim(ncname), 1, my_piofile)
8280 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
8281 ELSE
8282 my_piofile=piofile
8283 END IF
8284!
8285! If variable descriptor is not provided, inquire its value.
8286!
8287 IF (.not.PRESENT(piovar)) THEN
8288 status=pio_inq_varid(my_piofile, trim(myvarname), my_piovar)
8289 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
8290 IF (master) WRITE (stdout,10) trim(myvarname), trim(ncname), &
8291 & trim(sourcefile)
8292 exit_flag=3
8293 ioerror=status
8294 END IF
8295 ELSE
8296 my_piovar=piovar
8297 END IF
8298!
8299! Convert logical data to integer: .FALSE. is interpreted as zero, and
8300! .TRUE. is interpreted as one.
8301!
8302 DO j=1,SIZE(a,2)
8303 DO i=1,SIZE(a,1)
8304 IF (a(i,j)) THEN
8305 ai(i,j)=1
8306 ELSE
8307 ai(i,j)=0
8308 END IF
8309 END DO
8310 END DO
8311!
8312! Write out logical data as integers.
8313!
8314 IF (exit_flag.eq.noerror) THEN
8315 status=pio_put_var(my_piofile, my_piovar, start, total, ai)
8316 IF (founderror(status, pio_noerr, __line__, myfile)) THEN
8317 IF (master) WRITE (stdout,20) trim(myvarname), trim(ncname), &
8318 & trim(sourcefile)
8319 exit_flag=3
8320 ioerror=status
8321 END IF
8322 END IF
8323!
8324! Close file.
8325!
8326 IF (.not.PRESENT(piofile)) THEN
8327 CALL pio_netcdf_close (ng, model, my_piofile, ncname, .false.)
8328 END IF
8329!
8330 10 FORMAT (/,' PIO_NETCDF_PUT_LVAR_2D - error while inquiring ', &
8331 & 'descriptor for variable:',2x,a,/,26x,'in input file:', &
8332 & 2x,a,/,26x,'call from:',2x,a)
8333 20 FORMAT (/,' PIO_NETCDF_PUT_LVAR_2D - error while writing ', &
8334 & 'variable:',2x,a,/,26x,'in input file:',2x,a, &
8335 & /,26x,'call from:',2x,a)
8336!
8337 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: