def _get_geo(header): telescope = _get_telescope(header) result = None if telescope == '1.2-m': result = ac.get_location(48.52092, -123.42006, 225.0) elif telescope == '1.8-m': result = ac.get_location(48.51967, -123.41833, 232.0) elif telescope is None: observatory = header.get('OBSERVAT') if observatory == 'DAO': # DB 10-09-20 # Google Maps to give you latitude/longitude if desired. 48.519497 # and -123.416502. Not sure of the elevation. result = ac.get_location(48.519497, -123.416502, 210.0) if result is None: raise mc.CadcException( f'Unexpected telescope value of {telescope} for ' f'{header.get("DAOPRGID")}') return result
def _update_telescope_location(self, observation): """Provide geocentric telescope location information, based on geodetic information from the headers.""" self._logger.debug('Begin _update_telescope_location') if not isinstance(observation, Observation): raise mc.CadcException('Input type is Observation.') telescope = self._headers[0].get('TELESCOP') if telescope is None: self._logger.warning( f'No telescope name. Could not set telescope ' f'location for {observation.observation_id}' ) return telescope = telescope.upper() if COLLECTION in telescope or 'CTIO' in telescope: lat = self._headers[0].get('OBS_LAT') long = self._headers[0].get('OBS_LON') # make a reliable lookup value if COLLECTION in telescope: telescope = COLLECTION if 'CTIO' in telescope: telescope = 'CTIO' if lat is None or long is None: observation.telescope.geo_location_x = DEFAULT_GEOCENTRIC[ telescope ]['x'] observation.telescope.geo_location_y = DEFAULT_GEOCENTRIC[ telescope ]['y'] observation.telescope.geo_location_z = DEFAULT_GEOCENTRIC[ telescope ]['z'] else: ( observation.telescope.geo_location_x, observation.telescope.geo_location_y, observation.telescope.geo_location_z, ) = ac.get_location( lat, long, DEFAULT_GEOCENTRIC[telescope]['elevation'] ) else: raise mc.CadcException(f'Unexpected telescope name {telescope}') self._logger.debug('Done _update_telescope_location')
def accumulate_bp(bp, uri): """Configure the DRAO-ST-specific ObsBlueprint at the CAOM model Observation level.""" logging.debug('Begin accumulate_bp.') bp.set('Observation.proposal.id', 'GMIMS') bp.set('Observation.proposal.pi', 'Maik Wolleben') bp.set('Observation.proposal.project', 'Global Magneto-Ionic Medium Survey') bp.set('Observation.proposal.title', '300 to 900 MHz Rotation Measure Survey') bp.set('Observation.proposal.keywords', 'Galactic') bp.set('Observation.telescope.name', 'John A. Galt') x, y, z = ac.get_location(48.320000, -119.620000, 545.0) bp.set('Observation.telescope.geoLocationX', x) bp.set('Observation.telescope.geoLocationY', y) bp.set('Observation.telescope.geoLocationZ', z) bp.set('Observation.instrument.name', 'GMIMS High Frequency Receiver') bp.set('Observation.target.name', 'Northern Sky from +87 to -30') bp.set('Plane.dataProductType', 'cube') bp.set('Plane.calibrationLevel', '4') # Alex Hill 2018-11-20 - data will be public after the paper is # published bp.set('Plane.metaRelease', '2030-01-01') bp.set('Plane.dataRelease', '2030-01-01') bp.configure_position_axes((1, 2)) bp.clear('Chunk.position.axis.function.cd11') bp.clear('Chunk.position.axis.function.cd22') bp.add_fits_attribute('Chunk.position.axis.function.cd11', 'CDELT1') bp.set('Chunk.position.axis.function.cd12', 0.0) bp.set('Chunk.position.axis.function.cd21', 0.0) bp.add_fits_attribute('Chunk.position.axis.function.cd22', 'CDELT2') # see what I can do with a Faraday depth axis .... lol bp.configure_observable_axis(3) logging.debug('Done accumulate_bp.')
def get_geo(self): return ac.get_location(48.51967, -123.41833, 232.0)
def get_geo(self): return ac.get_location(48.52092, -123.42006, 225.0)
def get_geo(self): # DB 10-09-20 # Google Maps to give you latitude/longitude if desired. 48.519497 # and -123.416502. Not sure of the elevation. return ac.get_location(48.519497, -123.416502, 210.0)
def _get_telescope(): # DB 19-08-20 # NIFS only ever on Gemini North x, y, z = ac.get_location(19.823806, -155.46906, 4213.0) return x, y, z
def test_get_location(): x, y, z = ac.get_location(21.0, -32.0, 12) assert x == 5051887.288718968, x assert y == -3156769.5360207916, y assert z == 2271399.319625149, z