本文整理汇总了Python中attrdict.AttrDict.copy方法的典型用法代码示例。如果您正苦于以下问题:Python AttrDict.copy方法的具体用法?Python AttrDict.copy怎么用?Python AttrDict.copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类attrdict.AttrDict
的用法示例。
在下文中一共展示了AttrDict.copy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_copy_returns_our_type
# 需要导入模块: from attrdict import AttrDict [as 别名]
# 或者: from attrdict.AttrDict import copy [as 别名]
def test_copy_returns_our_type():
d = AttrDict(k=True)
assert d.copy().__class__ is AttrDict
示例2: Process
# 需要导入模块: from attrdict import AttrDict [as 别名]
# 或者: from attrdict.AttrDict import copy [as 别名]
#.........这里部分代码省略.........
* lev_bounds (lev_bounds) float64 0.0 50.0 100.0 150.0 200.0 250.0 ...
Data variables:
Ts (depth) float64 288.7
Tatm (lev) float64 201.3 204.0 208.0 212.0 216.1 220.2 ...
ASR (depth) float64 240.0
ASRcld (depth) float64 0.0
ASRclr (depth) float64 240.0
LW_flux_down (lev_bounds) float64 0.0 12.63 19.47 26.07 32.92 40.1 ...
LW_flux_down_clr (lev_bounds) float64 0.0 12.63 19.47 26.07 32.92 40.1 ...
LW_flux_net (lev_bounds) float64 240.1 231.2 227.6 224.1 220.5 ...
LW_flux_net_clr (lev_bounds) float64 240.1 231.2 227.6 224.1 220.5 ...
LW_flux_up (lev_bounds) float64 240.1 243.9 247.1 250.2 253.4 ...
LW_flux_up_clr (lev_bounds) float64 240.1 243.9 247.1 250.2 253.4 ...
LW_sfc (depth) float64 128.9
LW_sfc_clr (depth) float64 128.9
OLR (depth) float64 240.1
OLRcld (depth) float64 0.0
OLRclr (depth) float64 240.1
SW_flux_down (lev_bounds) float64 341.3 323.1 318.0 313.5 309.5 ...
SW_flux_down_clr (lev_bounds) float64 341.3 323.1 318.0 313.5 309.5 ...
SW_flux_net (lev_bounds) float64 240.0 223.3 220.2 217.9 215.9 ...
SW_flux_net_clr (lev_bounds) float64 240.0 223.3 220.2 217.9 215.9 ...
SW_flux_up (lev_bounds) float64 101.3 99.88 97.77 95.64 93.57 ...
SW_flux_up_clr (lev_bounds) float64 101.3 99.88 97.77 95.64 93.57 ...
SW_sfc (depth) float64 163.8
SW_sfc_clr (depth) float64 163.8
TdotLW (lev) float64 -1.502 -0.6148 -0.5813 -0.6173 -0.6426 ...
TdotLW_clr (lev) float64 -1.502 -0.6148 -0.5813 -0.6173 -0.6426 ...
TdotSW (lev) float64 2.821 0.5123 0.3936 0.3368 0.3174 0.3299 ...
TdotSW_clr (lev) float64 2.821 0.5123 0.3936 0.3368 0.3174 0.3299 ...
"""
if diagnostics:
dic = self.state.copy()
dic.update(self.diagnostics)
return state_to_xarray(dic)
else:
return state_to_xarray(self.state)
@property
def diagnostics(self):
"""Dictionary access to all diagnostic variables
:type: dict
"""
diag_dict = {}
for key in self._diag_vars:
try:
#diag_dict[key] = getattr(self,key)
# using self.__dict__ doesn't count diagnostics defined as properties
diag_dict[key] = self.__dict__[key]
except:
pass
return diag_dict
@property
def input(self):
"""Dictionary access to all input variables
That can be boundary conditions and other gridded quantities
independent of the `process`
:type: dict
"""
input_dict = {}
示例3: AttrDict
# 需要导入模块: from attrdict import AttrDict [as 别名]
# 或者: from attrdict.AttrDict import copy [as 别名]
#!/usr/bin/env python
# yaml_example.py
from attrdict import AttrDict
import yaml
# Demo starting values; lots of ways of creating an AttrDict
config = AttrDict()
config.session = 3
config.stimulus_order = [3, 2, 1]
config.subject = "S1"
# Save
with open("yaml_config_demo.yaml", "w") as outfile:
outfile.write(yaml.dump(config.copy())) # write a dict, not an AttrDict
# Load
with open("yaml_config_demo.yaml") as infile:
config = AttrDict(yaml.safe_load(infile))