Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1# -*- coding: utf-8 -*- 

2 

3# spechomo, Spectral homogenization of multispectral satellite data 

4# 

5# Copyright (C) 2019-2021 

6# - Daniel Scheffler (GFZ Potsdam, daniel.scheffler@gfz-potsdam.de) 

7# - Helmholtz Centre Potsdam - GFZ German Research Centre for Geosciences Potsdam, 

8# Germany (https://www.gfz-potsdam.de/) 

9# 

10# This software was developed within the context of the GeoMultiSens project funded 

11# by the German Federal Ministry of Education and Research 

12# (project grant code: 01 IS 14 010 A-C). 

13# 

14# Licensed under the Apache License, Version 2.0 (the "License"); 

15# you may not use this file except in compliance with the License. 

16# You may obtain a copy of the License at 

17# 

18# http://www.apache.org/licenses/LICENSE-2.0 

19# 

20# Please note the following exception: `spechomo` depends on tqdm, which is 

21# distributed under the Mozilla Public Licence (MPL) v2.0 except for the files 

22# "tqdm/_tqdm.py", "setup.py", "README.rst", "MANIFEST.in" and ".gitignore". 

23# Details can be found here: https://github.com/tqdm/tqdm/blob/master/LICENCE. 

24# 

25# Unless required by applicable law or agreed to in writing, software 

26# distributed under the License is distributed on an "AS IS" BASIS, 

27# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 

28# See the License for the specific language governing permissions and 

29# limitations under the License. 

30 

31 

32class ClassifierNotAvailableError(RuntimeError): 

33 def __init__(self, spechomo_method, src_sat, src_sen, src_LBA, tgt_sat, tgt_sen, tgt_LBA, n_clusters): 

34 self.spechomo_method = spechomo_method 

35 self.src_sat = src_sat 

36 self.src_sen = src_sen 

37 self.src_LBA = src_LBA 

38 self.tgt_sat = tgt_sat 

39 self.tgt_sen = tgt_sen 

40 self.tgt_LBA = tgt_LBA 

41 self.n_clusters = n_clusters 

42 RuntimeError.__init__(self) 

43 

44 def __str__(self): 

45 return 'No %s classifier available for predicting %s %s %s from %s %s %s (%d clusters).'\ 

46 % (self.spechomo_method, self.tgt_sat, self.tgt_sen, self.tgt_LBA, 

47 self.src_sat, self.src_sen, self.src_LBA, self.n_clusters)