prop.py 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. # This file, prop.py, has been generated from prop.f90 by protos.scm
  2. import ctypes
  3. from ctypes import c_int32, c_double, byref
  4. from ctypes.util import find_library
  5. liba = ctypes.cdll.LoadLibrary(find_library('prop'))
  6. ec = liba.prop_init()
  7. if ec!=0:
  8. raise RuntimeError('prop-618 could not be initialized (error: {})'.format(ec))
  9. def init():
  10. liba.prop_init.restype = c_int32
  11. result_ = liba.prop_init()
  12. return result_
  13. def p839_rain_height(lat, lon):
  14. p_lat = c_double(lat)
  15. p_lon = c_double(lon)
  16. liba.p839_rain_height.restype = c_double
  17. result_ = liba.p839_rain_height(byref(p_lat), byref(p_lon))
  18. return result_
  19. def p837_rainfall_rate(lat, lon):
  20. p_lat = c_double(lat)
  21. p_lon = c_double(lon)
  22. liba.p837_rainfall_rate.restype = c_double
  23. result_ = liba.p837_rainfall_rate(byref(p_lat), byref(p_lon))
  24. return result_
  25. def p1510_temp(lat, lon):
  26. p_lat = c_double(lat)
  27. p_lon = c_double(lon)
  28. liba.p1510_temp.restype = c_double
  29. result_ = liba.p1510_temp(byref(p_lat), byref(p_lon))
  30. return result_
  31. def p838_coeffs(freq):
  32. p_freq = c_double(freq)
  33. p_kh = c_double(0)
  34. p_ah = c_double(0)
  35. p_kv = c_double(0)
  36. p_av = c_double(0)
  37. liba.p838_coeffs(byref(p_freq), byref(p_kh), byref(p_ah), byref(p_kv), byref(p_av))
  38. return p_kh.value, \
  39. p_ah.value, \
  40. p_kv.value, \
  41. p_av.value
  42. def p618_rain(lat, lon, hs, freq, eldeg, taudeg, ppc, r001):
  43. p_lat = c_double(lat)
  44. p_lon = c_double(lon)
  45. p_hs = c_double(hs)
  46. p_freq = c_double(freq)
  47. p_eldeg = c_double(eldeg)
  48. p_taudeg = c_double(taudeg)
  49. p_ppc = c_double(ppc)
  50. p_r001 = c_double(r001)
  51. liba.p618_rain.restype = c_double
  52. result_ = liba.p618_rain(byref(p_lat), byref(p_lon), byref(p_hs), byref(p_freq), byref(p_eldeg), byref(p_taudeg), byref(p_ppc), byref(p_r001))
  53. return result_
  54. def p676_vapor_pressure(rho, temp):
  55. p_rho = c_double(rho)
  56. p_temp = c_double(temp)
  57. liba.p676_vapor_pressure.restype = c_double
  58. result_ = liba.p676_vapor_pressure(byref(p_rho), byref(p_temp))
  59. return result_
  60. def p676_gas_specific(scut, f, P, e, temp):
  61. p_scut = c_int32(scut)
  62. p_f = c_double(f)
  63. p_P = c_double(P)
  64. p_e = c_double(e)
  65. p_temp = c_double(temp)
  66. p_go = c_double(0)
  67. p_gw = c_double(0)
  68. liba.p676_gas_specific(byref(p_scut), byref(p_f), byref(p_P), byref(p_e), byref(p_temp), byref(p_go), byref(p_gw))
  69. return p_go.value, \
  70. p_gw.value
  71. def p676_eq_height(f, e, P):
  72. p_f = c_double(f)
  73. p_e = c_double(e)
  74. p_P = c_double(P)
  75. p_ho = c_double(0)
  76. p_hw = c_double(0)
  77. liba.p676_eq_height(byref(p_f), byref(p_e), byref(p_P), byref(p_ho), byref(p_hw))
  78. return p_ho.value, \
  79. p_hw.value
  80. def p676_gas(eldeg, freq, P, e, temp, Vt, hs):
  81. p_eldeg = c_double(eldeg)
  82. p_freq = c_double(freq)
  83. p_P = c_double(P)
  84. p_e = c_double(e)
  85. p_temp = c_double(temp)
  86. p_Vt = c_double(Vt)
  87. p_hs = c_double(hs)
  88. liba.p676_gas.restype = c_double
  89. result_ = liba.p676_gas(byref(p_eldeg), byref(p_freq), byref(p_P), byref(p_e), byref(p_temp), byref(p_Vt), byref(p_hs))
  90. return result_
  91. def p840_Lred(lat, lon, ppc):
  92. p_lat = c_double(lat)
  93. p_lon = c_double(lon)
  94. p_ppc = c_double(ppc)
  95. liba.p840_Lred.restype = c_double
  96. result_ = liba.p840_Lred(byref(p_lat), byref(p_lon), byref(p_ppc))
  97. return result_
  98. def p453_Nwet(lat, lon, ppc):
  99. p_lat = c_double(lat)
  100. p_lon = c_double(lon)
  101. p_ppc = c_double(ppc)
  102. liba.p453_Nwet.restype = c_double
  103. result_ = liba.p453_Nwet(byref(p_lat), byref(p_lon), byref(p_ppc))
  104. return result_
  105. def p840_clouds(freq, eldeg, Lred):
  106. p_freq = c_double(freq)
  107. p_eldeg = c_double(eldeg)
  108. p_Lred = c_double(Lred)
  109. liba.p840_clouds.restype = c_double
  110. result_ = liba.p840_clouds(byref(p_freq), byref(p_eldeg), byref(p_Lred))
  111. return result_
  112. def p618_scint(freq, eldeg, Deff, ppc, Nwet):
  113. p_freq = c_double(freq)
  114. p_eldeg = c_double(eldeg)
  115. p_Deff = c_double(Deff)
  116. p_ppc = c_double(ppc)
  117. p_Nwet = c_double(Nwet)
  118. liba.p618_scint.restype = c_double
  119. result_ = liba.p618_scint(byref(p_freq), byref(p_eldeg), byref(p_Deff), byref(p_ppc), byref(p_Nwet))
  120. return result_
  121. def p1511_topoh(lat, lon):
  122. p_lat = c_double(lat)
  123. p_lon = c_double(lon)
  124. liba.p1511_topoh.restype = c_double
  125. result_ = liba.p1511_topoh(byref(p_lat), byref(p_lon))
  126. return result_
  127. def p836_rho(lat, lon, ppc, h):
  128. p_lat = c_double(lat)
  129. p_lon = c_double(lon)
  130. p_ppc = c_double(ppc)
  131. p_h = c_double(h)
  132. liba.p836_rho.restype = c_double
  133. result_ = liba.p836_rho(byref(p_lat), byref(p_lon), byref(p_ppc), byref(p_h))
  134. return result_
  135. def p836_V(lat, lon, ppc, h):
  136. p_lat = c_double(lat)
  137. p_lon = c_double(lon)
  138. p_ppc = c_double(ppc)
  139. p_h = c_double(h)
  140. liba.p836_V.restype = c_double
  141. result_ = liba.p836_V(byref(p_lat), byref(p_lon), byref(p_ppc), byref(p_h))
  142. return result_
  143. # end of prop.py