当前位置: 首页>>代码示例>>Python>>正文


Python TimeAgent.rad2hr方法代码示例

本文整理汇总了Python中nell.utilities.TimeAgent.rad2hr方法的典型用法代码示例。如果您正苦于以下问题:Python TimeAgent.rad2hr方法的具体用法?Python TimeAgent.rad2hr怎么用?Python TimeAgent.rad2hr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nell.utilities.TimeAgent的用法示例。


在下文中一共展示了TimeAgent.rad2hr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_horizontal

# 需要导入模块: from nell.utilities import TimeAgent [as 别名]
# 或者: from nell.utilities.TimeAgent import rad2hr [as 别名]
    def get_horizontal(self):
        "Returns the horizontal component in sexigesimal form."
        if self.horizontal is None:
            return ""

        if self.system.name == 'Galactic':
            return self.get_deg(self.horizontal)

        horz = TimeAgent.rad2hr(self.horizontal)
        mins = (horz - int(horz)) * 60
        secs = (mins - int(mins)) * 60
        if abs(secs - 60.) < 0.1:
            mins = int(mins) + 1
            if abs(mins - 60.) < 0.1:
                mins = 0.0
                horz = int(horz) + 1
            secs = 0.0
        return "%02i:%02i:%04.1f" % (int(horz), int(mins), secs)
开发者ID:mmccarty,项目名称:nell,代码行数:20,代码来源:Target.py

示例2: jsondict

# 需要导入模块: from nell.utilities import TimeAgent [as 别名]
# 或者: from nell.utilities.TimeAgent import rad2hr [as 别名]
    def jsondict(self):
        irradiance = self.sesshun.irradiance()
        solarAvoid = self.sesshun.get_solar_avoidance()
        solarAvoid = None if solarAvoid is None else TimeAgent.rad2deg(solarAvoid) # DB in radians

        d = {"id"         : self.sesshun.id
           , "pcode"      : self.sesshun.project.pcode
           , "handle"     : self.sesshun.toHandle()
           , "type"       : self.sesshun.session_type.type
           , "science"    : self.sesshun.observing_type.type
           , "total_time" : self.sesshun.allotment.total_time
           , "PSC_time"   : self.sesshun.allotment.psc_time
           , "sem_time"   : self.sesshun.allotment.max_semester_time
           , "remaining"  : 0 if self.sesshun.observing_type.type == "maintenance" \
                              else TimeAccounting().getTimeRemaining(self.sesshun)
           , "grade"      : self.sesshun.allotment.grade
           , "orig_ID"    : self.sesshun.original_id
           , "name"       : self.sesshun.name
           , "freq"       : self.sesshun.frequency
           , "req_max"    : self.sesshun.max_duration
           , "req_min"    : self.sesshun.min_duration
           , "between"    : self.sesshun.time_between
           , "enabled"    : self.sesshun.status.enabled
           , "authorized" : self.sesshun.status.authorized
           , "complete"   : self.sesshun.status.complete
           , "backup"     : self.sesshun.status.backup
           , "guaranteed" : self.sesshun.guaranteed()
           , "gas"        : self.sesshun.good_atmospheric_stability() or False
           , "transit"    : self.sesshun.transit() or False
           #, "nighttime"  : self.sesshun.nighttime() or False
           , "time_of_day": self.sesshun.get_time_of_day()
           , "lst_ex"     : self.sesshun.get_lst_string('LST Exclude') or ""
           , "lst_in"     : self.sesshun.get_lst_string('LST Include') or ""
           , "receiver"   : self.sesshun.get_receiver_req()
           , "project_complete" : "Yes" if self.sesshun.project.complete else "No"
           , "xi_factor"  : self.sesshun.get_min_eff_tsys_factor() or 1.0
           , "el_limit"   : self.sesshun.get_elevation_limit() or None # None is default 
           , "solar_avoid": solarAvoid 
           , "trk_err_threshold"   : self.sesshun.get_tracking_error_threshold()
           , "src_size"   : self.sesshun.get_source_size()
           , "keyhole"    : self.sesshun.keyhole()
           , "irradiance" : 300 if irradiance is None and 
                                   self.sesshun.observing_type.type == 'continuum' 
                                else irradiance
            }
        try:
            target = self.sesshun.target
        except Target.DoesNotExist:
            pass
        else:
            d.update({"source"     : target.source
                    , "coord_mode" : target.system.name
                    , "source_h"   : TimeAgent.rad2deg(target.horizontal) \
                                       if target.system.name == 'Galactic' \
                                       else TimeAgent.rad2hr(target.horizontal)
                    , "source_v"   : TimeAgent.rad2deg(target.vertical) 
                    })

        #  Remove all None values
        for k, v in d.items():
            if v is None:
                _ = d.pop(k)

        return d
开发者ID:mmccarty,项目名称:nell,代码行数:66,代码来源:SessionHttpAdapter.py


注:本文中的nell.utilities.TimeAgent.rad2hr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。