pankajkarman/bias_correction

Bias_Correction

pradhancda opened this issue · 3 comments

Sir,

Is it applicable to netcdf ?
To do bias correct within era5 (obs) and rcm (model)......
How to merge all netcdf aa rcm data comes separately ?
can i run directly in python or any virtual environment is required ?

Please clarify..........

regards,
Subhasis

It is recommended to use a separate python environment for new projects to avoid problems in future. There is no python version related problem with this library, but try to use any python3 version to avoid breaking your codes in future.

Dear sir,

I am appplying gamma_mapping to model data. but it is giving following error

FitError: Optimization converged to parameters that are outside the range allowed by the distribution.

my code is

models = ["MMM"] # Add other models if needed
var_names_sec = ["ua"]

for m in models:
for var1 in var_names_sec:
for ldyr in range(1, 2):
ob = xr.open_dataset(var1+'_obs_1960_2012_lead'+str(ldyr)+'.nc')
ob.load()
obs_data = ob.uwnd.sel(level=(200))

        mo = xr.open_dataset(var1+'_'+m+'_1960_2012_lead'+str(ldyr)+'.nc')
        model_data = mo.ua.sel(plev=(200))
        
        time = obs_data.time
        lat = obs_data.lat
        lon = obs_data.lon
        model_data = xr.DataArray(model_data, coords=[obs_data.time, lat, lon], dims=['time', 'lat', 'lon'])
        sce_data = model_data
        ds = xr.Dataset({'model_data':obs_data,'obs_data':model_data, 'sce_data':sce_data}) 
        
        bc = XBiasCorrection(ds['obs_data'], ds['model_data'], ds['sce_data'])
        df3 = bc.correct(method='gamma_mapping')
        df3.to_netcdf(var1+'_'+m+'_1960_2012_lead'+str(ldyr)+'_qmbc.nc')

Please help to resolve the issue.