Skip to content

Commit

Permalink
make variable names consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
swensosc committed Feb 7, 2024
1 parent 220f314 commit 14f86af
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 53 deletions.
70 changes: 35 additions & 35 deletions src/biogeophys/HillslopeHydrologyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ subroutine InitHillslope(bounds,fsurdat)
real(r8), allocatable :: hill_slope(:,:) ! hillslope slope [m/m]
real(r8), allocatable :: hill_aspect(:,:) ! hillslope azimuth [radians]
real(r8), allocatable :: hill_area(:,:) ! hillslope area [m2]
real(r8), allocatable :: hill_length(:,:) ! hillslope length [m]
real(r8), allocatable :: hill_dist(:,:) ! hillslope length [m]
real(r8), allocatable :: hill_width(:,:) ! hillslope width [m]
real(r8), allocatable :: hill_height(:,:) ! hillslope height [m]
real(r8), allocatable :: hill_elev(:,:) ! hillslope height [m]
real(r8), allocatable :: hill_bedrock(:,:) ! hillslope bedrock depth [m]
real(r8), pointer :: fstream_in(:) ! read in - 1D - float

Expand Down Expand Up @@ -238,9 +238,9 @@ subroutine InitHillslope(bounds,fsurdat)
hill_slope (bounds%begl:bounds%endl,max_columns_hillslope), &
hill_aspect (bounds%begl:bounds%endl,max_columns_hillslope), &
hill_area (bounds%begl:bounds%endl,max_columns_hillslope), &
hill_length (bounds%begl:bounds%endl,max_columns_hillslope), &
hill_dist (bounds%begl:bounds%endl,max_columns_hillslope), &
hill_width (bounds%begl:bounds%endl,max_columns_hillslope), &
hill_height (bounds%begl:bounds%endl,max_columns_hillslope), &
hill_elev (bounds%begl:bounds%endl,max_columns_hillslope), &
col_pftndx (bounds%begc:bounds%endc), &
stat=ierr)

Expand Down Expand Up @@ -305,66 +305,66 @@ subroutine InitHillslope(bounds,fsurdat)
deallocate(ihillslope_in)

