• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python basemap.BaseMap类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sunpy.map.basemap.BaseMap的典型用法代码示例。如果您正苦于以下问题:Python BaseMap类的具体用法?Python BaseMap怎么用?Python BaseMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: __init__

 def __init__(self, data, header):
     BaseMap.__init__(self, header)
     
     self.detector = "AIA"
     self.instrument = "AIA"
     self.observatory = "SDO"
     self.cmap = cm.get_cmap('sdoaia%d' % header.get('wavelnth'))
开发者ID:arabwhipmonk,项目名称:sunpy,代码行数:7,代码来源:sdo.py


示例2: __init__

    def __init__(self, data, header):
        BaseMap.__init__(self, header)
        
        # MDI sometimes has an "60" in seconds field
        datestr = header['date_obs']

        if datestr[17:19] == "60":
            datestr = datestr[:17] + "30" + datestr[19:]
            
        rsun = header.get('radius')
        
        # Solar radius in arc-seconds at 1 au
        # @TODO: use sunpy.sun instead
        radius_1au = 959.644
        
        # MDI images may have radius = 0.0
        if not rsun:
            dsun = constants.au
        else:
            scale = header.get("cdelt1")
            dsun = (radius_1au / (rsun * scale)) * constants.au
            
        # Determine measurement
        dpcobsr = header.get('dpc_obsr')
        meas = "magnetogram" if dpcobsr.find('Mag') != -1 else "continuum"
        
        self.date = parse_time(datestr)
        self.detector = "MDI"
        self.measurement = meas
        self.dsun = dsun
        self.name = "MDI %s" % meas
开发者ID:arabwhipmonk,项目名称:sunpy,代码行数:31,代码来源:soho.py


示例3: __init__

 def __init__(self, data, header):
     BaseMap.__init__(self, header)
     self.detector = "SWAP"
     self.instrument = "SWAP"
     self.observatory = "PROBA2"
     self.name = "SWAP %s" % header.get('wavelnth')
     self.cmap = cm.get_cmap(name='sdoaia171')
开发者ID:arabwhipmonk,项目名称:sunpy,代码行数:7,代码来源:proba2.py


示例4: __init__

 def __init__(self, data, header):
     BaseMap.__init__(self, header)
     self.date = parse_time(header.get('date_obs'))
     self.detector = header.get('detector')
     self.instrument = "SECCHI"
     self.observatory = header.get('obsrvtry')
     self.measurement = "white-light"
     self.name = "SECCHI %s" % header.get('detector')
开发者ID:arabwhipmonk,项目名称:sunpy,代码行数:8,代码来源:stereo.py


示例5: __init__

 def __init__(self, data, header):
     BaseMap.__init__(self, header)
     
     self.date = parse_time(header.get('date_obs'))
     self.detector = header.get('telescop')
     self.instrument = header.get('telescop')
     self.measurement = [header.get('energy_l'), header.get('energy_h')]
     self.name = "RHESSI %d - %d keV" % (header.get('energy_l'), 
                                         header.get('energy_h'))
     self.cmap = cm.get_cmap('rhessi')
     self.exposure_time = (parse_time(header.get('date_end')) - 
                           parse_time(header.get('date_obs'))).seconds
开发者ID:arabwhipmonk,项目名称:sunpy,代码行数:12,代码来源:rhessi.py


示例6: add_map

 def add_map(self, input_, zorder=None, alpha=1):
     """Adds a map to the CompositeMap
     
     Parameters
     ----------
     input_ : {sunpy.map, string}
         Map instance or filepath to map to be added
     zorder : int
         The index to use when determining where the map should lie along
         the z-axis; maps with higher z-orders appear above maps with lower
         z-orders.
     alpha : float
         Opacity at which the map should be displayed. An alpha value of 0
         results in a fully transparent image while an alpha value of 1
         results in a fully opaque image. Values between result in semi-
         transparent images.
     """
     if zorder is None:
         zorder = max([m.zorder for m in self._maps]) + 10
     
     m = BaseMap.read(input_)
     m.zorder = zorder
     m.alpha = alpha
     
     self._maps.append(m)
