# Path: topoflow/utils/model_input.py
# def open_file(var_type, input_file):
# def read_next2(self, var_name, rti, dtype='Float32', factor=1.0):
# def read_next(file_unit, var_type, rti, \
#               dtype='Float32', factor=1.0):
# def read_scalar(file_unit, dtype='Float32'):
# def read_grid(file_unit, rti, dtype='Float32'):
# def close_file(file_unit):
#     END_OF_FILE = (file_pos == file_size)
# 
# Path: topoflow/components/snow_base.py
# class snow_component( BMI_base.BMI_component ):
#     def set_constants(self):
#     def latent_heat_of_sublimation(self):
#     def initialize(self, cfg_file=None, mode="nondriver",
#                    SILENT=False):
#     def update(self, dt=-1.0):
#     def finalize(self):
#     def set_computed_input_vars(self):
#     def check_input_types(self):
#     def initialize_computed_vars(self):
#     def update_meltrate(self):
#     def enforce_max_meltrate(self):
#     def update_SM_integral(self):
#     def update_swe(self):
#     def update_depth(self):
#     def open_input_files(self):
#     def read_input_files(self):
#     def close_input_files(self):
#     def update_outfile_names(self):
#     def open_output_files(self):
#     def write_output_files(self, time_seconds=None):
#     def close_output_files(self):
#     def save_grids(self):
#     def save_pixel_values(self):
#         T = self.T_air
#         T_IS_GRID = self.is_grid('T_air')
#         P_IS_GRID = self.is_grid('P_snow')
#         H0_SNOW_IS_SCALAR = self.is_scalar('h0_snow')
#         H0_SWE_IS_SCALAR  = self.is_scalar('h0_swe') 


import numpy as np
from topoflow.utils import model_input
from topoflow.components import snow_base
        self.h0_snow_file  = self.in_directory + self.h0_snow_file
        self.h0_swe_file   = self.in_directory + self.h0_swe_file

        self.Cp_snow_unit  = model_input.open_file(self.Cp_snow_type,  self.Cp_snow_file)
        self.rho_snow_unit = model_input.open_file(self.rho_snow_type, self.rho_snow_file)
        self.T0_unit       = model_input.open_file(self.T0_type,       self.T0_file)
        self.h0_snow_unit  = model_input.open_file(self.h0_snow_type,  self.h0_snow_file)
        self.h0_swe_unit   = model_input.open_file(self.h0_swe_type,   self.h0_swe_file)

    #   open_input_files()
    #-------------------------------------------------------------------  
    def read_input_files(self):

        rti = self.rti

        #--------------------------------------------------------
        # All grids are assumed to have a data type of Float32.
        #--------------------------------------------------------
        Cp_snow = model_input.read_next(self.Cp_snow_unit, self.Cp_snow_type, rti)
        if (Cp_snow is not None): self.Cp_snow = Cp_snow
        
        rho_snow = model_input.read_next(self.rho_snow_unit, self.rho_snow_type, rti)
        if (rho_snow is not None): self.rho_snow = rho_snow

        T0 = model_input.read_next(self.T0_unit, self.T0_type, rti)
        if (T0 is not None): self.T0 = T0
        
        h0_snow = model_input.read_next(self.h0_snow_unit, self.h0_snow_type, rti)
        if (h0_snow is not None): self.h0_snow = h0_snow
        

# Path: topoflow/utils/model_input.py
# def open_file(var_type, input_file):
# def read_next2(self, var_name, rti, dtype='Float32', factor=1.0):
# def read_next(file_unit, var_type, rti, \
#               dtype='Float32', factor=1.0):
# def read_scalar(file_unit, dtype='Float32'):
# def read_grid(file_unit, rti, dtype='Float32'):
# def close_file(file_unit):
#     END_OF_FILE = (file_pos == file_size)
# 
# Path: topoflow/components/snow_base.py
# class snow_component( BMI_base.BMI_component ):
#     def set_constants(self):
#     def latent_heat_of_sublimation(self):
#     def initialize(self, cfg_file=None, mode="nondriver",
#                    SILENT=False):
#     def update(self, dt=-1.0):
#     def finalize(self):
#     def set_computed_input_vars(self):
#     def check_input_types(self):
#     def initialize_computed_vars(self):
#     def update_meltrate(self):
#     def enforce_max_meltrate(self):
#     def update_SM_integral(self):
#     def update_swe(self):
#     def update_depth(self):
#     def open_input_files(self):
#     def read_input_files(self):
#     def close_input_files(self):
#     def update_outfile_names(self):
#     def open_output_files(self):
#     def write_output_files(self, time_seconds=None):
#     def close_output_files(self):
#     def save_grids(self):
#     def save_pixel_values(self):
#         T = self.T_air
#         T_IS_GRID = self.is_grid('T_air')
#         P_IS_GRID = self.is_grid('P_snow')
#         H0_SNOW_IS_SCALAR = self.is_scalar('h0_snow')
#         H0_SWE_IS_SCALAR  = self.is_scalar('h0_swe') 


# Path: topoflow/components/snow_energy_balance.py
import numpy as np
from topoflow.utils import model_input
from topoflow.components import snow_base

        self.h0_snow_file  = self.in_directory + self.h0_snow_file
        self.h0_swe_file   = self.in_directory + self.h0_swe_file

        self.Cp_snow_unit  = model_input.open_file(self.Cp_snow_type,  self.Cp_snow_file)
        self.rho_snow_unit = model_input.open_file(self.rho_snow_type, self.rho_snow_file)
        self.T0_unit       = model_input.open_file(self.T0_type,       self.T0_file)
        self.h0_snow_unit  = model_input.open_file(self.h0_snow_type,  self.h0_snow_file)
        self.h0_swe_unit   = model_input.open_file(self.h0_swe_type,   self.h0_swe_file)

    #   open_input_files()
    #-------------------------------------------------------------------  
    def read_input_files(self):

        rti = self.rti

        #--------------------------------------------------------
        # All grids are assumed to have a data type of Float32.
        #--------------------------------------------------------
        Cp_snow = model_input.read_next(self.Cp_snow_unit, self.Cp_snow_type, rti)
        if (Cp_snow is not None): self.Cp_snow = Cp_snow
        
        rho_snow = model_input.read_next(self.rho_snow_unit, self.rho_snow_type, rti)
        if (rho_snow is not None): self.rho_snow = rho_snow

        T0 = model_input.read_next(self.T0_unit, self.T0_type, rti)
        if (T0 is not None): self.T0 = T0
        
        h0_snow = model_input.read_next(self.h0_snow_unit, self.h0_snow_type, rti)
        if (h0_snow is not None): self.h0_snow = h0_snow
        

        h0_swe = model_input.read_next(self.h0_swe_unit, self.h0_swe_type, rti)