00001 subroutine read_ndvi_old(filename, month, ndvidata, physfrac, d13cresp)
00002
00003
00004
00005 use kinds
00006 use sib_const_module, only: nsib, &
00007 subset, &
00008 subcount, &
00009 physmax
00010 use sib_io_module, only: drvr_type, &
00011 c4_source, &
00012 ndvi_source, &
00013 d13cresp_source
00014 #ifdef PGF
00015 use netcdf
00016 use typeSizes
00017 #endif
00018
00019
00020 character *100, intent(in) :: filename
00021 integer(kind=int_kind), intent(in) :: month
00022 real(kind=real_kind), dimension(subcount), intent(inout) :: ndvidata
00023 real(kind=dbl_kind), dimension(subcount,physmax), intent(out) :: physfrac
00024 real(kind=dbl_kind), dimension(subcount), intent(inout) :: d13cresp
00025
00026
00027 integer(kind=int_kind) :: i,j
00028 integer(kind=int_kind) :: ntest1
00029 integer(kind=int_kind) :: dimid
00030 integer(kind=int_kind) :: status
00031 integer(kind=int_kind) :: begin (2)
00032 integer(kind=int_kind) :: finish (2)
00033 integer(kind=int_kind) :: yyid
00034 integer(kind=int_kind) :: ndvi_id
00035 integer(kind=int_kind) :: phys_id
00036 integer(kind=int_kind) :: d13_id
00037 integer(kind=int_kind) :: x,y
00038 real(kind=real_kind), dimension(nsib) :: ndvi
00039 real(kind=real_kind), dimension(nsib,physmax) :: frac
00040 real(kind=real_kind), dimension(nsib) :: d13
00041 character(len=10) :: name
00042
00043
00044
00045 status = nf90_open ( trim(filename), nf90_nowrite, yyid )
00046 if (status /= nf90_noerr) call handle_err(status)
00047 status = nf90_inq_dimid ( yyid, 'nsib', dimid )
00048 if (status /= nf90_noerr) call handle_err(status)
00049 status = nf90_inquire_dimension ( yyid, dimid, name, ntest1 )
00050 if (status /= nf90_noerr) call handle_err(status)
00051 status = nf90_inq_varid ( yyid, 'ndvi', ndvi_id )
00052 if (status /= nf90_noerr) call handle_err(status)
00053 status = nf90_inq_varid ( yyid, 'd13cresp', d13_id )
00054 if (status /= nf90_noerr) call handle_err(status)
00055 status = nf90_inq_varid ( yyid, 'physfrac', phys_id )
00056 if (status /= nf90_noerr) call handle_err(status)
00057
00058
00059 if(ntest1 /= nsib) stop ' open: file sib_bc no match with model for nsib'
00060
00061
00062 begin (1) = month
00063 begin (2) = 1
00064 finish (1) = 1
00065 finish (2) = nsib
00066 status = nf90_get_var ( yyid, ndvi_id, ndvi, begin, finish )
00067 if (status /= nf90_noerr) call handle_err (status)
00068 status = nf90_get_var ( yyid, d13_id, d13 )
00069 if (status /= nf90_noerr) call handle_err (status)
00070 status = nf90_get_var ( yyid, phys_id, frac )
00071 if (status /= nf90_noerr) call handle_err (status)
00072
00073
00074 status = nf90_get_att( yyid, nf90_global, 'ndvi_source', ndvi_source )
00075 status = nf90_get_att( yyid, nf90_global, 'c4_source', c4_source )
00076 status = nf90_get_att( yyid, nf90_global, 'd13cresp_source', &
00077 d13cresp_source )
00078
00079
00080 status = nf90_close ( yyid )
00081 if (status /= nf90_noerr) call handle_err (status)
00082
00083
00084 do i = 1, subcount
00085 ndvidata(i) = ndvi(subset(i))
00086 d13cresp(i) = d13(subset(i))
00087 do j = 1, physmax
00088 physfrac(i,j) = frac(subset(i),j)
00089 enddo
00090 enddo
00091
00092 end subroutine read_ndvi_old