Topics

TypeError: open() takes at most 8 arguments (14 given) when writing


ashnair0007@...
 

Hi guys,

I'm trying to write to an array to a tiff as follows:

profile.update(driver="GTiff", count=1)
with open('res.tiff', 'w', **profile) as dst:
dst.write(thresh.astype(rio.uint8), 1)

However, I'm encountering the following error:
TypeError: open() takes at most 8 arguments (14 given)

This is my profile:

{'driver': 'JPEG', 'dtype': 'uint8', 'nodata': None, 'width': 1000, 'height': 1000, 'count': 3, 'crs': CRS.from_wkt('PROJCS["unknown",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["latitude_of_center",-90],PARAMETER["longitude_of_center",0],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1],AXIS["Easting",NORTH],AXIS["Northing",NORTH]]'), 'transform': Affine(25.610955512797485, 0.0, -2357528.4841969036,
       0.0, -25.610955512797485, 1593925.6448274788), 'tiled': False, 'compress': 'jpeg', 'interleave': 'pixel', 'photometric': 'ycbcr'}

I'm unsure what fields must be removed for open() to work.


Alan Snow
 

I think the issue is that you need to use `rasterio.open`.


ashnair0007@...
 

Yes. That was exactly it. My bad. Thanks.