@@ -674,7 +674,7 @@ def _shape_cutter(shape, **opt_args):
674674 stdout .write ('\n ' )
675675 if check_enclaves == 1 and not enclave_paths :
676676 excl_coords = []
677- LOGGER .debug ('Removing enclaves...' )
677+ # LOGGER.debug('Removing enclaves...')
678678 for _ , val in enumerate (enclave_paths ):
679679 temp_excl_points = _mask_from_path (val , resolution )
680680 if not temp_excl_points is None :
@@ -683,7 +683,7 @@ def _shape_cutter(shape, **opt_args):
683683 excl_coords = set (tuple (row ) for row in excl_coords )
684684 incl_coords = [point for point in incl_coords if point not \
685685 in excl_coords ]
686- LOGGER .debug ('Successfully isolated coordinates from shape' )
686+ # LOGGER.debug('Successfully isolated coordinates from shape')
687687 total_bbox = np .array ((min ([x [0 ] for x in shape .points ]),\
688688 min ([x [1 ] for x in shape .points ]), max (x [0 ] for x in shape .points ),\
689689 max (x [1 ] for x in shape .points )))
@@ -708,15 +708,15 @@ def _shape_cutter(shape, **opt_args):
708708 _plot_paths_to_plot (enclave_paths , enclave_format )
709709 if point_format == 1 :
710710 if return_mask == 1 :
711- LOGGER .debug ('Cutting the shape took %s s' ,\
712- str (round (time .time ()- curr_time , 2 )))
711+ # LOGGER.debug('Cutting the shape took %s s',\
712+ # str(round(time.time()-curr_time, 2)))
713713 return zip (lon , lat ), enclave_paths , mask
714- LOGGER .debug ('Cutting the shape took %s s' ,\
715- str (round (time .time ()- curr_time , 2 )))
714+ # LOGGER.debug('Cutting the shape took %s s',\
715+ # str(round(time.time()-curr_time, 2)))
716716 return incl_coords , enclave_paths
717717
718- LOGGER .debug ('Cutting the shape took %s s' ,\
719- str (round (time .time ()- curr_time , 2 )))
718+ # LOGGER.debug('Cutting the shape took %s s',\
719+ # str(round(time.time()-curr_time, 2)))
720720 if return_mask == 1 :
721721 return lon , lat , enclave_paths , mask
722722 lat = [x [1 ] for x in incl_coords ]
@@ -804,7 +804,7 @@ def _mask_from_shape(check_shape, **opt_args):
804804 of type from package "shapefile".' )
805805 sub_shapes = len (check_shape .parts )
806806 all_coords_shape = [(x , y ) for x , y in check_shape .points ]
807- LOGGER .debug ('Extracting subshapes and detecting enclaves...' )
807+ # LOGGER.debug('Extracting subshapes and detecting enclaves...')
808808 sub_shape_path = []
809809 enclave_paths = []
810810 add2enclave = 0
@@ -1485,12 +1485,11 @@ def read_bm_file(bm_path, filename):
14851485 coordinates can be calculated.
14861486 """
14871487 try :
1488- LOGGER .debug ('Trying to import the file %s.' , os .path .join (bm_path , filename ))
1488+ LOGGER .debug ('Importing %s.' , os .path .join (bm_path , filename ))
14891489 curr_file = gdal .Open (os .path .join (bm_path , filename ))
14901490 band1 = curr_file .GetRasterBand (1 )
14911491 arr1 = band1 .ReadAsArray ()
14921492 del band1
1493- LOGGER .debug ('Reading file completed: %s.' , os .path .join (bm_path , filename ))
14941493 return arr1 , curr_file
14951494 except :
14961495 LOGGER .error ('Failed: Importing %s' , str (curr_file ))
@@ -1563,8 +1562,8 @@ def get_bm(required_files=np.ones(np.count_nonzero(BM_FILENAMES),),\
15631562 arr1 [j ], curr_file = read_bm_file (bm_path ,\
15641563 BM_FILENAMES [num_i * 2 + j ])
15651564 if zoom_factor != 1 :
1566- LOGGER .debug ('Resizing image according to chosen ' \
1567- + 'resolution' )
1565+ # LOGGER.debug('Resizing image according to chosen '\
1566+ # + 'resolution')
15681567 arr1 [j ] = pd .SparseDataFrame (nd .zoom (arr1 [j ], zoom_factor ,\
15691568 order = 1 ))
15701569 else :
@@ -1607,7 +1606,7 @@ def get_bm(required_files=np.ones(np.count_nonzero(BM_FILENAMES),),\
16071606 else :
16081607 nightlight_temp = pd .concat ((nightlight_temp , arr1 ), 1 )
16091608 del arr1
1610- LOGGER .debug ('Reducing to one dimension...' )
1609+ # LOGGER.debug('Reducing to one dimension...')
16111610 nightlight_intensity = pd .SparseArray (nightlight_temp .values \
16121611 .reshape ((- 1 ,), order = 'F' ),\
16131612 dtype = 'float' )
@@ -1684,8 +1683,6 @@ def _bm_bbox_cutter(bm_data, curr_file, bbox, resolution):
16841683 col_max = min (col_max + 1 , ((maxlon_tile - minlon_tile )\
16851684 - (deg_per_pix / 2 ))* (1 / deg_per_pix ))
16861685 bm_data = bm_data [row_min :row_max , col_min :col_max ]
1687- LOGGER .debug ('Cutting the bounding box took %i s.' , \
1688- int (round (time .time ()- start_time )))
16891686 return bm_data
16901687
16911688def _get_box_blackmarble (cut_bbox , ** args ):
@@ -1727,15 +1724,15 @@ def _get_box_blackmarble(cut_bbox, **args):
17271724 # Download necessary files:
17281725 if not np .array_equal (req_sat_files , files_exist ):
17291726 try :
1730- LOGGER .debug ('Attempting to download %s' , str (int (sum (req_sat_files )- sum (files_exist ))))
1727+ LOGGER .debug ('Downloading %s' , str (int (sum (req_sat_files )- sum (files_exist ))))
17311728 nightlight .download_nl_files (req_sat_files , files_exist ,\
17321729 dwnl_path = bm_path , year = 2016 )
17331730 except :
17341731 LOGGER .error ('Could not download missing satellite data files. \
17351732 Operation aborted.' )
17361733 raise
17371734 # Read corresponding files
1738- LOGGER .debug ('Reading and cropping neccessary BM files.' )
1735+ # LOGGER.debug('Reading and cropping neccessary BM files.')
17391736 nightlight_intensity = get_bm (req_sat_files , resolution = resolution ,\
17401737 return_coords = 0 , cut_bbox = cut_bbox ,\
17411738 bm_path = bm_path )[0 ]
0 commit comments