spencerahill / aospy

Python package for automated analysis and management of gridded climate data
Apache License 2.0
83 stars 12 forks source link

Perform calculations on subset of levels #301

Open jdossgollin opened 5 years ago

jdossgollin commented 5 years ago

Since aospy is helpful as an abstraction of variables, calculations, etc, it would be helpful to have a single place to specify the levels (I'm thinking pressure levels but might be possible on sigma levels) at which to perform calculations. For example, one might be interested in calculating 500hPa geopotential height but not 700hPa or 200hPa. If the data are stored on the same file, the only way to do this (that I can figure out?) at present is to do so as part of a preprocessing function

spencerahill commented 5 years ago

We actually had this in a very hack-ish form at one point; in fact Calc still accepts a level kwarg in its constructor, which then gets assigned to the Calc's level attribute. But the logic to do anything with it subsequently got removed as part of our efforts to clean-up Calc and re-add things in a cleaner way as the need arises.

So it seems that the need has arisen! Which means we should think through how to go about implementing this. The logic of selecting particular levels from the data would belong in data_loader rather than Calc. Within Calc, we have to decide what to do regarding vertical reductions and how the results get outputted. All of that is doable.

jdossgollin commented 5 years ago

Got it -- that's helpful, because I did in fact see the level attribute in the Calc, which was a bit confusing.