def vmr2cd(ws):
    """
    Get the total integrated column water value from the ARTS arts workspace.
    """
    p = ws.p_grid.value
    t = ws.t_field.value.ravel()
    z = ws.z_field.value.ravel()
    vmr = ws.vmr_field.value[0, :, :, :].ravel()
    rho = density(p, t)
    mr = vmr * 18.015 / 28.97
    return np.trapz(mr * rho, z)
Exemplo n.º 2
0
 def test_density(self):
     """Test calculation of air density."""
     x = physics.density(1013.15e2, 273.15)
     assert np.allclose(x, 1.2921250376634072)
Exemplo n.º 3
0
def _to_p_coordinates(gamma, p, T):
    """Convert dT/dz(p, T) to dT/dP(p, T)."""
    g = constants.earth_standard_gravity
    rho = density(p, T)

    return gamma / (g * rho)
        'LatentHeatFlux(W/m2)':'LE',
        'SensibleHeatFlux(W/m2)':'H',
        'WindDirection(d)':'wd'})

geus_h=geus_all.loc[pd.to_datetime('2018-06-10 12:00'):pd.to_datetime('2018-07-01 21:00'),:].copy() #thats the period when Pic was only running at 2m level


B=621.9907 #g/kg
''''# This is HC's convertion approach, this is actually used in all paper 1 calculations. It's almost the same as the laternative calculation below
geus_h.loc[:,'Pw']= (geus_h.spechum/B)*(geus_h.p*100)/(1+(geus_h.spechum/B)) #Water Vapour Pressure Pa from Vaisala eq 14, I assume spechum is the same as mixing ratio

C=2.16679 #gK/J
geus_h.loc[:,'abshum']= C*geus_h.Pw/(geus_h.temp+273.15) #absolute humidity in g/m3 from Vaisala eq 17, assuming ideal gas law
'''
# alternative way of calculating as of 15.02.2021 (is more or less the same as above, except that you do not use eq14 with assuming spec humidity is mixing ratio)
geus_h.loc[:,'abshum']= geus_h.spechum*ty.density(geus_h.p*100, T=geus_h.temp+273.15)  #calculating density assuming ideal gas law and dry air constant 


# see if what I do is comparable to the typhon absolute huidity calculation --> they dont have that conversion, even better :D

# see what the difference between specific humidity and mixing ratio is in g/kg
geus_h.loc[:,'mr']=ty.specific_humidity2mixing_ratio(geus_h.spechum/1000)*1000


#%% PIC 2140

# PIC, it seems HC is actially calculating the specific humidity with his calculation (instead of mixing ratio as he thinks), HOWEVER, it does not make a difference
dfPIC2m10min=pd.read_csv('/Volumes/gfi_snowiso/Vapour/2018/processed_data_combined/EG18_level180cm.txt',index_col=0,parse_dates=True,na_values=['NAN'])
dfPIC2m10min=dfPIC2m10min.loc[pd.to_datetime('2018-06-11 12:00'):pd.to_datetime('2018-07-01 21:00'),:] #only use specific period where the new 2140 was measuring at 2m only
dfPIC2m10min.loc[:,'shum']=dfPIC2m10min.H2O*1e-6*B #you could also use deltatogas function, dfPIC2m.mr is g/kg air --> specific humidity