allocate(fhillslope_in(bounds%begg:bounds%endg,max_columns_hillslope))
call ncd_io(ncid=ncid, varname='h_slope', flag='read', data=fhillslope_in, dim1name=grlnd, readvar=readvar)
call ncd_io(ncid=ncid, varname='hillslope_slope', flag='read', data=fhillslope_in, dim1name=grlnd, readvar=readvar)
if (masterproc .and. .not. readvar) then
call endrun( 'ERROR:: h_slope not found on surface data set.'//errmsg(sourcefile, __LINE__) )
call endrun( 'ERROR:: hillslope_slope not found on surface data set.'//errmsg(sourcefile, __LINE__) )
end if

do l = bounds%begl,bounds%endl
g = lun%gridcell(l)
hill_slope(l,:) = fhillslope_in(g,:)
enddo

call ncd_io(ncid=ncid, varname='h_aspect', flag='read', data=fhillslope_in, dim1name=grlnd, readvar=readvar)
call ncd_io(ncid=ncid, varname='hillslope_aspect', flag='read', data=fhillslope_in, dim1name=grlnd, readvar=readvar)
if (masterproc .and. .not. readvar) then
call endrun( 'ERROR:: h_aspect not found on surface data set.'//errmsg(sourcefile, __LINE__) )
call endrun( 'ERROR:: hillslope_aspect not found on surface data set.'//errmsg(sourcefile, __LINE__) )
end if

do l = bounds%begl,bounds%endl
g = lun%gridcell(l)
hill_aspect(l,:) = fhillslope_in(g,:)
enddo

call ncd_io(ncid=ncid, varname='h_area', flag='read', data=fhillslope_in, dim1name=grlnd, readvar=readvar)
call ncd_io(ncid=ncid, varname='hillslope_area', flag='read', data=fhillslope_in, dim1name=grlnd, readvar=readvar)
if (masterproc .and. .not. readvar) then
call endrun( 'ERROR:: h_area not found on surface data set.'//errmsg(sourcefile, __LINE__) )
call endrun( 'ERROR:: hillslope_area not found on surface data set.'//errmsg(sourcefile, __LINE__) )
end if
do l = bounds%begl,bounds%endl
g = lun%gridcell(l)
hill_area(l,:) = fhillslope_in(g,:)
enddo
call ncd_io(ncid=ncid, varname='h_length', flag='read', data=fhillslope_in, dim1name=grlnd, readvar=readvar)
call ncd_io(ncid=ncid, varname='hillslope_distance', flag='read', data=fhillslope_in, dim1name=grlnd, readvar=readvar)
if (masterproc .and. .not. readvar) then
call endrun( 'ERROR:: h_length not found on surface data set.'//errmsg(sourcefile, __LINE__) )
call endrun( 'ERROR:: hillslope_length not found on surface data set.'//errmsg(sourcefile, __LINE__) )
end if

do l = bounds%begl,bounds%endl
g = lun%gridcell(l)
hill_length(l,:) = fhillslope_in(g,:)
hill_dist(l,:) = fhillslope_in(g,:)
enddo

call ncd_io(ncid=ncid, varname='h_width', flag='read', data=fhillslope_in, dim1name=grlnd, readvar=readvar)
call ncd_io(ncid=ncid, varname='hillslope_width', flag='read', data=fhillslope_in, dim1name=grlnd, readvar=readvar)
if (masterproc .and. .not. readvar) then
call endrun( 'ERROR:: h_width not found on surface data set.'//errmsg(sourcefile, __LINE__) )
call endrun( 'ERROR:: hillslope_width not found on surface data set.'//errmsg(sourcefile, __LINE__) )
end if
do l = bounds%begl,bounds%endl
g = lun%gridcell(l)
hill_width(l,:) = fhillslope_in(g,:)
enddo

call ncd_io(ncid=ncid, varname='h_height', flag='read', data=fhillslope_in, dim1name=grlnd, readvar=readvar)
call ncd_io(ncid=ncid, varname='hillslope_elevation', flag='read', data=fhillslope_in, dim1name=grlnd, readvar=readvar)
if (masterproc .and. .not. readvar) then
call endrun( 'ERROR:: h_height not found on surface data set.'//errmsg(sourcefile, __LINE__) )
call endrun( 'ERROR:: hillslope_height not found on surface data set.'//errmsg(sourcefile, __LINE__) )
end if
do l = bounds%begl,bounds%endl
g = lun%gridcell(l)
hill_height(l,:) = fhillslope_in(g,:)
hill_elev(l,:) = fhillslope_in(g,:)
enddo

deallocate(fhillslope_in)

allocate(ihillslope_in(bounds%begg:bounds%endg,max_columns_hillslope))
call ncd_io(ncid=ncid, varname='h_pftndx', flag='read', data=ihillslope_in, dim1name=grlnd, readvar=readvar)
call ncd_io(ncid=ncid, varname='hillslope_pftndx', flag='read', data=ihillslope_in, dim1name=grlnd, readvar=readvar)
if (readvar) then
allocate(hill_pftndx (bounds%begl:bounds%endl,max_columns_hillslope), stat=ierr)
do l = bounds%begl,bounds%endl
Expand All @@ -378,27 +378,27 @@ subroutine InitHillslope(bounds,fsurdat)
if (use_hillslope_routing) then
allocate(fstream_in(bounds%begg:bounds%endg))

call ncd_io(ncid=ncid, varname='h_stream_depth', flag='read', data=fstream_in, dim1name=grlnd, readvar=readvar)
call ncd_io(ncid=ncid, varname='hillslope_stream_depth', flag='read', data=fstream_in, dim1name=grlnd, readvar=readvar)
if (masterproc .and. .not. readvar) then
call endrun( 'ERROR:: h_stream_depth not found on surface data set.'//errmsg(sourcefile, __LINE__) )
call endrun( 'ERROR:: hillslope_stream_depth not found on surface data set.'//errmsg(sourcefile, __LINE__) )
end if
do l = bounds%begl,bounds%endl
g = lun%gridcell(l)
lun%stream_channel_depth(l) = fstream_in(g)
enddo

call ncd_io(ncid=ncid, varname='h_stream_width', flag='read', data=fstream_in, dim1name=grlnd, readvar=readvar)
call ncd_io(ncid=ncid, varname='hillslope_stream_width', flag='read', data=fstream_in, dim1name=grlnd, readvar=readvar)
if (masterproc .and. .not. readvar) then
call endrun( 'ERROR:: h_stream_width not found on surface data set.'//errmsg(sourcefile, __LINE__) )
call endrun( 'ERROR:: hillslope_stream_width not found on surface data set.'//errmsg(sourcefile, __LINE__) )
end if
do l = bounds%begl,bounds%endl
g = lun%gridcell(l)
lun%stream_channel_width(l) = fstream_in(g)
enddo

call ncd_io(ncid=ncid, varname='h_stream_slope', flag='read', data=fstream_in, dim1name=grlnd, readvar=readvar)
call ncd_io(ncid=ncid, varname='hillslope_stream_slope', flag='read', data=fstream_in, dim1name=grlnd, readvar=readvar)
if (masterproc .and. .not. readvar) then
call endrun( 'ERROR:: h_stream_slope not found on surface data set.'//errmsg(sourcefile, __LINE__) )
call endrun( 'ERROR:: hillslope_stream_slope not found on surface data set.'//errmsg(sourcefile, __LINE__) )
end if
do l = bounds%begl,bounds%endl
g = lun%gridcell(l)
Expand Down Expand Up @@ -442,17 +442,17 @@ subroutine InitHillslope(bounds,fsurdat)
enddo

! distance of lower edge of column from hillslope bottom
col%hill_distance(c) = hill_length(l,ci)
col%hill_distance(c) = hill_dist(l,ci)
! width of lower edge of column
col%hill_width(c) = hill_width(l,ci)
col%hill_width(c) = hill_width(l,ci)
! mean elevation of column relative to gridcell mean elevation
col%hill_elev(c) = hill_height(l,ci)
col%hill_elev(c) = hill_elev(l,ci)
! mean along-hill slope of column
col%hill_slope(c) = hill_slope(l,ci)
col%hill_slope(c) = hill_slope(l,ci)
! area of column
col%hill_area(c) = hill_area(l,ci)
col%hill_area(c) = hill_area(l,ci)
! azimuth of column
col%hill_aspect(c) = hill_aspect(l,ci)
col%hill_aspect(c) = hill_aspect(l,ci)
! pft index of column
if ( allocated(hill_pftndx) ) then
col_pftndx(c) = hill_pftndx(l,ci)
Expand Down Expand Up @@ -525,8 +525,8 @@ subroutine InitHillslope(bounds,fsurdat)
enddo ! end of landunit loop

deallocate(ncolumns_hillslope,pct_hillslope,hill_ndx,col_ndx,col_dndx, &
hill_slope,hill_area,hill_length, &
hill_width,hill_height,hill_aspect)
hill_slope,hill_area,hill_dist, &
hill_width,hill_elev,hill_aspect)

! Modify pft distributions
! this may require modifying subgridMod/natveg_patch_exists
Expand Down Expand Up @@ -604,9 +604,9 @@ subroutine SetHillslopeSoilThickness(bounds,fsurdat,soil_depth_lowland_in,soil_d
call ncd_pio_openfile (ncid, locfn, 0)

allocate(fhillslope_in(bounds%begg:bounds%endg,max_columns_hillslope))
call ncd_io(ncid=ncid, varname='h_bedrock', flag='read', data=fhillslope_in, dim1name=grlnd, readvar=readvar)
call ncd_io(ncid=ncid, varname='hillslope_bedrock_depth', flag='read', data=fhillslope_in, dim1name=grlnd, readvar=readvar)
if (masterproc .and. .not. readvar) then
call endrun( 'ERROR:: soil_profile_method = "FromFile", but h_bedrock not found on surface data set.'//errmsg(sourcefile, __LINE__) )
call endrun( 'ERROR:: soil_profile_method = "FromFile", but hillslope_bedrock not found on surface data set.'//errmsg(sourcefile, __LINE__) )
end if
do l = bounds%begl,bounds%endl
g = lun%gridcell(l)
Expand Down
36 changes: 18 additions & 18 deletions src/main/histFileMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3139,31 +3139,31 @@ subroutine htape_timeconst(t, mode)
long_name='coordinate levels for soil decomposition variables', units='m', ncid=nfid(t))

if (use_hillslope .and. .not.tape(t)%dov2xy)then
call ncd_defvar(varname='hslp_distance', xtype=ncd_double, &
call ncd_defvar(varname='hillslope_distance', xtype=ncd_double, &
dim1name=namec, long_name='hillslope column distance', &
units='m', ncid=nfid(t))
call ncd_defvar(varname='hslp_width', xtype=ncd_double, &
call ncd_defvar(varname='hillslope_width', xtype=ncd_double, &
dim1name=namec, long_name='hillslope column width', &
units='m', ncid=nfid(t))
call ncd_defvar(varname='hslp_area', xtype=ncd_double, &
call ncd_defvar(varname='hillslope_area', xtype=ncd_double, &
dim1name=namec, long_name='hillslope column area', &
units='m', ncid=nfid(t))
call ncd_defvar(varname='hslp_elev', xtype=ncd_double, &
call ncd_defvar(varname='hillslope_elev', xtype=ncd_double, &
dim1name=namec, long_name='hillslope column elevation', &
units='m', ncid=nfid(t))
call ncd_defvar(varname='hslp_slope', xtype=ncd_double, &
call ncd_defvar(varname='hillslope_slope', xtype=ncd_double, &
dim1name=namec, long_name='hillslope column slope', &
units='m', ncid=nfid(t))
call ncd_defvar(varname='hslp_aspect', xtype=ncd_double, &
call ncd_defvar(varname='hillslope_aspect', xtype=ncd_double, &
dim1name=namec, long_name='hillslope column aspect', &
units='m', ncid=nfid(t))
call ncd_defvar(varname='hslp_index', xtype=ncd_int, &
call ncd_defvar(varname='hillslope_index', xtype=ncd_int, &
dim1name=namec, long_name='hillslope index', &
ncid=nfid(t))
call ncd_defvar(varname='hslp_cold', xtype=ncd_int, &
call ncd_defvar(varname='hillslope_cold', xtype=ncd_int, &
dim1name=namec, long_name='hillslope downhill column index', &
ncid=nfid(t))
call ncd_defvar(varname='hslp_colu', xtype=ncd_int, &
call ncd_defvar(varname='hillslope_colu', xtype=ncd_int, &
dim1name=namec, long_name='hillslope uphill column index', &
ncid=nfid(t))
end if
Expand Down Expand Up @@ -3258,13 +3258,13 @@ subroutine htape_timeconst(t, mode)
end if

if (use_hillslope .and. .not.tape(t)%dov2xy) then
call ncd_io(varname='hslp_distance' , data=col%hill_distance, dim1name=namec, ncid=nfid(t), flag='write')
call ncd_io(varname='hslp_width' , data=col%hill_width, dim1name=namec, ncid=nfid(t), flag='write')
call ncd_io(varname='hslp_area' , data=col%hill_area, dim1name=namec, ncid=nfid(t), flag='write')
call ncd_io(varname='hslp_elev' , data=col%hill_elev, dim1name=namec, ncid=nfid(t), flag='write')
call ncd_io(varname='hslp_slope' , data=col%hill_slope, dim1name=namec, ncid=nfid(t), flag='write')
call ncd_io(varname='hslp_aspect' , data=col%hill_aspect, dim1name=namec, ncid=nfid(t), flag='write')
call ncd_io(varname='hslp_index' , data=col%hillslope_ndx, dim1name=namec, ncid=nfid(t), flag='write')
call ncd_io(varname='hillslope_distance' , data=col%hill_distance, dim1name=namec, ncid=nfid(t), flag='write')
call ncd_io(varname='hillslope_width' , data=col%hill_width, dim1name=namec, ncid=nfid(t), flag='write')
call ncd_io(varname='hillslope_area' , data=col%hill_area, dim1name=namec, ncid=nfid(t), flag='write')
call ncd_io(varname='hillslope_elev' , data=col%hill_elev, dim1name=namec, ncid=nfid(t), flag='write')
call ncd_io(varname='hillslope_slope' , data=col%hill_slope, dim1name=namec, ncid=nfid(t), flag='write')
call ncd_io(varname='hillslope_aspect' , data=col%hill_aspect, dim1name=namec, ncid=nfid(t), flag='write')
call ncd_io(varname='hillslope_index' , data=col%hillslope_ndx, dim1name=namec, ncid=nfid(t), flag='write')

! write global indices rather than local indices
allocate(icarr(bounds%begc:bounds%endc),stat=ier)
Expand All @@ -3280,7 +3280,7 @@ subroutine htape_timeconst(t, mode)
endif
enddo

call ncd_io(varname='hslp_cold' , data=icarr, dim1name=namec, ncid=nfid(t), flag='write')
call ncd_io(varname='hillslope_cold' , data=icarr, dim1name=namec, ncid=nfid(t), flag='write')

do c = bounds%begc,bounds%endc
if (col%colu(c) /= ispval) then
Expand All @@ -3290,7 +3290,7 @@ subroutine htape_timeconst(t, mode)
endif
enddo

call ncd_io(varname='hslp_colu' , data=icarr, dim1name=namec, ncid=nfid(t), flag='write')
call ncd_io(varname='hillslope_colu' , data=icarr, dim1name=namec, ncid=nfid(t), flag='write')
deallocate(icarr)
endif

Expand Down

0 comments on commit 14f86af

Please sign in to comment.