Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read standard parameter ancillary data in NetCDF #324

Open
wants to merge 6 commits into
base: CABLE-POP_TRENDY
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions offline/cable_LUC_EXPT.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ MODULE CABLE_LUC_EXPT

use cable_common_module, only: is_leapyear, leap_day, handle_err, get_unit
use cable_io_vars_module, only: logn, land_x, land_y, landpt, latitude, longitude
USE cable_common_module, ONLY: cable_user
use cable_def_types_mod, only: mland

implicit none
Expand Down Expand Up @@ -66,13 +67,14 @@ MODULE CABLE_LUC_EXPT

! ------------------------------------------------------------------

SUBROUTINE LUC_EXPT_INIT(LUC_EXPT)
SUBROUTINE LUC_EXPT_INIT(inMVG, LUC_EXPT)

use netcdf, only: nf90_open, nf90_nowrite, nf90_inq_varid, nf90_inq_dimid, &
nf90_inquire_dimension, nf90_inq_varid, nf90_get_att, nf90_get_var, nf90_close

implicit none

INTEGER, INTENT(IN) :: inMVG(:, :)
type(luc_expt_type), intent(inout) :: luc_expt

REAL :: tmp
Expand Down Expand Up @@ -374,6 +376,12 @@ SUBROUTINE LUC_EXPT_INIT(LUC_EXPT)
PrimOnly_fID = -1
ENDIF

IF (TRIM(cable_user%MetType) .EQ. "bios") THEN
DO k = 1, mland
LUC_EXPT%biome(k) = inMVG(landpt(k)%ilon,landpt(k)%ilat)
ENDDO
END IF

! Determine woody fraction (forest and shrub cover).
call get_woody_fraction(LUC_EXPT)

Expand Down Expand Up @@ -452,14 +460,12 @@ end subroutine luc_expt_zero
subroutine get_woody_fraction(LUC_EXPT)
! Determine woody fraction (forest and shrub cover) from ancillary data.

use cable_bios_met_obs_params, only: cable_bios_load_biome
use cable_common_module, only: cable_user

implicit none

type(LUC_EXPT_type), intent(inout) :: LUC_EXPT
real :: CPC(mland)
integer :: MVG(mland)
real :: projection_factor

if (TRIM(cable_user%MetType) .EQ. "bios") then
Expand All @@ -468,10 +474,8 @@ subroutine get_woody_fraction(LUC_EXPT)
! Woody fraction (woodfrac) is then calculated from CPC.

! read bios parameter file to NVIS Major Vegetation Group "biomes"
call cable_bios_load_biome(MVG)

! adjust fraction woody cover based on Major Vegetation Group
LUC_EXPT%biome = MVG
LUC_EXPT%ivegp = 2
projection_factor = 0.65
WHERE (LUC_EXPT%biome .eq. 1)
Expand Down Expand Up @@ -660,21 +664,17 @@ END SUBROUTINE LUC_EXPT_SET_TILES
! ------------------------------------------------------------------


SUBROUTINE LUC_EXPT_SET_TILES_BIOS(inVeg, inPfrac, LUC_EXPT )

USE cable_bios_met_obs_params, ONLY: cable_bios_load_fracC4
SUBROUTINE LUC_EXPT_SET_TILES_BIOS(inVeg, inPfrac, infracC4, LUC_EXPT )

IMPLICIT NONE

INTEGER, INTENT(INOUT) :: inVeg(:,:,:)
REAL, INTENT(INOUT) :: inPFrac(:,:,:)
TYPE (LUC_EXPT_TYPE), INTENT(INOUT) :: LUC_EXPT
REAL, INTENT(IN) :: infracC4(:,:)
TYPE (LUC_EXPT_TYPE), INTENT(IN) :: LUC_EXPT

REAL :: fracC4(mland)
INTEGER :: k, m, n

CALL cable_bios_load_fracC4(fracC4)

DO k=1, mland
m = landpt(k)%ilon
n = landpt(k)%ilat
Expand All @@ -686,7 +686,7 @@ SUBROUTINE LUC_EXPT_SET_TILES_BIOS(inVeg, inPfrac, LUC_EXPT )
inPFrac(m,n,2:3) = 0.0
inPFrac(m,n,1) = 1.0
if ( LUC_EXPT%grass(k) .gt. 0.01 ) then
if (fracC4(k).gt.0.5) then
if (infracC4(m, n).gt.0.5) then
inVeg(m,n,2) = 7 ! C4 grass
else
inVeg(m,n,2) = 6 ! C3 grass
Expand All @@ -699,7 +699,7 @@ SUBROUTINE LUC_EXPT_SET_TILES_BIOS(inVeg, inPfrac, LUC_EXPT )

inVeg(m,n,1) = LUC_EXPT%ivegp(k)
inVeg(m,n,2) = LUC_EXPT%ivegp(k)
if (fracC4(k).gt.0.5) then
if (infracC4(m, n).gt.0.5) then
inVeg(m,n,3) = 7 ! C4 grass
else
inVeg(m,n,3) = 6 ! C3 grass
Expand Down
Loading