atmos-python / atmos

An atmospheric sciences library for Python
MIT License
64 stars 21 forks source link

Calculating dry air density #5

Open tomchor opened 6 years ago

tomchor commented 6 years ago

Let me start by saying this is a great piece of code. I am considering using it for most of the pre-processing calculations that I currently do in my package (Pymicra). Right now the pre-processing is coded in a very ugly way (https://github.com/tomchor/pymicra/blob/master/pymicra/micro/util.py) and this would be an elegant solution.

I'd like to ask a couple of things: 1 - is there a way to calculate density of dry air? I couldn't find one. 2 - if not, how hard would it be to implement it? 3 - Is this package still being maintained? Although I would very much like to implement this in my code, this is something I have to take into consideration.

Cheers

mcgibbon commented 6 years ago

1) Yes, you would use something like atmos.calculate('rho', Tv=273., p=1e5). 2) If a quantity isn't handled, it's just a matter of adding it to the quantities dictionary and putting in some equations which calculate it in equations.py, 3) Yes, sort of. As far as I know, this package never had a user base (other than myself using it to convert between measures of humidity), so it fell by the wayside. I haven't thought much about it in a while. But if you need help with the package (like this issue), have a bug that needs fixing, or want to submit a PR, I'm here to handle that. I wouldn't implement new features, but I can clean up and fix any existing ones that need it, and I would consider PRs for new features.

mcgibbon commented 6 years ago

You can find a complete list of handled quantities and assumptions in the docstring for atmos.calculate.

tomchor commented 6 years ago

I see. Indeed using your suggestion I can calculate it via the ideal gas law. Apparently rho stands for just for density, while I thought it stood for moist air density specifically.

How would you feel about separating rho and rho_dry (or rhod), the first one being reserved only for moist air and the second one being reserved only for dry air? I could try to do that myself.

It's nice that you're still somewhat maintaining atmos. I'll definitely try to incorporate your package in the future, then.

mcgibbon commented 6 years ago

rho is the air density including moisture (I suppose that's what you mean by moist air density). If you'd like a dry density, you can do that by saying the air is dry :) Just set any moisture measure you want to zero (e.g. atmos.calculate('rho', T=273., p=1e5, rv=0.)), or you can give the air temperature as the virtual temperature Tv instead of as T (when these are equal, there is no moisture). I don't think it makes sense to add a new quantity for this purpose. I think there's also an assumption like "Tv_equals_T" which can be used for this purpose.

nitesh1403 commented 2 years ago

How to do vertical integration, I found someone did uq_int = atm.int_pres(uq, pmin=300e2)

But module 'atmos' has no attribute 'int_pres'