コード例 #1
0
clim_metadata = Path(
    os.path.join(s_data, clim_and_soil_data,
                 "ISIMIP_HISTORICAL_METADATA.pbz2"))
with bz2.BZ2File(clim_metadata, mode='r') as fh:
    clim_metadata = pkl.load(fh)

stime = copy.deepcopy(clim_metadata[0])
del clim_metadata

# open co2 data
with open(os.path.join(s_data,
                       "co2/historical_CO2_annual_1765_2018.txt")) as fh:
    co2_data = fh.readlines()

# FUNCTIONAL TRAITS DATA
pls_table = pls.table_gen(npls)

# # Create the gridcell objects
if sombrero:
    # Running in all gridcells of mask
    grid_mn = []
    for Y in range(360):
        for X in range(720):
            if not mask[Y, X]:
                grid_mn.append(grd(X, Y))

else:
    grid_mn = []
    for Y in range(168, 171):
        for X in range(225, 228):
            if not mask[Y, X]:
コード例 #2
0
def pls_generator():
    print("running table gen from pls_generator")
    return table_gen(npls)
コード例 #3
0
# Function to test productivity
import sys

sys.path.insert(0, '../src/')

import numpy as np
import matplotlib.pyplot as plt
import caete_module as m
import plsgen as pls

dt = pls.table_gen(m.global_par.npls)


def test_prod(n):
    

    # real(kind=r_4), intent(in) :: temp                 !Mean monthly temperature (oC)
    temp = 22.0
    # real(kind=r_4), intent(in) :: p0                   !Mean surface pressure (hPa)
    p0 = 1010.0
    # real(kind=r_4), intent(in) :: w                    
    w = 50
    # real(kind=r_4), intent(in) :: ipar                 !Incident photosynthetic active radiation (w/m2)
    ipar = 160 / 2.18e5
    # real(kind=r_4), intent(in) :: rh,emax              !Relative humidity/MAXIMUM EVAPOTRANSPIRATION
    rh = 0.60; emax = 1.5 # kg m-2 day-1
    # real(kind=r_8), intent(in) :: cl1, cf1, ca1        !Carbon in plant tissues (kg/m2)
    cl1 = 0.5; cf1 =0.5; ca1 = 6
    # real(kind=r_8), intent(in) :: beta_leaf            !npp allocation to carbon pools (kg/m2/day)
    beta_leaf = 1e-2; beta_awood = 1e-2; beta_froot = 1e-2
    # real(kind=r_8), intent(in) :: beta_awood
コード例 #4
0
# create_plsbin.py
import caete_module
import plsgen as pls

pls.table_gen(caete_module.global_par.npls)
コード例 #5
0
from netCDF4 import num2date, MFDataset
import numpy as np
import plsgen as pls
from caete_input import data_in
from caete_module import global_par as gp
from caete_module import caete as model
from caete_module import photo as model_funcs

npls = gp.npls

# Mask for model execution
#mask = np.load('../input/random_amazon_mask_315.npy')

# Create the semi-random table of Plant Life Strategies
d_at = pls.table_gen(npls)


class gridcell_dyn:
    
    """
    Defines the gridcell object - This object stores all the input data,
    the data comming from model runs for each grid point and all the metadata
    describing the life cycle of the gridcell
    """
    
    def __init__(self, x, y):
    
        """Construct the gridcell object"""
    
        # CELL Identifiers