trivial modification
This commit is contained in:
parent
73a9635c11
commit
1b956f4d84
@ -1,6 +1,5 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
from . import Const
|
from . import Const
|
||||||
|
|
||||||
def vectorize(x):
|
def vectorize(x):
|
||||||
@ -13,7 +12,7 @@ def vectorize(x):
|
|||||||
except:
|
except:
|
||||||
x = np.array([x])
|
x = np.array([x])
|
||||||
return x
|
return x
|
||||||
|
|
||||||
def wraplon(lon):
|
def wraplon(lon):
|
||||||
'''
|
'''
|
||||||
Wrap a longitude in range of [0,360] to [-180,180].
|
Wrap a longitude in range of [0,360] to [-180,180].
|
||||||
@ -64,6 +63,16 @@ def hms_conver(h,m,s):
|
|||||||
seconds = h*3.6e3 + m*60 + s
|
seconds = h*3.6e3 + m*60 + s
|
||||||
return hours,seconds
|
return hours,seconds
|
||||||
|
|
||||||
|
def ydhms_days(ydhms):
|
||||||
|
'''
|
||||||
|
Convert the form of hour/minute/second to hours and seconds.
|
||||||
|
|
||||||
|
Uasge:
|
||||||
|
hours,seconds = hms_conversion(h,m,s)
|
||||||
|
'''
|
||||||
|
days = ydhms[1] + ydhms[2]/24 + ydhms[3]/1440 + ydhms[4]/86400 - 1
|
||||||
|
return days
|
||||||
|
|
||||||
def alt_conver(alts,alt_type='geometric'):
|
def alt_conver(alts,alt_type='geometric'):
|
||||||
'''
|
'''
|
||||||
Fulfill conversions between geometric altitudes and geopotential altitudes.
|
Fulfill conversions between geometric altitudes and geopotential altitudes.
|
||||||
@ -86,17 +95,17 @@ def alt_conver(alts,alt_type='geometric'):
|
|||||||
|
|
||||||
alts = vectorize(alts)
|
alts = vectorize(alts)
|
||||||
|
|
||||||
r0 = Const.r0
|
R0 = Const.R0
|
||||||
|
|
||||||
if alt_type == 'geometric':
|
if alt_type == 'geometric':
|
||||||
zs = alts
|
zs = alts
|
||||||
# from geometric altitude to geopotential altitude
|
# from geometric altitude to geopotential altitude
|
||||||
hs = zs*r0/(r0+zs)
|
hs = zs*R0/(R0+zs)
|
||||||
|
|
||||||
elif alt_type == 'geopotential':
|
elif alt_type == 'geopotential':
|
||||||
hs = alts
|
hs = alts
|
||||||
# from geopotential altitude to geometric altitude
|
# from geopotential altitude to geometric altitude
|
||||||
zs = hs*r0/(r0-hs)
|
zs = hs*R0/(R0-hs)
|
||||||
return zs,hs
|
return zs,hs
|
||||||
|
|
||||||
def check_altitude(zs,z_range,mode):
|
def check_altitude(zs,z_range,mode):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user