async def _test_get_meteo(tmpdir): def callback(msg): assert not msg['error'], json.dumps(msg['message']) m = meteo.Meteo(os.path.join(tmpdir, "sprinkler.conf")) m.get_meteo(callback) await asyncio.sleep(3) m.get_meteo(callback) await asyncio.sleep(3)
def startup(name='LaSilla', cloudscheck=True, debugmode=False): """ Initialize meteo :return: Meteo object """ logger.debug("Loading a new meteo...") currentmeteo = meteo.Meteo(name=name, cloudscheck=cloudscheck, debugmode=debugmode) return currentmeteo
def createSubmodels(self, initialState): # initializing sub modules self.meteo = meteo.Meteo(self._configuration,self.landmask,initialState) self.landSurface = landSurface.LandSurface(self._configuration,self.landmask,initialState) self.groundwater = groundwater.Groundwater(self._configuration,self.landmask,initialState) self.routing = routing.Routing(self._configuration, initialState, self.lddMap) # short name for every land cover type (needed for file name) self.shortNames = ['f','g','p','n']
def test_meteo_conf_KO(confdir): m = meteo.Meteo(os.path.join(confdir, "sprinkler.conf")) assert not m.ismeteo
def test_meteo_update_conf(confdir): m1 = meteo.Meteo(os.path.join(confdir, "sprinkler.conf")) m1.set_city("123456") m2 = meteo.Meteo(os.path.join(confdir, "sprinkler.conf")) assert m1.citykey == "123456" assert m2.citykey == "123456"
def test_meteo_conf_ok(confdir): m = meteo.Meteo(os.path.join(confdir, "sprinkler.conf")) assert m.apikey == os.environ["APIKEY"] assert m.citykey == "134979" assert m.is_meteo
def createSubmodels(self, initialState): # initializing sub modules self.meteo = meteo.Meteo(self._configuration,self.landmask,initialState) self.routing = routing.Routing(self._configuration, initialState, self.lddMap)
from astropy.time import Time path = os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), '../pouet') sys.path.append(path) import clouds, main, meteo, obs, plots, run, util logging.basicConfig(format='PID %(process)06d | %(asctime)s | %(levelname)s: %(name)s(%(funcName)s): %(message)s', level=logging.DEBUG) logger = logging.getLogger(__name__) logger.critical("This should say Python >= 3.0: {}".format(sys.version)) logger.info("I am in : {}".format(os.getcwd())) # initialize meteo currentmeteo = meteo.Meteo(name='LaSilla', cloudscheck=True, debugmode=True) print(currentmeteo) currentmeteo.get_nighthours(obs_night="2020-10-20", twilight="nautical") # load a catalogue of observables observables = obs.rdbimport(os.path.join(path, "../cats/example.pouet"), obsprogramcol=4, obsprogram='lens') #observables = [o for o in observables if o.name == "PSJ1606-2333"] for o in observables: print(o) # show current status of all observables obs.showstatus(observables, currentmeteo, displayall=True) for o in observables: print(o) o.is_cloudfree(currentmeteo)