after_merge stringlengths 28 79.6k | before_merge stringlengths 20 79.6k | url stringlengths 38 71 | full_traceback stringlengths 43 922k | traceback_type stringclasses 555
values |
|---|---|---|---|---|
def end_time(self):
"""Return the end time of the object."""
try:
# MSG:
try:
return datetime.strptime(
self.nc.attrs["time_coverage_end"], "%Y-%m-%dT%H:%M:%SZ"
)
except TypeError:
return datetime.strptime(
self.nc.attrs... | def end_time(self):
try:
# MSG:
return datetime.strptime(
self.nc.attrs["time_coverage_end"], "%Y-%m-%dT%H:%M:%SZ"
)
except ValueError:
# PPS:
return datetime.strptime(self.nc.attrs["time_coverage_end"], "%Y%m%dT%H%M%S%fZ")
| https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def __init__(self, filename, filename_info, filetype_info, cal):
super(NCOLCI1B, self).__init__(filename, filename_info, filetype_info)
self.cal = cal.nc
| def __init__(self, filename, filename_info, filetype_info):
super(NCOLCI1B, self).__init__(filename, filename_info, filetype_info)
self.nc = h5netcdf.File(filename, "r")
self.channel = filename_info["dataset_name"]
cal_file = os.path.join(os.path.dirname(filename), "instrument_data.nc")
self.cal = h... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def get_dataset(self, key, info):
"""Load a dataset."""
if self.channel != key.name:
return
logger.debug("Reading %s.", key.name)
radiances = self.nc[self.channel + "_radiance"]
if key.calibration == "reflectance":
idx = int(key.name[2:]) - 1
sflux = self._get_solar_flux(id... | def get_dataset(self, key, info):
"""Load a dataset"""
if self.channel != key.name:
return
logger.debug("Reading %s.", key.name)
variable = self.nc[self.channel + "_radiance"]
radiances = (
np.ma.masked_equal(variable[:], variable.attrs["_FillValue"], copy=False)
* variable.... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def get_dataset(self, key, info):
"""Load a dataset."""
if key.name not in self.datasets:
return
if self.nc is None:
self.nc = xr.open_dataset(
self.filename,
decode_cf=True,
mask_and_scale=True,
engine="h5netcdf",
chunks={"tie_col... | def get_dataset(self, key, info):
"""Load a dataset."""
if key.name not in self.datasets:
return
if self.nc is None:
self.nc = h5netcdf.File(self.filename, "r")
logger.debug("Reading %s.", key.name)
l_step = self.nc.attrs["al_subsampling_factor"]
c_step = self.nc.attrs["ac_sub... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def _collect_attrs(self, name, obj):
"""Collect all the attributes for the provided file object."""
for key in obj.ncattrs():
value = getattr(obj, key)
fc_key = "{}/attr/{}".format(name, key)
try:
self.file_content[fc_key] = np2str(value)
except ValueError:
... | def _collect_attrs(self, name, obj):
"""Collect all the attributes for the provided file object."""
for key in obj.ncattrs():
value = getattr(obj, key)
value = np.squeeze(value)
if issubclass(value.dtype.type, str) or np.issubdtype(
value.dtype, np.character
):
... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def __getitem__(self, key):
val = self.file_content[key]
if isinstance(val, netCDF4.Variable):
# these datasets are closed and inaccessible when the file is
# closed, need to reopen
# TODO: Handle HDF4 versus NetCDF3 versus NetCDF4
parts = key.rsplit("/", 1)
if len(parts)... | def __getitem__(self, key):
val = self.file_content[key]
if isinstance(val, netCDF4.Variable):
# these datasets are closed and inaccessible when the file is
# closed, need to reopen
v = netCDF4.Dataset(self.filename, "r")
val = v[key]
val.set_auto_maskandscale(self.auto_m... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def get_shape(self, ds_id, ds_info):
"""Return data array shape for item specified."""
var_path = ds_info.get("file_key", "{}".format(ds_id.name))
if var_path + "/shape" not in self:
# loading a scalar value
shape = 1
else:
shape = self[var_path + "/shape"]
if "index" in ... | def get_shape(self, ds_id, ds_info):
"""Return data array shape for item specified."""
var_path = ds_info.get("file_key", "{}".format(ds_id.name))
shape = self[var_path + "/shape"]
if "index" in ds_info:
shape = shape[1:]
if "pressure_index" in ds_info:
shape = shape[:-1]
return ... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def get_dataset(self, dataset_id, ds_info):
"""Load data array and metadata for specified dataset"""
var_path = ds_info.get("file_key", "{}".format(dataset_id.name))
metadata = self.get_metadata(dataset_id, ds_info)
valid_min, valid_max = self[var_path + "/attr/valid_range"]
fill_value = self.get(va... | def get_dataset(self, dataset_id, ds_info, out=None):
"""Load data array and metadata for specified dataset"""
var_path = ds_info.get("file_key", "{}".format(dataset_id.name))
dtype = ds_info.get("dtype", np.float32)
if var_path + "/shape" not in self:
# loading a scalar value
shape = 1
... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def __init__(self, config_files, mask_surface=True, mask_quality=True, **kwargs):
"""Configure reader behavior.
Args:
mask_surface (boolean): mask anything below the surface pressure
mask_quality (boolean): mask anything where the `Quality_Flag` metadata is ``!= 1``.
"""
self.pressure_... | def __init__(self, config_files, mask_surface=True, mask_quality=True, **kwargs):
"""Configure reader behavior.
Args:
mask_surface (boolean): mask anything below the surface pressure
mask_quality (boolean): mask anything where the `quality_flag` metadata is ``!= 1``.
"""
self.pressure_... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def load(self, dataset_keys, pressure_levels=None):
"""Load data from one or more set of files.
:param pressure_levels: mask out certain pressure levels:
True for all levels
(min, max) for a range of pressure levels
[...] list ... | def load(self, dataset_keys, pressure_levels=None):
"""Load data from one or more set of files.
:param pressure_levels: mask out certain pressure levels:
True for all levels
(min, max) for a range of pressure levels
[...] list ... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def get_dataset(self, dataset_id, ds_info):
var_path = ds_info.get("file_key", "{}".format(dataset_id.name))
metadata = self.get_metadata(dataset_id, ds_info)
valid_min, valid_max = self.get(
var_path + "/attr/valid_range",
self.get(var_path + "/attr/ValidRange", (None, None)),
)
if ... | def get_dataset(self, dataset_id, ds_info, out=None):
var_path = ds_info.get("file_key", "{}".format(dataset_id.name))
dtype = ds_info.get("dtype", np.float32)
shape = self.get_shape(dataset_id, ds_info)
file_units = ds_info.get("file_units")
if file_units is None:
file_units = self.get(
... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def get_shape(self, ds_id, ds_info):
var_path = ds_info.get("file_key", "observation_data/{}".format(ds_id.name))
return self.get(var_path + "/shape", 1)
| def get_shape(self, ds_id, ds_info):
var_path = ds_info.get("file_key", "observation_data/{}".format(ds_id.name))
return self[var_path + "/shape"]
| https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def _load_and_slice(self, var_path, shape, xslice, yslice):
if isinstance(shape, tuple) and len(shape) == 2:
return self[var_path][yslice, xslice]
elif isinstance(shape, tuple) and len(shape) == 1:
return self[var_path][yslice]
else:
return self[var_path]
| def _load_and_slice(self, dtype, var_path, shape, xslice, yslice):
if isinstance(shape, tuple) and len(shape) == 2:
return np.require(self[var_path][yslice, xslice], dtype=dtype)
elif isinstance(shape, tuple) and len(shape) == 1:
return np.require(self[var_path][yslice], dtype=dtype)
else:
... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def get_dataset(self, dataset_id, ds_info, xslice=slice(None), yslice=slice(None)):
var_path = ds_info.get("file_key", "observation_data/{}".format(dataset_id.name))
metadata = self.get_metadata(dataset_id, ds_info)
shape = metadata["shape"]
if isinstance(shape, tuple) and len(shape) == 2:
# 2D ... | def get_dataset(
self, dataset_id, ds_info, out=None, xslice=slice(None), yslice=slice(None)
):
var_path = ds_info.get("file_key", "observation_data/{}".format(dataset_id.name))
dtype = ds_info.get("dtype", np.float32)
if var_path + "/shape" not in self:
# loading a scalar value
shape = ... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def scale_swath_data(self, data, scaling_factors):
"""Scale swath data using scaling factors and offsets.
Multi-granule (a.k.a. aggregated) files will have more than the usual two values.
"""
num_grans = len(scaling_factors) // 2
gran_size = data.shape[0] // num_grans
factors = scaling_factors.... | def scale_swath_data(self, data, mask, scaling_factors):
"""Scale swath data using scaling factors and offsets.
Multi-granule (a.k.a. aggregated) files will have more than the usual two values.
"""
num_grans = len(scaling_factors) // 2
gran_size = data.shape[0] // num_grans
for i in range(num_g... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def adjust_scaling_factors(self, factors, file_units, output_units):
if file_units == output_units:
LOG.debug("File units and output units are the same (%s)", file_units)
return factors
if factors is None:
factors = xr.DataArray([1, 0])
factors = factors.where(factors != -999.0)
... | def adjust_scaling_factors(self, factors, file_units, output_units):
if file_units == output_units:
LOG.debug("File units and output units are the same (%s)", file_units)
return factors
if factors is None:
factors = [1, 0]
factors = np.array(factors)
if file_units == "W cm-2 sr-... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def get_dataset(self, dataset_id, ds_info):
var_path = self._generate_file_key(dataset_id, ds_info)
factor_var_path = ds_info.get("factors_key", var_path + "Factors")
data = self[var_path]
is_floating = np.issubdtype(data.dtype, np.floating)
if is_floating:
# If the data is a float then we ... | def get_dataset(self, dataset_id, ds_info, out=None):
var_path = self._generate_file_key(dataset_id, ds_info)
factor_var_path = ds_info.get("factors_key", var_path + "Factors")
data = self[var_path]
dtype = ds_info.get("dtype", np.float32)
is_floating = np.issubdtype(data.dtype, np.floating)
if ... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def __init__(
self, config_files, filter_parameters=None, filter_filenames=True, **kwargs
):
super(FileYAMLReader, self).__init__(config_files)
self.file_handlers = {}
self.filter_filenames = self.info.get("filter_filenames", filter_filenames)
self.filter_parameters = filter_parameters or {}
if... | def __init__(
self, config_files, filter_parameters=None, filter_filenames=True, **kwargs
):
super(FileYAMLReader, self).__init__(config_files)
self.file_handlers = {}
self.filter_filenames = self.info.get("filter_filenames", filter_filenames)
self.filter_parameters = filter_parameters or {}
if... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def _load_dataset_data(
self, file_handlers, dsid, xslice=slice(None), yslice=slice(None)
):
ds_info = self.ids[dsid]
proj = self._load_dataset(dsid, ds_info, file_handlers)
# FIXME: areas could be concatenated here
# Update the metadata
proj.attrs["start_time"] = file_handlers[0].start_time
... | def _load_dataset_data(
self, file_handlers, dsid, xslice=slice(None), yslice=slice(None)
):
ds_info = self.ids[dsid]
try:
# Can we allow the file handlers to do inplace data writes?
[list(fhd.get_shape(dsid, ds_info)) for fhd in file_handlers]
except NotImplementedError:
# FIXME... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def _make_area_from_coords(self, coords):
"""Create an appropriate area with the given *coords*."""
if len(coords) == 2:
lon_sn = coords[0].attrs.get("standard_name")
lat_sn = coords[1].attrs.get("standard_name")
if lon_sn == "longitude" and lat_sn == "latitude":
key = None
... | def _make_area_from_coords(self, coords):
"""Create an apropriate area with the given *coords*."""
if len(coords) == 2:
lon_sn = coords[0].info.get("standard_name")
lat_sn = coords[1].info.get("standard_name")
if lon_sn == "longitude" and lat_sn == "latitude":
sdef = SwathDef... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def _load_dataset_with_area(self, dsid, coords):
"""Loads *dsid* and it's area if available."""
file_handlers = self._get_file_handlers(dsid)
if not file_handlers:
return
area = self._load_dataset_area(dsid, file_handlers, coords)
slice_kwargs, area = self._get_slices(area)
try:
... | def _load_dataset_with_area(self, dsid, coords):
"""Loads *dsid* and it's area if available."""
file_handlers = self._get_file_handlers(dsid)
if not file_handlers:
return
area = self._load_dataset_area(dsid, file_handlers, coords)
slice_kwargs, area = self._get_slices(area)
try:
... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def load(self, dataset_keys, previous_datasets=None):
"""Load `dataset_keys`.
If `previous_datasets` is provided, do not reload those."""
all_datasets = previous_datasets or DatasetDict()
datasets = DatasetDict()
# Include coordinates in the list of datasets to load
dsids = [self.get_dataset_k... | def load(self, dataset_keys):
"""Load *dataset_keys*."""
all_datasets = DatasetDict()
datasets = DatasetDict()
# Include coordinates in the list of datasets to load
dsids = [self.get_dataset_key(ds_key) for ds_key in dataset_keys]
coordinates = self._get_coordinates_for_dataset_keys(dsids)
... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def get_area_file():
"""Find area file(s) to use.
The files are to be named `areas.yaml` or `areas.def`.
"""
paths = config_search_paths("areas.yaml")
if paths:
return paths
else:
return get_config_path("areas.def")
| def get_area_file():
conf, successes = get_config("satpy.cfg")
if conf is None or not successes:
LOG.warning(
"Couldn't find the satpy.cfg file. Do you have one ? is it in $PPP_CONFIG_DIR ?"
)
return None
try:
fn = os.path.join(
conf.get("projector", ... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def hash_area(area):
"""Get (and set) the hash for the *area*."""
return str(area.__hash__())
| def hash_area(area):
"""Get (and set) the hash for the *area*."""
try:
return area.kdtree_hash
except AttributeError:
LOG.debug("Computing kd-tree hash for area %s", getattr(area, "name", "swath"))
try:
area_hash = "".join(
(
hashlib.sha1(
... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def resample(self, data, cache_dir=False, mask_area=True, **kwargs):
"""Resample the *data*, saving the projection info on disk if *precompute* evaluates to True.
:param mask_area: Provide data mask to `precompute` method to mask invalid data values in geolocation.
"""
if mask_area:
mask = kwar... | def resample(self, data, cache_dir=False, mask_area=True, **kwargs):
"""Resample the *data*, saving the projection info on disk if *precompute* evaluates to True.
:param mask_area: Provide data mask to `precompute` method to mask invalid data values in geolocation.
"""
if mask_area and hasattr(data, "m... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def _read_params_from_cache(self, cache_dir, hash_str, filename):
"""Read resampling parameters from cache"""
self.cache = self.caches.pop(hash_str, None)
if self.cache is not None and cache_dir:
self.dump(filename)
elif os.path.exists(filename):
self.cache = dict(np.load(filename))
... | def _read_params_from_cache(self, cache_dir, hash_str, filename):
"""Read resampling parameters from cache"""
try:
self.cache = self.caches[hash_str]
# trick to keep most used caches away from deletion
del self.caches[hash_str]
self.caches[hash_str] = self.cache
if cache... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def _update_caches(self, hash_str, cache_dir, filename):
"""Update caches and dump new resampling parameters to disk"""
self.caches[hash_str] = self.cache
if cache_dir:
# XXX: Look in to doing memmap-able files instead
# `arr.tofile(filename)`
self.dump(filename)
| def _update_caches(self, hash_str, cache_dir, filename):
"""Update caches and dump new resampling parameters to disk"""
self.caches[hash_str] = self.cache
while len(self.caches) > CACHE_SIZE:
self.caches.popitem(False)
if cache_dir:
# XXX: Look in to doing memmap-able files instead
... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def precompute(
self,
mask=None,
radius_of_influence=10000,
epsilon=0,
reduce_data=True,
nprocs=1,
segments=None,
cache_dir=False,
**kwargs,
):
"""Create a KDTree structure and store it for later use.
Note: The `mask` keyword should be provided if geolocation may be valid
... | def precompute(
self,
mask=None,
radius_of_influence=10000,
epsilon=0,
reduce_data=True,
nprocs=1,
segments=None,
cache_dir=False,
**kwargs,
):
"""Create a KDTree structure and store it for later use.
Note: The `mask` keyword should be provided if geolocation may be valid wh... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def compute(
self, data, weight_funcs=None, fill_value=None, with_uncert=False, **kwargs
):
del kwargs
LOG.debug("Resampling " + str(data.name))
if fill_value is None:
fill_value = data.attrs.get("_FillValue")
res = self.resampler.get_sample_from_neighbour_info(data, fill_value)
return r... | def compute(
self, data, weight_funcs=None, fill_value=None, with_uncert=False, **kwargs
):
del kwargs
return get_sample_from_neighbour_info(
"nn",
self.target_geo_def.shape,
data,
self.cache["valid_input_index"],
self.cache["valid_output_index"],
self.cache[... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def compute(
self,
data,
fill_value=0,
weight_count=10000,
weight_min=0.01,
weight_distance_max=1.0,
weight_sum_min=-1.0,
maximum_weight_mode=False,
**kwargs,
):
rows = self.cache["rows"]
cols = self.cache["cols"]
# if the data is scan based then check its metadata or th... | def compute(
self,
data,
fill_value=0,
weight_count=10000,
weight_min=0.01,
weight_distance_max=1.0,
weight_sum_min=-1.0,
maximum_weight_mode=False,
**kwargs,
):
rows = self.cache["rows"]
cols = self.cache["cols"]
# if the data is scan based then check its metadata or th... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def precompute(
self,
mask=None,
radius_of_influence=50000,
reduce_data=True,
nprocs=1,
segments=None,
cache_dir=False,
**kwargs,
):
"""Create bilinear coefficients and store them for later use.
Note: The `mask` keyword should be provided if geolocation may be valid
where da... | def precompute(
self,
mask=None,
radius_of_influence=50000,
reduce_data=True,
nprocs=1,
segments=None,
cache_dir=False,
**kwargs,
):
"""Create bilinear coefficients and store them for later use.
Note: The `mask` keyword should be provided if geolocation may be valid
where da... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def compute(self, data, fill_value=None, **kwargs):
"""Resample the given data using bilinear interpolation"""
del kwargs
target_shape = self.target_geo_def.shape
if data.ndim == 3:
output_shape = list(target_shape)
output_shape.append(data.shape[-1])
res = np.zeros(output_shape... | def compute(self, data, fill_value=None, **kwargs):
"""Resample the given data using bilinear interpolation"""
del kwargs
target_shape = self.target_geo_def.shape
if data.ndim == 3:
output_shape = list(target_shape)
output_shape.append(data.shape[-1])
res = np.zeros(output_shape... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def mask_source_lonlats(source_def, mask):
"""Mask source longitudes and latitudes to match data mask"""
source_geo_def = source_def
# the data may have additional masked pixels
# let's compare them to see if we can use the same area
# assume lons and lats mask are the same
if isinstance(source... | def mask_source_lonlats(source_def, mask):
"""Mask source longitudes and latitudes to match data mask"""
source_geo_def = source_def
# the data may have additional masked pixels
# let's compare them to see if we can use the same area
# assume lons and lats mask are the same
if np.any(mask) and ... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def __init__(
self,
filenames=None,
reader=None,
filter_parameters=None,
reader_kwargs=None,
ppp_config_dir=get_environ_config_dir(),
base_dir=None,
sensor=None,
start_time=None,
end_time=None,
area=None,
):
"""Initialize Scene with Reader and Compositor objects.
To ... | def __init__(
self,
filenames=None,
reader=None,
filter_parameters=None,
reader_kwargs=None,
ppp_config_dir=get_environ_config_dir(),
base_dir=None,
sensor=None,
start_time=None,
end_time=None,
area=None,
):
"""Initialize Scene with Reader and Compositor objects.
To ... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def _get_sensor_names(self):
"""Join the sensors from all loaded readers."""
# if the user didn't tell us what sensors to work with, let's figure it
# out
if not self.attrs.get("sensor"):
# reader finder could return multiple readers
return set(
[
sensor
... | def _get_sensor_names(self):
"""Join the sensors from all loaded readers."""
# if the user didn't tell us what sensors to work with, let's figure it
# out
if not self.info.get("sensor"):
# reader finder could return multiple readers
return set(
[
sensor
... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def start_time(self):
"""Return the start time of the file."""
return self.attrs["start_time"]
| def start_time(self):
"""Return the start time of the file."""
return self.info["start_time"]
| https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def end_time(self):
"""Return the end time of the file."""
return self.attrs["end_time"]
| def end_time(self):
"""Return the end time of the file."""
return self.info["end_time"]
| https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def available_composite_ids(self, available_datasets=None):
"""Get names of compositors that can be generated from the available
datasets.
:return: generator of available compositor's names
"""
if available_datasets is None:
available_datasets = self.available_dataset_ids(composites=False)
... | def available_composite_ids(self, available_datasets=None):
"""Get names of compositors that can be generated from the available
datasets.
:return: generator of available compositor's names
"""
if available_datasets is None:
available_datasets = self.available_dataset_ids(composites=False)
... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def all_composite_ids(self, sensor_names=None):
"""Get all composite IDs that are configured.
:return: generator of configured composite names
"""
if sensor_names is None:
sensor_names = self.attrs["sensor"]
compositors = []
# Note if we get compositors from the dep tree then it will in... | def all_composite_ids(self, sensor_names=None):
"""Get all composite IDs that are configured.
:return: generator of configured composite names
"""
if sensor_names is None:
sensor_names = self.info["sensor"]
compositors = []
# Note if we get compositors from the dep tree then it will inc... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def iter_by_area(self):
"""Generate datasets grouped by Area.
:return: generator of (area_obj, list of dataset objects)
"""
datasets_by_area = {}
for ds in self:
a = ds.attrs.get("area")
a_str = str(a) if a is not None else None
datasets_by_area.setdefault(a_str, (a, []))
... | def iter_by_area(self):
"""Generate datasets grouped by Area.
:return: generator of (area_obj, list of dataset objects)
"""
datasets_by_area = {}
for ds in self:
a = ds.info.get("area")
a_str = str(a) if a is not None else None
datasets_by_area.setdefault(a_str, (a, []))
... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def __setitem__(self, key, value):
"""Add the item to the scene."""
self.datasets[key] = value
ds_id = self.datasets.get_key(key)
self.wishlist.add(ds_id)
self.dep_tree.add_leaf(ds_id)
| def __setitem__(self, key, value):
"""Add the item to the scene."""
if not isinstance(value, Dataset):
raise ValueError("Only 'Dataset' objects can be assigned")
self.datasets[key] = value
ds_id = self.datasets.get_key(key)
self.wishlist.add(ds_id)
self.dep_tree.add_leaf(ds_id)
| https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def _generate_composite(self, comp_node, keepables):
"""Collect all composite prereqs and create the specified composite.
Args:
comp_node (Node): Composite Node to generate a Dataset for
keepables (set): `set` to update if any datasets are needed
when generation is cont... | def _generate_composite(self, comp_node, keepables):
"""Collect all composite prereqs and create the specified composite.
Args:
comp_node (Node): Composite Node to generate a Dataset for
keepables (set): `set` to update if any datasets are needed
when generation is cont... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def resample(
self, destination, datasets=None, compute=True, unload=True, **resample_kwargs
):
"""Resample the datasets and return a new scene."""
to_resample = [
dataset
for (dsid, dataset) in self.datasets.items()
if (not datasets) or dsid in datasets
]
new_scn = self._re... | def resample(
self, destination, datasets=None, compute=True, unload=True, **resample_kwargs
):
"""Resample the datasets and return a new scene."""
new_scn = Scene()
new_scn.info = self.info.copy()
# new_scn.cpl = self.cpl
new_scn.dep_tree = self.dep_tree.copy()
for ds_id, projectable in sel... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def show(self, dataset_id, overlay=None):
"""Show the *dataset* on screen as an image."""
from satpy.writers import get_enhanced_image
img = get_enhanced_image(self[dataset_id].squeeze(), overlay=overlay)
img.show()
return img
| def show(self, dataset_id, overlay=None):
"""Show the *dataset* on screen as an image."""
from satpy.writers import get_enhanced_image
get_enhanced_image(self[dataset_id], overlay=overlay).show()
| https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def load_writer_config(self, config_files, **kwargs):
"""Load the writer config for *config_files*."""
conf = {}
for conf_fn in config_files:
with open(conf_fn) as fd:
conf = recursive_dict_update(conf, yaml.load(fd))
writer_class = conf["writer"]["writer"]
writer = writer_class(... | def load_writer_config(self, config_files, **kwargs):
conf = {}
for conf_fn in config_files:
with open(conf_fn) as fd:
conf = recursive_dict_update(conf, yaml.load(fd))
writer_class = conf["writer"]["writer"]
writer = writer_class(
ppp_config_dir=self.ppp_config_dir, config_f... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def save_dataset(self, dataset_id, filename=None, writer=None, overlay=None, **kwargs):
"""Save the *dataset_id* to file using *writer* (default: geotiff)."""
if writer is None:
if filename is None:
writer = self.get_writer("geotiff", **kwargs)
else:
writer = self.get_wri... | def save_dataset(self, dataset_id, filename=None, writer=None, overlay=None, **kwargs):
"""Save the *dataset_id* to file using *writer* (geotiff by default)."""
if writer is None:
if filename is None:
writer = self.get_writer("geotiff", **kwargs)
else:
writer = self.get_w... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def get_writer(self, writer="geotiff", **kwargs):
"""Get the writer instance."""
config_fn = writer + ".yaml" if "." not in writer else writer
config_files = config_search_paths(
os.path.join("writers", config_fn), self.ppp_config_dir
)
kwargs.setdefault("config_files", config_files)
ret... | def get_writer(self, writer="geotiff", **kwargs):
config_fn = writer + ".yaml" if "." not in writer else writer
config_files = config_search_paths(
os.path.join("writers", config_fn), self.ppp_config_dir
)
kwargs.setdefault("config_files", config_files)
return self.load_writer_config(**kwarg... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def get_writer_by_ext(self, extension, **kwargs):
"""Find the writer matching the *extension*."""
mapping = {".tiff": "geotiff", ".tif": "geotiff", ".nc": "cf"}
return self.get_writer(mapping.get(extension.lower(), "simple_image"), **kwargs)
| def get_writer_by_ext(self, extension, **kwargs):
mapping = {".tiff": "geotiff", ".tif": "geotiff", ".nc": "cf"}
return self.get_writer(mapping.get(extension.lower(), "simple_image"), **kwargs)
| https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def lonlat2xyz(lon, lat):
"""Convert lon lat to cartesian."""
lat = xu.deg2rad(lat)
lon = xu.deg2rad(lon)
x = xu.cos(lat) * xu.cos(lon)
y = xu.cos(lat) * xu.sin(lon)
z = xu.sin(lat)
return x, y, z
| def lonlat2xyz(lon, lat):
"""Convert lon lat to cartesian."""
lat = np.deg2rad(lat)
lon = np.deg2rad(lon)
x = np.cos(lat) * np.cos(lon)
y = np.cos(lat) * np.sin(lon)
z = np.sin(lat)
return x, y, z
| https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def xyz2lonlat(x, y, z):
"""Convert cartesian to lon lat."""
lon = xu.rad2deg(xu.arctan2(y, x))
lat = xu.rad2deg(xu.arctan2(z, xu.sqrt(x**2 + y**2)))
return lon, lat
| def xyz2lonlat(x, y, z):
"""Convert cartesian to lon lat."""
lon = np.rad2deg(np.arctan2(y, x))
lat = np.rad2deg(np.arctan2(z, np.sqrt(x**2 + y**2)))
return lon, lat
| https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def angle2xyz(azi, zen):
"""Convert azimuth and zenith to cartesian."""
azi = xu.deg2rad(azi)
zen = xu.deg2rad(zen)
x = xu.sin(zen) * xu.sin(azi)
y = xu.sin(zen) * xu.cos(azi)
z = xu.cos(zen)
return x, y, z
| def angle2xyz(azi, zen):
"""Convert azimuth and zenith to cartesian."""
azi = np.deg2rad(azi)
zen = np.deg2rad(zen)
x = np.sin(zen) * np.sin(azi)
y = np.sin(zen) * np.cos(azi)
z = np.cos(zen)
return x, y, z
| https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def xyz2angle(x, y, z):
"""Convert cartesian to azimuth and zenith."""
azi = xu.rad2deg(xu.arctan2(x, y))
zen = 90 - xu.rad2deg(xu.arctan2(z, xu.sqrt(x**2 + y**2)))
return azi, zen
| def xyz2angle(x, y, z):
"""Convert cartesian to azimuth and zenith."""
azi = np.rad2deg(np.arctan2(x, y))
zen = 90 - np.rad2deg(np.arctan2(z, np.sqrt(x**2 + y**2)))
return azi, zen
| https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def _determine_mode(dataset):
if "mode" in dataset.attrs:
return dataset.attrs["mode"]
if dataset.ndim == 2:
return "L"
elif dataset.shape[0] == 2:
return "LA"
elif dataset.shape[0] == 3:
return "RGB"
elif dataset.shape[0] == 4:
return "RGBA"
else:
... | def _determine_mode(dataset):
if "mode" in dataset.info:
return dataset.info["mode"]
if dataset.ndim == 2:
return "L"
elif dataset.shape[0] == 2:
return "LA"
elif dataset.shape[0] == 3:
return "RGB"
elif dataset.shape[0] == 4:
return "RGBA"
else:
... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def add_overlay(
orig,
area,
coast_dir,
color=(0, 0, 0),
width=0.5,
resolution=None,
level_coast=1,
level_borders=1,
):
"""Add coastline and political borders to image, using *color* (tuple
of integers between 0 and 255).
Warning: Loses the masks !
*resolution* is chosen ... | def add_overlay(
orig,
area,
coast_dir,
color=(0, 0, 0),
width=0.5,
resolution=None,
level_coast=1,
level_borders=1,
):
"""Add coastline and political borders to image, using *color* (tuple
of integers between 0 and 255).
Warning: Loses the masks !
*resolution* is chosen ... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def get_enhanced_image(
dataset,
enhancer=None,
fill_value=None,
ppp_config_dir=None,
enhancement_config_file=None,
overlay=None,
decorate=None,
):
mode = _determine_mode(dataset)
if ppp_config_dir is None:
ppp_config_dir = get_environ_config_dir()
if enhancer is None:
... | def get_enhanced_image(
dataset,
enhancer=None,
fill_value=None,
ppp_config_dir=None,
enhancement_config_file=None,
overlay=None,
decorate=None,
):
mode = _determine_mode(dataset)
if ppp_config_dir is None:
ppp_config_dir = get_environ_config_dir()
if enhancer is None:
... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def show(dataset, **kwargs):
"""Display the dataset as an image."""
img = get_enhanced_image(dataset.squeeze(), **kwargs)
img.show()
return img
| def show(dataset, **kwargs):
"""Display the dataset as an image."""
if not dataset.is_loaded():
raise ValueError("Dataset not loaded, cannot display.")
img = get_enhanced_image(dataset, **kwargs)
img.show()
| https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def to_image(dataset, copy=False, **kwargs):
# Only add keywords if they are present
for key in ["mode", "fill_value", "palette"]:
if key in dataset.attrs:
kwargs.setdefault(key, dataset.attrs[key])
dataset = dataset.squeeze()
if "bands" in dataset.dims:
return Image(
... | def to_image(dataset, copy=True, **kwargs):
# Only add keywords if they are present
for key in ["mode", "fill_value", "palette"]:
if key in dataset.info:
kwargs.setdefault(key, dataset.info[key])
if dataset.ndim == 2:
return Image([dataset], copy=copy, **kwargs)
elif dataset... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def save_dataset(
self, dataset, filename=None, fill_value=None, overlay=None, decorate=None, **kwargs
):
"""Saves the *dataset* to a given *filename*."""
fill_value = fill_value if fill_value is not None else self.fill_value
img = get_enhanced_image(
dataset.squeeze(), self.enhancer, fill_value... | def save_dataset(
self, dataset, filename=None, fill_value=None, overlay=None, decorate=None, **kwargs
):
"""Saves the *dataset* to a given *filename*."""
fill_value = fill_value if fill_value is not None else self.fill_value
img = get_enhanced_image(
dataset, self.enhancer, fill_value, overlay=... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def omerc2cf(proj_dict):
"""Return the cf grid mapping for the omerc projection."""
if "no_rot" in proj_dict:
no_rotation = " "
else:
no_rotation = None
args = dict(
azimuth_of_central_line=proj_dict.get("alpha"),
latitude_of_projection_origin=proj_dict.get("lat_0"),
... | def omerc2cf(proj_dict):
"""Return the cf grid mapping for the omerc projection."""
grid_mapping_name = "oblique_mercator"
if "no_rot" in proj_dict:
no_rotation = " "
else:
no_rotation = None
args = dict(
azimuth_of_central_line=proj_dict.get("alpha"),
latitude_of_p... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def geos2cf(proj_dict):
"""Return the cf grid mapping for the geos projection."""
args = dict(
perspective_point_height=proj_dict.get("h"),
latitude_of_projection_origin=proj_dict.get("lat_0"),
longitude_of_projection_origin=proj_dict.get("lon_0"),
grid_mapping_name="geostationar... | def geos2cf(proj_dict):
"""Return the cf grid mapping for the geos projection."""
grid_mapping_name = "geostationary"
args = dict(
perspective_point_height=proj_dict.get("h"),
latitude_of_projection_origin=proj_dict.get("lat_0"),
longitude_of_projection_origin=proj_dict.get("lon_0")... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def laea2cf(proj_dict):
"""Return the cf grid mapping for the laea projection."""
args = dict(
latitude_of_projection_origin=proj_dict.get("lat_0"),
longitude_of_projection_origin=proj_dict.get("lon_0"),
grid_mapping_name="lambert_azimuthal_equal_area",
)
return args
| def laea2cf(proj_dict):
"""Return the cf grid mapping for the laea projection."""
grid_mapping_name = "lambert_azimuthal_equal_area"
args = dict(
latitude_of_projection_origin=proj_dict.get("lat_0"),
longitude_of_projection_origin=proj_dict.get("lon_0"),
crtype="grid_mapping",
... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def create_grid_mapping(area):
"""Create the grid mapping instance for `area`."""
try:
grid_mapping = mappings[area.proj_dict["proj"]](area.proj_dict)
grid_mapping["name"] = area.proj_dict["proj"]
except KeyError:
raise NotImplementedError
return grid_mapping
| def create_grid_mapping(area):
"""Create the grid mapping instance for `area`."""
try:
grid_mapping = mappings[area.proj_dict["proj"]](area.proj_dict)
except KeyError:
raise NotImplementedError
return grid_mapping
| https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def save_datasets(self, datasets, filename, **kwargs):
"""Save all datasets to one or more files."""
LOG.info("Saving datasets to NetCDF4/CF.")
ds_collection = {}
for ds in datasets:
ds_collection.update(get_extra_ds(ds))
datas = {}
for ds in ds_collection.values():
try:
... | def save_datasets(self, datasets, filename, **kwargs):
"""Save all datasets to one or more files."""
LOG.info("Saving datasets to NetCDF4/CF.")
fields = []
shapes = {}
for dataset in datasets:
if dataset.shape in shapes:
domain = shapes[dataset.shape]
else:
li... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def save_datasets(
self,
datasets,
sector_id=None,
source_name=None,
filename=None,
tile_count=(1, 1),
tile_size=None,
lettered_grid=False,
num_subtiles=None,
**kwargs,
):
if sector_id is None:
raise TypeError("Keyword 'sector_id' is required")
def _area_id(area_... | def save_datasets(
self,
datasets,
sector_id=None,
source_name=None,
filename=None,
tile_count=(1, 1),
tile_size=None,
lettered_grid=False,
num_subtiles=None,
**kwargs,
):
if sector_id is None:
raise TypeError("Keyword 'sector_id' is required")
def _area_id(area_... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def create_tile_output(
self,
dataset,
sector_id,
trow,
tcol,
tile_id,
tmp_x,
tmp_y,
tmp_tile,
tile_count,
image_shape,
mx,
bx,
my,
by,
filename,
awips_info,
attr_helper,
fills,
factor,
offset,
valid_min,
valid_max,
bit_dept... | def create_tile_output(
self,
dataset,
sector_id,
trow,
tcol,
tile_id,
tmp_x,
tmp_y,
tmp_tile,
tile_count,
image_shape,
mx,
bx,
my,
by,
filename,
awips_info,
attr_helper,
fills,
factor,
offset,
valid_min,
valid_max,
bit_dept... | https://github.com/pytroll/satpy/issues/123 | [INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] Saving datasets to NetCDF4/CF.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No longitude and latitude data to save.
[INFO: 2017-12-12 08:14:04 : satpy.writers.cf_writer] No grid mapping to save.
--------------------------------------------------------------... | AttributeError |
def _get_calibration_params(self):
"""Get the calibration parameters from the metadata."""
params = {}
idx_table = []
val_table = []
for elt in self.mda["image_data_function"].split(b"\r\n"):
try:
key, val = elt.split(b":=")
try:
idx_table.append(int(k... | def _get_calibration_params(self):
"""Get the calibration parameters from the metadata."""
params = {}
idx_table = []
val_table = []
for elt in self.mda["image_data_function"].split("\r\n"):
try:
key, val = elt.split(":=")
try:
idx_table.append(int(key... | https://github.com/pytroll/satpy/issues/165 | Traceback (most recent call last):
File "test_hrit_goes.py", line 19, in <module>
scn.load([composite])
File "/home/a001673/usr/src/satpy/satpy/scene.py", line 566, in load
self.read(**kwargs)
File "/home/a001673/usr/src/satpy/satpy/scene.py", line 507, in read
return self.read_datasets(nodes, **kwargs)
File "/home/a00... | AttributeError |
def _calibrate(self, data):
"""Calibrate *data*."""
idx = self.mda["calibration_parameters"]["indices"]
val = self.mda["calibration_parameters"]["values"]
ddata = data.data.map_blocks(
lambda block: np.interp(block, idx, val), dtype=val.dtype
)
res = xr.DataArray(ddata, dims=data.dims, a... | def _calibrate(self, data):
"""Calibrate *data*."""
idx = self.mda["calibration_parameters"]["indices"]
val = self.mda["calibration_parameters"]["values"]
ddata = data.data.map_blocks(
lambda block: np.interp(block, idx, val), dtype=val.dtype
)
res = xr.DataArray(ddata, dims=data.dims, a... | https://github.com/pytroll/satpy/issues/165 | Traceback (most recent call last):
File "test_hrit_goes.py", line 19, in <module>
scn.load([composite])
File "/home/a001673/usr/src/satpy/satpy/scene.py", line 566, in load
self.read(**kwargs)
File "/home/a001673/usr/src/satpy/satpy/scene.py", line 507, in read
return self.read_datasets(nodes, **kwargs)
File "/home/a00... | AttributeError |
def copy(self, node_cache=None):
if node_cache and self.name in node_cache:
return node_cache[self.name]
s = Node(self.name, self.data)
for c in self.children:
c = c.copy(node_cache=node_cache)
s.add_child(c)
return s
| def copy(self):
s = Node(self.name, self.data)
for c in self.children:
c = c.copy()
s.add_child(c)
return s
| https://github.com/pytroll/satpy/issues/208 | TypeError Traceback (most recent call last)
/home/a000680/laptop/Pytroll/demo/modis/satpy_issue_5march2018.py in <module>()
59
60 scn.load(['solar_azimuth_angle', 'solar_zenith_angle',
---> 61 'satellite_zenith_angle', 'satellite_azimuth_angle'], resolution=1000)
/home/a000680... | TypeError |
def copy(self):
"""Copy the this node tree
Note all references to readers are removed. This is meant to avoid
tree copies accessing readers that would return incompatible (Area)
data. Theoretically it should be possible for tree copies to request
compositor or modifier information as long as they d... | def copy(self):
"""Copy the this node tree
Note all references to readers are removed. This is meant to avoid
tree copies accessing readers that would return incompatible (Area)
data. Theoretically it should be possible for tree copies to request
compositor or modifier information as long as they d... | https://github.com/pytroll/satpy/issues/208 | TypeError Traceback (most recent call last)
/home/a000680/laptop/Pytroll/demo/modis/satpy_issue_5march2018.py in <module>()
59
60 scn.load(['solar_azimuth_angle', 'solar_zenith_angle',
---> 61 'satellite_zenith_angle', 'satellite_azimuth_angle'], resolution=1000)
/home/a000680... | TypeError |
def read(self, nodes=None, **kwargs):
"""Load datasets from the necessary reader.
Args:
nodes (iterable): DependencyTree Node objects
**kwargs: Keyword arguments to pass to the reader's `load` method.
Returns:
DatasetDict of loaded datasets
"""
if nodes is None:
re... | def read(self, nodes=None, **kwargs):
"""Load datasets from the necessary reader.
Args:
nodes (iterable): DependencyTree Node objects
**kwargs: Keyword arguments to pass to the reader's `load` method.
Returns:
DatasetDict of loaded datasets
"""
if nodes is None:
re... | https://github.com/pytroll/satpy/issues/208 | TypeError Traceback (most recent call last)
/home/a000680/laptop/Pytroll/demo/modis/satpy_issue_5march2018.py in <module>()
59
60 scn.load(['solar_azimuth_angle', 'solar_zenith_angle',
---> 61 'satellite_zenith_angle', 'satellite_azimuth_angle'], resolution=1000)
/home/a000680... | TypeError |
def compute(self, nodes=None):
"""Compute all the composites contained in `requirements`."""
if nodes is None:
required_nodes = self.wishlist - set(self.datasets.keys())
nodes = set(self.dep_tree.trunk(nodes=required_nodes)) - set(
self.datasets.keys()
)
return self._read... | def compute(self, nodes=None):
"""Compute all the composites contained in `requirements`."""
if nodes is None:
required_nodes = self.wishlist - set(self.datasets.keys())
nodes = set(self.dep_tree.trunk(nodes=required_nodes)) - set(
self.datasets.keys()
)
return self.read_... | https://github.com/pytroll/satpy/issues/208 | TypeError Traceback (most recent call last)
/home/a000680/laptop/Pytroll/demo/modis/satpy_issue_5march2018.py in <module>()
59
60 scn.load(['solar_azimuth_angle', 'solar_zenith_angle',
---> 61 'satellite_zenith_angle', 'satellite_azimuth_angle'], resolution=1000)
/home/a000680... | TypeError |
def resample(
self, destination=None, datasets=None, compute=True, unload=True, **resample_kwargs
):
"""Resample the datasets and return a new scene."""
to_resample = [
dataset
for (dsid, dataset) in self.datasets.items()
if (not datasets) or dsid in datasets
]
if destinatio... | def resample(
self, destination=None, datasets=None, compute=True, unload=True, **resample_kwargs
):
"""Resample the datasets and return a new scene."""
to_resample = [
dataset
for (dsid, dataset) in self.datasets.items()
if (not datasets) or dsid in datasets
]
if destinatio... | https://github.com/pytroll/satpy/issues/208 | TypeError Traceback (most recent call last)
/home/a000680/laptop/Pytroll/demo/modis/satpy_issue_5march2018.py in <module>()
59
60 scn.load(['solar_azimuth_angle', 'solar_zenith_angle',
---> 61 'satellite_zenith_angle', 'satellite_azimuth_angle'], resolution=1000)
/home/a000680... | TypeError |
def read_sigmf(data_file, meta_file=None, buffer=None, num_samples=None, offset=0):
"""
Read and unpack binary file, with SigMF spec, to GPU memory.
Parameters
----------
data_file : str
File contain sigmf data.
meta_file : str, optional
File contain sigmf meta.
buffer : nda... | def read_sigmf(data_file, meta_file=None, buffer=None, num_samples=None, offset=0):
"""
Read and unpack binary file, with SigMF spec, to GPU memory.
Parameters
----------
data_file : str
File contain sigmf data.
meta_file : str, optional
File contain sigmf meta.
buffer : nda... | https://github.com/rapidsai/cusignal/issues/279 | ---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
<ipython-input-46-cda23b1650a7> in <module>
1 data = cusignal.read_sigmf(
----> 2 data_file='../data/Demod_WiFi_cable_X310_3123D76_IQ#1_run1.sigmf-data'
3 )
4 data
... | FileNotFoundError |
def clean_percentage(self):
if not self.range:
raise exceptions.ValidationError(
_("Percentage benefits require a product range")
)
if not self.value:
raise exceptions.ValidationError(
_("Percentage discount benefits require a value")
)
if self.value >... | def clean_percentage(self):
if not self.range:
raise exceptions.ValidationError(
_("Percentage benefits require a product range")
)
if self.value > 100:
raise exceptions.ValidationError(
_("Percentage discount cannot be greater than 100")
)
| https://github.com/django-oscar/django-oscar/issues/2167 | Traceback (most recent call last):
File "/Users/a1/projects/djangooscar/env3/lib/python3.5/site-packages/django/core/handlers/base.py", line 149, in get_response
response = self.process_exception_by_middleware(e, request)
File "/Users/a1/projects/djangooscar/env3/lib/python3.5/site-packages/django/core/handlers/base.py... | TypeError |
def get(self, request, *args, **kwargs):
try:
self.search_handler = self.get_search_handler(
self.request.GET, request.get_full_path(), []
)
except InvalidPage:
# Redirect to page one.
messages.error(request, _("The given page number was invalid."))
return red... | def get(self, request, *args, **kwargs):
self.search_handler = self.get_search_handler(
self.request.GET, request.get_full_path(), []
)
return super(CatalogueView, self).get(request, *args, **kwargs)
| https://github.com/django-oscar/django-oscar/issues/1490 | Traceback (most recent call last):
File "/var/www/oscar/virtualenvs/latest/local/lib/python2.7/site-packages/Django-1.6.6-py2.7.egg/django/core/handlers/base.py", line 112, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/var/www/oscar/virtualenvs/latest/local/lib/python2... | ValueError |
def get(self, request, *args, **kwargs):
# Fetch the category; return 404 or redirect as needed
self.category = self.get_category()
potential_redirect = self.redirect_if_necessary(request.path, self.category)
if potential_redirect is not None:
return potential_redirect
try:
self.sea... | def get(self, request, *args, **kwargs):
# Fetch the category; return 404 or redirect as needed
self.category = self.get_category()
redirect = self.redirect_if_necessary(request.path, self.category)
if redirect is not None:
return redirect
self.search_handler = self.get_search_handler(
... | https://github.com/django-oscar/django-oscar/issues/1490 | Traceback (most recent call last):
File "/var/www/oscar/virtualenvs/latest/local/lib/python2.7/site-packages/Django-1.6.6-py2.7.egg/django/core/handlers/base.py", line 112, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/var/www/oscar/virtualenvs/latest/local/lib/python2... | ValueError |
def lookup(self, slug, table="monster"):
"""Looks up a monster, technique, item, or npc based on name or id.
:param slug: The slug of the monster, technique, item, or npc. A short English identifier.
:param table: Which index to do the search in. Can be: "monster",
"item", "npc", or "technique".
... | def lookup(self, name, table="monster"):
"""Looks up a monster, technique, item, or npc based on name or id.
:param name: The name of the monster, technique, item, or npc.
:param table: Which index to do the search in. Can be: "monster",
"item", "npc", or "technique".
:type name: String
:ty... | https://github.com/Tuxemon/Tuxemon/issues/160 | Traceback (most recent call last):
File "./tuxemon.py", line 60, in <module>
main()
File "/tmp/Tuxemon/tuxemon/core/main.py", line 109, in main
control.main()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 512, in main
self.main_loop()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 573, in main_loop
self.update(t... | KeyError |
def start_battle(self, game, action):
"""Start a battle and switch to the combat module. The parameters must contain an NPC id
in the NPC database.
:param game: The main game object that contains all the game's variables.
:param action: The action (tuple) retrieved from the database that contains the a... | def start_battle(self, game, action):
"""Start a battle and switch to the combat module. The parameters must contain an NPC id
in the NPC database.
:param game: The main game object that contains all the game's variables.
:param action: The action (tuple) retrieved from the database that contains the a... | https://github.com/Tuxemon/Tuxemon/issues/160 | Traceback (most recent call last):
File "./tuxemon.py", line 60, in <module>
main()
File "/tmp/Tuxemon/tuxemon/core/main.py", line 109, in main
control.main()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 512, in main
self.main_loop()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 573, in main_loop
self.update(t... | KeyError |
def __init__(self, slug=None, id=None):
self.id = 0
self.name = "Blank"
self.description = "None"
self.effect = []
self.type = None
self.power = 0
self.sprite = "" # The path to the sprite to load.
self.surface = None # The pygame.Surface object of the item.
self.surface_size_origi... | def __init__(self, name=None, id=None):
self.id = 0
self.name = "Blank"
self.description = "None"
self.effect = []
self.type = None
self.power = 0
self.sprite = "" # The path to the sprite to load.
self.surface = None # The pygame.Surface object of the item.
self.surface_size_origi... | https://github.com/Tuxemon/Tuxemon/issues/160 | Traceback (most recent call last):
File "./tuxemon.py", line 60, in <module>
main()
File "/tmp/Tuxemon/tuxemon/core/main.py", line 109, in main
control.main()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 512, in main
self.main_loop()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 573, in main_loop
self.update(t... | KeyError |
def load(self, slug, id):
"""Loads and sets this items's attributes from the item.db database. The item is looked up
in the database by name or id.
:param slug: The item slug to look up in the monster.item database.
:param id: The id of the item to look up in the item.db database.
:type slug: Stri... | def load(self, name, id):
"""Loads and sets this items's attributes from the item.db database. The item is looked up
in the database by name or id.
:param name: The name of the item to look up in the monster.item database.
:param id: The id of the item to look up in the item.db database.
:type nam... | https://github.com/Tuxemon/Tuxemon/issues/160 | Traceback (most recent call last):
File "./tuxemon.py", line 60, in <module>
main()
File "/tmp/Tuxemon/tuxemon/core/main.py", line 109, in main
control.main()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 512, in main
self.main_loop()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 573, in main_loop
self.update(t... | KeyError |
def heal(self, user, target):
"""This effect heals the target based on the item's power attribute.
:param user: The monster or object that is using this item.
:param target: The monster or object that we are using this item on.
:type user: Varies
:type target: Varies
:rtype: bool
:returns... | def heal(self, user, target):
"""This effect heals the target based on the item's power attribute.
:param user: The monster or object that is using this item.
:param target: The monster or object that we are using this item on.
:type user: Varies
:type target: Varies
:rtype: bool
:returns... | https://github.com/Tuxemon/Tuxemon/issues/160 | Traceback (most recent call last):
File "./tuxemon.py", line 60, in <module>
main()
File "/tmp/Tuxemon/tuxemon/core/main.py", line 109, in main
control.main()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 512, in main
self.main_loop()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 573, in main_loop
self.update(t... | KeyError |
def __init__(self, slug=None, id=None):
self.name = "Pound"
self.tech_id = 0
self.category = "attack"
self.type1 = "Normal"
self.type2 = None
self._combat_counter = 0 # number of turns that this technique has been active
self.power = 1
self.effect = []
# If a slug of the technique ... | def __init__(self, name=None, id=None):
self.name = "Pound"
self.tech_id = 0
self.category = "attack"
self.type1 = "Normal"
self.type2 = None
self._combat_counter = 0 # number of turns that this technique has been active
self.power = 1
self.effect = []
# If a name of the technique ... | https://github.com/Tuxemon/Tuxemon/issues/160 | Traceback (most recent call last):
File "./tuxemon.py", line 60, in <module>
main()
File "/tmp/Tuxemon/tuxemon/core/main.py", line 109, in main
control.main()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 512, in main
self.main_loop()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 573, in main_loop
self.update(t... | KeyError |
def load(self, slug, id):
"""Loads and sets this technique's attributes from the technique
database. The technique is looked up in the database by name or id.
:param slug: The slug of the technique to look up in the monster
database.
:param id: The id of the technique to look up in the monster ... | def load(self, name, id):
"""Loads and sets this technique's attributes from the technique
database. The technique is looked up in the database by name or id.
:param name: The name of the technique to look up in the monster
database.
:param id: The id of the technique to look up in the monster ... | https://github.com/Tuxemon/Tuxemon/issues/160 | Traceback (most recent call last):
File "./tuxemon.py", line 60, in <module>
main()
File "/tmp/Tuxemon/tuxemon/core/main.py", line 109, in main
control.main()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 512, in main
self.main_loop()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 573, in main_loop
self.update(t... | KeyError |
def use(self, user, target):
"""Applies this technique's effects as defined in the "effect" column of the technique
database. This method will execute a function with the same name as the effect defined in
the database. If you want to add a new effect, simply create a new function under the
Technique cl... | def use(self, user, target):
"""Applies this technique's effects as defined in the "effect" column of the technique
database. This method will execute a function with the same name as the effect defined in
the database. If you want to add a new effect, simply create a new function under the
Technique cl... | https://github.com/Tuxemon/Tuxemon/issues/160 | Traceback (most recent call last):
File "./tuxemon.py", line 60, in <module>
main()
File "/tmp/Tuxemon/tuxemon/core/main.py", line 109, in main
control.main()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 512, in main
self.main_loop()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 573, in main_loop
self.update(t... | KeyError |
def poison(self, user, target):
"""This effect has a chance to apply the poison status effect to a target monster.
Currently there is a 1/10 chance of poison.
:param user: The core.components.monster.Monster object that used this technique.
:param target: The core.components.monster.Monster object that... | def poison(self, user, target):
"""This effect has a chance to apply the poison status effect to a target monster.
Currently there is a 1/10 chance of poison.
:param user: The core.components.monster.Monster object that used this technique.
:param target: The core.components.monster.Monster object that... | https://github.com/Tuxemon/Tuxemon/issues/160 | Traceback (most recent call last):
File "./tuxemon.py", line 60, in <module>
main()
File "/tmp/Tuxemon/tuxemon/core/main.py", line 109, in main
control.main()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 512, in main
self.main_loop()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 573, in main_loop
self.update(t... | KeyError |
def faint(self, user, target):
"""Faint this monster. Typically, called by combat to faint self, not others.
:param user: The core.components.monster.Monster object that used this technique.
:param target: The core.components.monster.Monster object that we are using this
technique on.
:type u... | def faint(self, user, target):
"""Faint this monster. Typically, called by combat to faint self, not others.
:param user: The core.components.monster.Monster object that used this technique.
:param target: The core.components.monster.Monster object that we are using this
technique on.
:type u... | https://github.com/Tuxemon/Tuxemon/issues/160 | Traceback (most recent call last):
File "./tuxemon.py", line 60, in <module>
main()
File "/tmp/Tuxemon/tuxemon/core/main.py", line 109, in main
control.main()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 512, in main
self.main_loop()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 573, in main_loop
self.update(t... | KeyError |
def main():
"""Add all available states to our scene manager (tools.Control)
and start the game using the pygame interface.
:rtype: None
:returns: None
"""
import pygame
from .control import PygameControl
prepare.init()
control = PygameControl(prepare.ORIGINAL_CAPTION)
control... | def main():
"""Add all available states to our scene manager (tools.Control)
and start the game using the pygame interface.
:rtype: None
:returns: None
"""
import pygame
from .control import PygameControl
prepare.init()
control = PygameControl(prepare.ORIGINAL_CAPTION)
control... | https://github.com/Tuxemon/Tuxemon/issues/160 | Traceback (most recent call last):
File "./tuxemon.py", line 60, in <module>
main()
File "/tmp/Tuxemon/tuxemon/core/main.py", line 109, in main
control.main()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 512, in main
self.main_loop()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 573, in main_loop
self.update(t... | KeyError |
def check_status(monster, status_name):
return any(t for t in monster.status if t.slug == status_name)
| def check_status(monster, status_name):
return any(t for t in monster.status if t.name == status_name)
| https://github.com/Tuxemon/Tuxemon/issues/160 | Traceback (most recent call last):
File "./tuxemon.py", line 60, in <module>
main()
File "/tmp/Tuxemon/tuxemon/core/main.py", line 109, in main
control.main()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 512, in main
self.main_loop()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 573, in main_loop
self.update(t... | KeyError |
def fainted(monster):
return check_status(monster, "status_faint")
| def fainted(monster):
return check_status(monster, "Faint")
| https://github.com/Tuxemon/Tuxemon/issues/160 | Traceback (most recent call last):
File "./tuxemon.py", line 60, in <module>
main()
File "/tmp/Tuxemon/tuxemon/core/main.py", line 109, in main
control.main()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 512, in main
self.main_loop()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 573, in main_loop
self.update(t... | KeyError |
def perform_action(self, user, technique, target=None):
"""Do something with the thing: animated
:param user:
:param technique: Not a dict: a Technique or Item
:param target:
:returns:
"""
technique.advance_round()
result = technique.use(user, target)
try:
tools.load_soun... | def perform_action(self, user, technique, target=None):
"""Do something with the thing: animated
:param user:
:param technique: Not a dict: a Technique or Item
:param target:
:returns:
"""
technique.advance_round()
result = technique.use(user, target)
try:
tools.load_soun... | https://github.com/Tuxemon/Tuxemon/issues/160 | Traceback (most recent call last):
File "./tuxemon.py", line 60, in <module>
main()
File "/tmp/Tuxemon/tuxemon/core/main.py", line 109, in main
control.main()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 512, in main
self.main_loop()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 573, in main_loop
self.update(t... | KeyError |
def check_party_hp(self):
"""Apply status effects, then check HP, and party status
* Monsters will be removed from play here
:returns: None
"""
for player in self.monsters_in_play.keys():
for monster in self.monsters_in_play[player]:
self.animate_hp(monster)
if mons... | def check_party_hp(self):
"""Apply status effects, then check HP, and party status
* Monsters will be removed from play here
:returns: None
"""
for player in self.monsters_in_play.keys():
for monster in self.monsters_in_play[player]:
self.animate_hp(monster)
if mons... | https://github.com/Tuxemon/Tuxemon/issues/160 | Traceback (most recent call last):
File "./tuxemon.py", line 60, in <module>
main()
File "/tmp/Tuxemon/tuxemon/core/main.py", line 109, in main
control.main()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 512, in main
self.main_loop()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 573, in main_loop
self.update(t... | KeyError |
def open_swap_menu(self):
"""Open menus to swap monsters in party
:return: None
"""
def swap_it(menuitem):
monster = menuitem.game_object
trans = translator.translate
if monster in self.game.get_state_name("CombatState").active_monsters:
tools.open_dialog(
... | def open_swap_menu(self):
"""Open menus to swap monsters in party
:return: None
"""
def swap_it(menuitem):
monster = menuitem.game_object
trans = translator.translate
if monster in self.game.get_state_name("CombatState").active_monsters:
tools.open_dialog(
... | https://github.com/Tuxemon/Tuxemon/issues/160 | Traceback (most recent call last):
File "./tuxemon.py", line 60, in <module>
main()
File "/tmp/Tuxemon/tuxemon/core/main.py", line 109, in main
control.main()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 512, in main
self.main_loop()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 573, in main_loop
self.update(t... | KeyError |
def swap_it(menuitem):
monster = menuitem.game_object
trans = translator.translate
if monster in self.game.get_state_name("CombatState").active_monsters:
tools.open_dialog(self.game, [trans("combat_isactive", {"name": monster.name})])
return
elif monster.current_hp < 1:
tools.ope... | def swap_it(menuitem):
monster = menuitem.game_object
trans = translator.translate
if monster in self.game.get_state_name("CombatState").active_monsters:
tools.open_dialog(self.game, [trans("combat_isactive", {"name": monster.name})])
return
elif monster.current_hp < 1:
tools.ope... | https://github.com/Tuxemon/Tuxemon/issues/160 | Traceback (most recent call last):
File "./tuxemon.py", line 60, in <module>
main()
File "/tmp/Tuxemon/tuxemon/core/main.py", line 109, in main
control.main()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 512, in main
self.main_loop()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 573, in main_loop
self.update(t... | KeyError |
def open_technique_menu(self):
"""Open menus to choose a Technique to use
:return: None
"""
def choose_technique():
# open menu to choose technique
menu = self.game.push_state("Menu")
menu.shrink_to_items = True
# add techniques to the menu
for tech in self.mon... | def open_technique_menu(self):
"""Open menus to choose a Technique to use
:return: None
"""
def choose_technique():
# open menu to choose technique
menu = self.game.push_state("Menu")
menu.shrink_to_items = True
# add techniques to the menu
for tech in self.mon... | https://github.com/Tuxemon/Tuxemon/issues/160 | Traceback (most recent call last):
File "./tuxemon.py", line 60, in <module>
main()
File "/tmp/Tuxemon/tuxemon/core/main.py", line 109, in main
control.main()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 512, in main
self.main_loop()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 573, in main_loop
self.update(t... | KeyError |
def choose_technique():
# open menu to choose technique
menu = self.game.push_state("Menu")
menu.shrink_to_items = True
# add techniques to the menu
for tech in self.monster.moves:
image = self.shadow_text(tech.name)
item = MenuItem(image, None, None, tech)
menu.add(item)
... | def choose_technique():
# open menu to choose technique
menu = self.game.push_state("Menu")
menu.shrink_to_items = True
# add techniques to the menu
for tech in self.monster.moves:
image = self.shadow_text(tech.name_trans)
item = MenuItem(image, None, None, tech)
menu.add(it... | https://github.com/Tuxemon/Tuxemon/issues/160 | Traceback (most recent call last):
File "./tuxemon.py", line 60, in <module>
main()
File "/tmp/Tuxemon/tuxemon/core/main.py", line 109, in main
control.main()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 512, in main
self.main_loop()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 573, in main_loop
self.update(t... | KeyError |
def on_menu_selection(self, menu_item):
"""Called when player has selected something from the inventory
Currently, opens a new menu depending on the state context
:param menu_item:
:return:
"""
item = menu_item.game_object
state = self.determine_state_called_from()
if state in item.us... | def on_menu_selection(self, menu_item):
"""Called when player has selected something from the inventory
Currently, opens a new menu depending on the state context
:param menu_item:
:return:
"""
item = menu_item.game_object
state = self.determine_state_called_from()
if state in item.us... | https://github.com/Tuxemon/Tuxemon/issues/160 | Traceback (most recent call last):
File "./tuxemon.py", line 60, in <module>
main()
File "/tmp/Tuxemon/tuxemon/core/main.py", line 109, in main
control.main()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 512, in main
self.main_loop()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 573, in main_loop
self.update(t... | KeyError |
def initialize_items(self):
"""Get all player inventory items and add them to menu
:return:
"""
for name, properties in self.game.player1.inventory.items():
obj = properties["item"]
image = self.shadow_text(obj.name, bg=(128, 128, 128))
yield MenuItem(image, obj.name, obj.descri... | def initialize_items(self):
"""Get all player inventory items and add them to menu
:return:
"""
for name, properties in self.game.player1.inventory.items():
obj = properties["item"]
image = self.shadow_text(obj.name_trans, bg=(128, 128, 128))
yield MenuItem(image, obj.name_trans... | https://github.com/Tuxemon/Tuxemon/issues/160 | Traceback (most recent call last):
File "./tuxemon.py", line 60, in <module>
main()
File "/tmp/Tuxemon/tuxemon/core/main.py", line 109, in main
control.main()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 512, in main
self.main_loop()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 573, in main_loop
self.update(t... | KeyError |
def load(self, name, id):
"""Loads and sets this items's attributes from the item.db database. The item is looked up
in the database by name or id.
:param name: The name of the item to look up in the monster.item database.
:param id: The id of the item to look up in the item.db database.
:type nam... | def load(self, name, id):
"""Loads and sets this items's attributes from the item.db database. The item is looked up
in the database by name or id.
:param name: The name of the item to look up in the monster.item database.
:param id: The id of the item to look up in the item.db database.
:type nam... | https://github.com/Tuxemon/Tuxemon/issues/160 | Traceback (most recent call last):
File "./tuxemon.py", line 60, in <module>
main()
File "/tmp/Tuxemon/tuxemon/core/main.py", line 109, in main
control.main()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 512, in main
self.main_loop()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 573, in main_loop
self.update(t... | KeyError |
def calc_bounding_rect(self):
"""A rect object that contains all sprites of this group"""
rect = super(RelativeGroup, self).calc_bounding_rect()
# return self.calc_absolute_rect(rect)
return rect
| def calc_bounding_rect(self):
"""A rect object that contains all sprites of this group"""
rect = super(RelativeGroup, self).calc_bounding_rect()
for sprite in self.sprites():
print(sprite, sprite.rect)
# return self.calc_absolute_rect(rect)
return rect
| https://github.com/Tuxemon/Tuxemon/issues/160 | Traceback (most recent call last):
File "./tuxemon.py", line 60, in <module>
main()
File "/tmp/Tuxemon/tuxemon/core/main.py", line 109, in main
control.main()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 512, in main
self.main_loop()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 573, in main_loop
self.update(t... | KeyError |
def load(self, name, id):
"""Loads and sets this technique's attributes from the technique
database. The technique is looked up in the database by name or id.
:param name: The name of the technique to look up in the monster
database.
:param id: The id of the technique to look up in the monster ... | def load(self, name, id):
"""Loads and sets this technique's attributes from the technique
database. The technique is looked up in the database by name or id.
:param name: The name of the technique to look up in the monster
database.
:param id: The id of the technique to look up in the monster ... | https://github.com/Tuxemon/Tuxemon/issues/160 | Traceback (most recent call last):
File "./tuxemon.py", line 60, in <module>
main()
File "/tmp/Tuxemon/tuxemon/core/main.py", line 109, in main
control.main()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 512, in main
self.main_loop()
File "/tmp/Tuxemon/tuxemon/core/control.py", line 573, in main_loop
self.update(t... | KeyError |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.