开发者ID:arabwhipmonk,项目名称:sunpy,代码行数:25,代码来源:compositemap.py


示例7: Map

def Map(filepath):
    """Creates a map from specified file.
    
    .. deprecated:: 0.1
        Use `make_map` instead.
    
    Parameters
    ----------
    filepath : string
        Filepath to a FITs or JPEG 2000 file
    
    Returns
    -------
    out : Map
        Creates a map instance using the specific file and return it
    """
    import warnings
    warnings.warn("sunpy.Map is deprecated: use sunpy.make_map instead.", DeprecationWarning)
    
    if isinstance(filepath, basestring):
        return BaseMap.read(filepath)
    else:
        raise InvalidMapInput("Invalid input for make_map. Please specify "
                              "one or more filepaths, Maps, directories, "
                              "or wildcard expressions.")
开发者ID:DavidBerghmans,项目名称:sunpy,代码行数:25,代码来源:__init__.py


示例8: __new__

    def __new__(cls, *args, **kwargs):
        """Creates a new Map instance"""
        
        maps = []
        data = []
        headers = []
    
        # convert input to maps
        for item in args:
            if isinstance(item, BaseMap):
                maps.append(item)
            else:
                maps.append(BaseMap.read(item))

        # sort data
        sortby = kwargs.get("sortby", "date")
        if hasattr(cls, '_sort_by_%s' % sortby):
            maps.sort(key=getattr(cls, '_sort_by_%s' % sortby)())

        # create data cube
        for map_ in maps:
            data.append(np.array(map_))
            headers.append(map_.header)

        obj = np.asarray(data).view(cls)
        obj._headers = headers

        return obj
开发者ID:DavidBerghmans,项目名称:sunpy,代码行数:28,代码来源:mapcube.py


示例9: __new__

    def __new__(cls, input_, sortby="date"):
        """Creates a new Map instance"""
        
        # Directory of files
        if isinstance(input_, basestring):
            filepaths = []
            fits_arr = []
            data = []
            headers = []

            # directory
            if os.path.isdir(input_):
                for filename in os.listdir(input_):
                    filepaths.append(os.path.join(input_, filename))

            # glob string
            else:
                from glob import glob
                filepaths = glob(input_)
                
            # read in files
            for filepath in filepaths:
                fits = pyfits.open(filepath)
                
                # append normalized header tags for use during sorting
                found_header_match = False
                
                for subcls in BaseMap.__subclasses__(): #pylint: disable=E1101
                    if subcls.is_datasource_for(fits[0].header):
                        found_header_match = True
                        fits.norm_header = subcls.get_properties(fits[0].header)
                if not found_header_match:
                    raise UnrecognizedDataSouceError

                fits_arr.append(fits)

            # sort data
            if sortby and hasattr(cls, '_sort_by_%s' % sortby):
                fits_arr.sort(key=getattr(cls, '_sort_by_%s' % sortby)())

            # create data cube
            for fits in fits_arr:
                data.append(fits[0].data)
                headers.append(fits[0].header)

            obj = np.asarray(data).view(cls)
            obj._headers = headers

        # List of data or filepaths
        elif isinstance(input_, list):
            obj = np.asarray(input_).view(cls)

        # ndarray
        elif isinstance(input_, np.ndarray):
            obj = input_

        return obj
开发者ID:calexyoung,项目名称:sunpy,代码行数:57,代码来源:mapcube.py


示例10: __getitem__

 def __getitem__(self, key):
     """Overiding indexing operation"""
     if self.ndim is 3 and isinstance(key, int):
         data = np.ndarray.__getitem__(self, key)
         header = self._headers[key]
         for cls in BaseMap.__subclasses__():
             if cls.is_datasource_for(header):
                 return cls(data, header)
         raise UnrecognizedDataSouceError
     else:
         return np.ndarray.__getitem__(self, key)
开发者ID:calexyoung,项目名称:sunpy,代码行数:11,代码来源:mapcube.py


