econ-ark/HARK

xarray revolution

Closed this issue · 3 comments

Continuing discussion from here:
#1283 (comment)

Perhaps we should use xarray data types everywhere, such as:

  • grids
  • distributions
  • solutions
  • as typed inputs/outputs to equations used in model definitions

@alanlujan91 has modeled this with Labeled distributions and several of the Consumer models already.

I propose (tentatively) that we work these changes throughout the library, rather than reserving them for special 'Labeled' classes.

Mv77 commented

Just want to add a comment of support. xarrays are awesome. Their smart broadcasting enables many useful features that we are already taking advantage of with labeled distributions and in my work on transition matrices.

Only things I would consider would be:

  1. They do have a semi-steep learning curve. I was initially frustrated with the coordinates, dimensions, datasets, dataarrays terminology and had to invest in figuring it out. It was absolutely worth it, but if we require too much hands-on with them in model definitions, it might discourage new users.
  2. Is it a popular library that we expect to become widespread? My sense is yes, and I see that their community is active. But if we want to put xarray at the core of HARK we might want to be extra-confident that the library will be maintained and used. @MridulS might comment on this based on his participation in the py-* conferences?

This may be useful: https://hugovk.github.io/top-pypi-packages/ -- xarray is in the top 1,000 most downloaded packages, and the top 0.2% of packages by downloads.