Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def circle1():
- path = Path(path_top)
- ye = path_refer[:4]
- mo = path_refer[4:6]
- da = path_refer[6:8]
- if ye.startswith("*") and ye != "***":
- ye = "*"
- mo = path_refer[1:3]
- da = path_refer[3:5]
- elif mo.startswith("*") and mo != "**":
- mo = "*"
- da = path_refer[5:7]
- elif path_refer == "***":
- ye = "*"
- mo = "*"
- da = "*"
- arr = numpy.zeros((rows, columns), dtype=np_band_type)
- for s in path.glob('{}/{}/{}'.format(ye, mo, da)):
- if os.path.isdir(s):
- listdir = os.listdir(s)
- os.chdir(os.path.join(path_top, s))
- for a_img in listdir:
- if a_img.startswith(refer[:5]) and int(a_img[5:9]) >= year_beg and int(a_img[5:9]) <= year_end:
- for b_img in listdir:
- if b_img.startswith(refer[:5]) and int(b_img[9:11]) >= month_beg and int(b_img[9:11]) <= month_end:
- for c_img in listdir:
- if c_img.startswith(refer[:5]) and int(c_img[11:13]) >= day_beg and int(c_img[11:13]) <= day_end:
- for d_img in listdir:
- if d_img.startswith(refer[:5]) and int(d_img[-8:-6]) >= hour_beg and int(d_img[-8:-6]) <= hour_end:
- ds = gdal.Open(str(d_img), gdal.GA_ReadOnly)
- band = ds.GetRasterBand(b_num_wor)
- b_arr = band.ReadAsArray(0, 0, columns, rows).astype(np_band_type)
- for r in range(rows):
- for c in range(columns):
- if param_type == "lt":
- if param_x < b_arr[r,c]:
- arr[r,c] += 1
- elif param_type == "let":
- if param_x > b_arr[r,c]:
- arr[r,c] += 1
- elif param_type == "dr":
- if param_x < b_arr[r,c] < param_y:
- arr[r,c] += 1
- return arr
- measure_source = gdal.Open(MyReferenceFile)
- v_band = measure_source.GetRasterBand(b_num_wor)
- gdal_band_type = v_band.DataType
- np_band_type = gdal_array.GDALTypeCodeToNumericTypeCode(gdal_band_type)
- line 175, in circle1
- band = ds.GetRasterBand(b_num_wor)
- AttributeError: 'NoneType' object has no attribute 'GetRasterBand'
Add Comment
Please, Sign In to add comment