Skip to content

Commit

Permalink
Merge pull request #79 from stellema/master
Browse files Browse the repository at this point in the history
Add eva main function, update fit_gev and add fitstart options
  • Loading branch information
stellema authored Oct 23, 2024
2 parents 5727504 + 27f7e09 commit 1afb9d8
Show file tree
Hide file tree
Showing 10 changed files with 1,111 additions and 632 deletions.
1 change: 1 addition & 0 deletions ci/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ dependencies:
- dask-jobqueue
- geopandas
- gitpython
- lmoments3
- netcdf4
- numpy
- pip
Expand Down
8 changes: 4 additions & 4 deletions docs/user_guide/worked_example-HadGEM3-GC31-MM.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1220,9 +1220,9 @@
"name": "stderr",
"output_type": "stream",
"text": [
"/home/599/dbi599/unseen/unseen/eva.py:253: UserWarning: Data fit failed. Retrying with 'generate_estimates=True'.\n",
"/home/599/dbi599/unseen/unseen/eva.py:253: UserWarning: Data fit failed. Retrying with 'fitstart='scipy_subet''.\n",
" warnings.warn(\n",
"/home/599/dbi599/unseen/unseen/eva.py:253: UserWarning: Data fit failed. Retrying with 'generate_estimates=True'.\n",
"/home/599/dbi599/unseen/unseen/eva.py:253: UserWarning: Data fit failed. Retrying with 'fitstart='scipy_subet''.\n",
" warnings.warn(\n"
]
},
Expand Down Expand Up @@ -2609,12 +2609,12 @@
],
"source": [
"model_da_indep.plot.hist(bins=50, density=True, alpha=0.7, facecolor='tab:blue')\n",
"model_raw_shape, model_raw_loc, model_raw_scale = eva.fit_gev(model_da_indep_stacked.values, generate_estimates=True)\n",
"model_raw_shape, model_raw_loc, model_raw_scale = eva.fit_gev(model_da_indep_stacked.values, fitstart='scipy_subet')\n",
"model_raw_pdf = gev.pdf(xvals, model_raw_shape, model_raw_loc, model_raw_scale)\n",
"plt.plot(xvals, model_raw_pdf, color='tab:blue', linewidth=4.0, label='model')\n",
"\n",
"model_da_bc.plot.hist(bins=50, density=True, alpha=0.7, facecolor='tab:orange')\n",
"model_bc_shape, model_bc_loc, model_bc_scale = eva.fit_gev(model_da_bc_stacked.values, generate_estimates=True)\n",
"model_bc_shape, model_bc_loc, model_bc_scale = eva.fit_gev(model_da_bc_stacked.values, fitstart='scipy_subet')\n",
"model_bc_pdf = gev.pdf(xvals, model_bc_shape, model_bc_loc, model_bc_scale)\n",
"plt.plot(xvals, model_bc_pdf, color='tab:orange', linewidth=4.0, label='model (corrected)')\n",
"\n",
Expand Down
4 changes: 2 additions & 2 deletions docs/user_guide/worked_example_stationary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -438,12 +438,12 @@ to see the effect of the bias correction.
model_da_bc_stacked = model_da_bc.dropna('lead_time').stack({'sample': ['ensemble', 'init_date', 'lead_time']})
model_da_indep.plot.hist(bins=50, density=True, alpha=0.7, facecolor='tab:blue')
model_raw_shape, model_raw_loc, model_raw_scale = eva.fit_gev(model_da_indep_stacked.values, generate_estimates=True)
model_raw_shape, model_raw_loc, model_raw_scale = eva.fit_gev(model_da_indep_stacked.values, fitstart='scipy_subet')
model_raw_pdf = gev.pdf(xvals, model_raw_shape, model_raw_loc, model_raw_scale)
plt.plot(xvals, model_raw_pdf, color='tab:blue', linewidth=4.0, label='model')
model_da_bc.plot.hist(bins=50, density=True, alpha=0.7, facecolor='tab:orange')
model_bc_shape, model_bc_loc, model_bc_scale = eva.fit_gev(model_da_bc_stacked.values, generate_estimates=True)
model_bc_shape, model_bc_loc, model_bc_scale = eva.fit_gev(model_da_bc_stacked.values, fitstart='scipy_subet')
model_bc_pdf = gev.pdf(xvals, model_bc_shape, model_bc_loc, model_bc_scale)
plt.plot(xvals, model_bc_pdf, color='tab:orange', linewidth=4.0, label='model (corrected)')
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"bias_correction = unseen.bias_correction:_main",
"stability = unseen.stability:_main",
"moments = unseen.moments:_main",
"eva = unseen.eva:_main",
]
},
)
Loading

0 comments on commit 1afb9d8

Please sign in to comment.