Created
November 5, 2010 16:48
-
-
Save mdekauwe/664428 to your computer and use it in GitHub Desktop.
attempt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def grab_all_model_data(self): | |
""" Read all the models outputs into various arrays, also grabs various headers """ | |
models = ['CASA', 'CLMX', 'EALC', 'EDXX', 'GDAY', 'LPJG', 'ISAM', 'OCNX', 'SDVM', 'TECO'] | |
years = np.arange(1990, 2011) | |
model_var = {} | |
model_outputs = {} | |
for model in self.model_dict: | |
where = self.model_dir + model | |
# read header info and then open the data | |
fname = os.path.join(where, 'Day_' + model + self.site + 'AMB' + '.asc.hdr') | |
(header, numrows, numcols) = self.read_header(fname) | |
model_var[model] = header | |
for treatment in 'AMB', 'ELE': | |
model_outputs[model] = treatment | |
fname = os.path.join(where, 'Day_' + model + self.site + treatment + '.asc') | |
data = gd.fillUpArray(fname).reshape(numrows, numcols) | |
i = 0 | |
for var in model_var[model]: | |
model_outputs[model][var] = data[i] | |
i += 1 | |
print model_var | |
#sys.exit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment