I am using arcpy to reproject a multidimensional raster, and I extracted the following snippet by running the tool in ArcGIS pro. This is the snippet:

arcpy.management.ProjectRaster(input_file_path, output_file_path, "PROJCS['North_Pole_Lambert_Azimuthal_Equal_Area',GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Lambert_Azimuthal_Equal_Area'],PARAMETER['False_Easting',0.0],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',0.0],PARAMETER['Latitude_Of_Origin',90.0],UNIT['Meter',1.0]]", "BILINEAR", "24966.9977186652 24966.9977186651", None, None, "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]", "NO_VERTICAL")

In this case the output resolution is 24966.9977186651 meters which is represented by "24966.9977186652 24966.9977186651" in the snippet. I want to use arcpy to change the resolution based on an object such as:

out_res = 3000

I tried this:

   arcpy.management.ProjectRaster(in_path, out_path, "PROJCS['North_Pole_Lambert_Azimuthal_Equal_Area',GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Lambert_Azimuthal_Equal_Area'],PARAMETER['False_Easting',0.0],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',0.0],PARAMETER['Latitude_Of_Origin',90.0],UNIT['Meter',1.0]]", "BILINEAR", str(out_res), None, None, "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]", "NO_VERTICAL")

but this is not valid and fails with:

ExecuteError: ERROR 999999: Something unexpected caused the tool to fail. Contact Esri Technical Support (http://esriurl.com/support) to Report a Bug, and refer to the error help for potential solutions or workarounds.
Invalid cache raster dataset (CRF) with invalid/inconsistent definition.
Failed to execute (ProjectRaster).
  • in_path is the location of the multidimensional input raster and out_path is where to store the reprojected .crf file. – Stefano Potter Apr 28 at 17:23
  • It is just the pathways on my hard drive is all so in_path = r"C:\input_raster.tif"and out_path = r"C:\output_raster.tif" or similar. I can't type it in physically I need to use the object out_res in the script as the number will be changing depending on the resolution of in_path – Stefano Potter Apr 28 at 17:26
  • It has nothing to do with the pathways, it has the r, it has to do with defining the resolution. – Stefano Potter Apr 28 at 17:27
  • I also tried str(out_res), with the same error – Stefano Potter Apr 28 at 17:29
  • out_coor_system is taken directly from the geoprocessing toolbox python snippet, the first snipped I posted works just fine the exact same way. The only difference between what works fine in the first one and what does not in the second one is how the resolution is defined – Stefano Potter Apr 28 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.