I am trying to create a space time cube for 10 years from 1870-1880, but I get this Error:

ValueError: year=1873 is before 1900; the datetime strftime() methods require year >= 1900

I tried to work around with .isoformat (which allows strftime() to handle years greater than 1900), but I got yet another Error.

import arcpy
import datetime
arcpy.env.overwriteOutput = True
arcpy.env.workspace = r"C:\Users\rin\ArcGIS\Default.gdb"

points_input = r'C:\Users\rin\Analysis\space_time_cube\Export_Output.shp'
outpath = r'C:\Users\rinfall\Analysis\space_time_cube\washington_cube.nc'

with arcpy.da.SearchCursor(points_input, ['YEARCODE']) as cursor:
    for x in cursor:
        arcpy.CreateSpaceTimeCube_stpm(points_input, outpath, x[0].date().isoformat, "FISHNET_GRID")

Is there anther way to work around with the year issue?

  • 1
    That looks like a low-level Python error. The POSIX datetime structure used internally by Esri doesn't have a 1900 limitation, but if you can't pass in the object, that might be a hard limit. This is certainly something to take to Esri Tech Support. – Vince Sep 22 '17 at 2:14

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.