示例11: Map

def Map(input_):
    """Map class factory
    
    Attempts to determine the type of data associated with input and returns
    an instance of either the generic BaseMap class or a subclass of BaseMap
    such as AIAMap, EUVIMap, etc.
    
    Parameters
    ----------
    input_ : filepath, data array
        The data source used to create the map object. This can be either a
        filepath to an image, a 2d list, or an ndarray.
        
    Returns
    -------
    out : BaseMap
        Returns a BaseMap or BaseMap subclass instance
        
    Notes
    -----
    PyFITS
        [1] Due to the way PyFITS works with images the header dictionary may
        differ depending on whether is accessed before or after the fits[0].data
        is requested. If the header is read before the data then the original
        header will be returned. If the header is read after the data has been
        accessed then the data will have been scaled and a modified header
        reflecting these changes will be returned: BITPIX may differ and
        BSCALE and B_ZERO may be dropped in the modified version.
        
        [2] The verify('fix') call attempts to handle violations of the FITS
        standard. For example, nan values will be converted to "nan" strings.
        Attempting to cast a pyfits header to a dictionary while it contains
        invalid header tags will result in an error so verifying it early on
        makes the header easier to work with later.
    References
    ----------
    | http://stackoverflow.com/questions/456672/class-factory-in-python
    | http://stsdas.stsci.edu/download/wikidocs/The_PyFITS_Handbook.pdf
    """
    if isinstance(input_, basestring):
        fits = pyfits.open(input_)
        fits.verify('silentfix')        
        data = fits[0].data
        header = fits[0].header

        for cls in BaseMap.__subclasses__():
            if cls.is_datasource_for(header):
                return cls(data, header)
        raise UnrecognizedDataSouceError

    else:
        return BaseMap(input_)
开发者ID:calexyoung,项目名称:sunpy,代码行数:52,代码来源:__init__.py


示例12: get_properties

 def get_properties(cls, header):
     """Parses EUVI image header"""
     properties = BaseMap.get_properties(header)
     
     properties.update({
         "date": parse_time(header.get('date_obs')),
         "detector": "EUVI",
         "instrument": "SECCHI",
         "observatory": header.get('obsrvtry'),
         "cmap": cm.get_cmap('sohoeit%d' % header.get('wavelnth')),
         "nickname": "EUVI-" + header.get('obsrvtry')[-1]
     })
     return properties
开发者ID:jpjustiniano,项目名称:sunpy,代码行数:13,代码来源:stereo.py


示例13: get_properties

 def get_properties(cls, header):
     """Parses SWAP image header"""
     properties = BaseMap.get_properties(header)
     
     properties.update({
         "detector": "SWAP",
         "instrument": "SWAP",
         "observatory": "PROBA2",
         "name": "SWAP %s" % header.get('wavelnth'),
         "nickname": "SWAP",
         "cmap": cm.get_cmap(name='sdoaia171')
     })
     return properties
开发者ID:jpjustiniano,项目名称:sunpy,代码行数:13,代码来源:proba2.py


示例14: get_properties

 def get_properties(cls, header):
     """Returns the default and normalized values to use for the Map"""
     # Note: Trailing "Z" in date was dropped on 2010/12/07        
     properties = BaseMap.get_properties()
     properties.update({
         'date': util.anytim(header['date-obs'][0:22]),
         'det': "AIA",
         'inst': "AIA",
         'meas': header['wavelnth'],
         'obs': "SDO",
         'name': "AIA %s" % header['wavelnth'],
         'cmap': cm.get_cmap(name = 'sdoaia' + str(header['wavelnth']))
     })
     return properties
开发者ID:calexyoung,项目名称:sunpy,代码行数:14,代码来源:sdo.py


