示例#1
0
	def inCheckCoordsToQth(self, _lat, _lng):
		_ret = libqth.coords_to_qth(_lat, _lng, 5)
		if _lng < -180.0 or _lng > 180.0 or _lat < -90.0 or _lat > 90.0:
			if _ret:
				self.failed += 1
				return
			self.done+=1
			return

		self.done += 1
示例#2
0
	def checkCoordsToQth(self, _lat, _lng, _expectPrecision, _expectQth, _expectQthSize):
		_ret = libqth.coords_to_qth(_lat, _lng, _expectPrecision)
		if len(_ret['qth']) != _expectQthSize:
			self.failed += 1
			return

		if _ret['qth'] != _expectQth:
			self.failed += 1
			return

		self.done += 1
示例#3
0
def ham_country_grid_coords(call):
    if "sqlite" in db.engine.driver:
        q = (
            DxccPrefixes.query.filter(DxccPrefixes.call == func.substr(call, 1, func.LENGTH(DxccPrefixes.call)))
            .order_by(func.length(DxccPrefixes.call).asc())
            .limit(1)
        )
    else:
        q = (
            DxccPrefixes.query.filter(DxccPrefixes.call == func.substring(call, 1, func.LENGTH(DxccPrefixes.call)))
            .order_by(func.length(DxccPrefixes.call).asc())
            .limit(1)
        )
    if q.count() <= 0:
        return None
    else:
        qth = coords_to_qth(q[0].lat, q[0].long, 6)
        return {"qth": qth["qth"], "latitude": q[0].lat, "longitude": q[0].long}
示例#4
0
 def country_grid(self):
     q = ham_country_grid_coords(self.call)
     if q:
         return coords_to_qth(q["latitude"], q["longitude"], 6)["qth"]
     else:
         return None