ahernanzl / pyClim-SDM

Statistical Downscaling for Climate Change Projections with a Graphical User Interface
30 stars 15 forks source link

Adding direct predictors #41

Closed leiapauline closed 8 months ago

leiapauline commented 8 months ago

Hello, for some derived predictors (e.g. K index and Total totals index), I already have the actual values downloaded from ERA5. I want to use them directly instead of deriving them, but I can't figure out how to do so on my own. May I request your guidance on this matter? Thank you very much.

Sincerely, Leia Pauline

ahernanzl commented 8 months ago

Dear Leia, You could modify the lres_data function of the lib/read.py file. For each predictor you must modify two calls, one for reanalysis and the other for models. You will find that some predictors call the one_direct_predictor function, while other call the correspondent function of the derived_predictors.py file. Please confirm if you have managed to adapt the code to your specific case.

leiapauline commented 8 months ago

Hello Sir,

Appreciate your prompt response. I have modified the two lines in the lres_data function of the lib/read.py file. I was encountering this error, File "/home/ltonga/workdir/pyClim-SDM/src/../lib/read.py", line 197, in one_direct_predictor ncVar = reaNames[predName] ~~~~~~~~^^^^^^^^^^ KeyError: 'K' But after a few more edits, it went through with no further errors. if model == 'reanalysis': pathIn = '../input_data/reanalysis/' if predName == 'K': ncVar = 'kx' elif predName in targetVars: ncVar = reaNames[predName] else: for aux_level in all_levels: predName = predName.replace(str(aux_level), '') ncVar = reaNames[predName] filename = ncVar + '_' + reanalysisName + '_' + reanalysisPeriodFilename + '.nc' Thank you so much for your time.

Sincerely, Leia Pauline