示例15: get_properties

 def get_properties(cls, header):
     """Returns the default and normalized values to use for the Map"""
     properties = BaseMap.get_properties()
     properties.update({
         'date': util.anytim(header.get('date_obs')),
         'det': header.get('telescop'),
         'inst': header.get('telescop'),
         'meas': [header.get('energy_l'), header.get('energy_h')],
         'obs': header.get('telescop'),
         'name': "RHESSI " + str(header.get('energy_l')) + '-' + str(header.get('energy_h')) + ' keV',
         'cmap': cm.get_cmap(name = 'rhessi'),
         # 'norm': mpl.colors.Normalize(vmin=cls.min(), vmax=cls.max())
     })
     return properties
开发者ID:calexyoung,项目名称:sunpy,代码行数:14,代码来源:rhessi.py


示例16: get_properties

 def get_properties(cls, header):
     """Returns the default and normalized values to use for the Map"""
     date_format = "%Y-%m-%dT%H:%M:%S.%fZ"
     
     properties = BaseMap.get_properties()
     properties.update({
         "date": datetime.strptime(header['date_obs'], date_format),
         "det": "EIT",
         "inst": "EIT",
         "meas": header['wavelnth'],
         "obs": "SOHO",
         "name": "EIT %s" % header['wavelnth'],
         "r_sun": header['solar_r']
     })
     return properties
开发者ID:calexyoung,项目名称:sunpy,代码行数:15,代码来源:soho.py


示例17: get_properties

    def get_properties(cls, header):
        """Returns the default and normalized values to use for the Map"""
        datestr = "%sT%s" % (header['date_obs'], header['time_obs'])

        properties = BaseMap.get_properties()
        properties.update({
            "date": util.anytim(datestr),
            "det": header.get('detector'),
            "inst": "LASCO",
            "meas": header.get('wavelnth'),
            "obs": "SOHO",
            "name": "LASCO %s" % header.get('detector'),
            "exptime": header.get("exptime"),
        })
        return properties
开发者ID:DavidBerghmans,项目名称:sunpy,代码行数:15,代码来源:soho.py


示例18: get_properties

    def get_properties(cls, header):
        """Returns the default and normalized values to use for the Map"""
        properties = BaseMap.get_properties()
        date_format = "%Y-%m-%dT%H:%M:%S.%f"

        properties.update({
            "date": datetime.strptime(header['date_obs'], date_format),
            "det": header['detector'],
            "inst": "SECCHI",
            "meas": header['wavelnth'],
            "obs": header['obsrvtry'],
            "name": "SECCHI %s" % header['detector'],
            "r_sun": header['rsun']
        })
        return properties
开发者ID:DavidBerghmans,项目名称:sunpy,代码行数:15,代码来源:stereo.py


示例19: get_properties

 def get_properties(cls, header):
     """Returns the default and normalized values to use for the Map"""
     # Note: Trailing "Z" in date was dropped on 2010/12/07    
     meas = header['content'].split(" ")[0].lower()
     
     properties = BaseMap.get_properties()
     properties.update({
         "date": util.anytim(header.get('date-obs')),
         "det": "HMI",
         "inst": "HMI",
         "meas": meas,
         "obs": "SDO",
         "name": "HMI %s" % meas,
         "exptime": header.get('exptime')
     })
     return properties
开发者ID:DavidBerghmans,项目名称:sunpy,代码行数:16,代码来源:sdo.py


示例20: get_properties

 def get_properties(cls, header):
     """Returns the default and normalized values to use for the Map"""
     properties = BaseMap.get_properties()
     properties.update({
         'date': util.anytim(header.get('date_obs')),
         'det': header.get('telescop'),
         'inst': header.get('telescop'),
         'meas': [header.get('energy_l'), header.get('energy_h')],
         'obs': header.get('telescop'),
         'name': "RHESSI " + str(header.get('energy_l')) + '-' + 
                 str(header.get('energy_h')) + ' keV',
         'cmap': cm.get_cmap(name = 'rhessi'),
         'exptime': (util.anytim(header.get('date_end')) - 
                     util.anytim(header.get('date_obs'))).seconds
     })
     return properties
开发者ID:DavidBerghmans,项目名称:sunpy,代码行数:16,代码来源:rhessi.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python net.Fido类代码示例发布时间:2022-05-27
下一篇:
Python map.Map类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap