d-wasserman / arc-time

A collection of ArcGIS geoprocessing tools and utilities to work with geospatial-temporal data.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Distribution Summary

A collection of ArcGIS geoprocessing tools and utilities to work with geospatial-temporal data.

ArcTime TBX

Truncate Datetime

This tool is a simple geoprocessing scripting tool intended to assist with temporal data preparation by truncating the date time object to set constants for better grouping and aggregation for time space cubes and other analysis methods. If the set times are -1, the current date and time will be used for that parameter.

Usage

Use this script with an input date field to create a formated time string based on your needs.

Parameter Explanation Data Type
Input_Feature_Class Dialog Reference

Is the input feature class or table for which a new time field will be added.

___________________

Python Reference
Feature Layer
Date_Time_Field Dialog Reference

This is the ArcGIS date field that will be used to construct the datetime objects used in the created Pandas data frame. Years allowed by the tool will dependon python version. For example 2.7 cannot handle years before 1900.

___________________

Python Reference

Generally the fields are selected from the feature class to be converted into a numpy array, then into a pandas data frame, then back to structured numpy array to be joined based on the object ID. This tool assumes there is an object ID to use to join to.

Field
New_Field_Name Dialog Reference

This is the name of the new text field that will be added to the feature class and then populated by a new time string based on the format string. If the name already exists, then a unique one will be added.

There is no python reference for this parameter.

String
Set_Year Dialog Reference

This is the year you want to set all the datetimes to for the new field. If it is -1, it will use the current time period determined by the datetime object.

There is no python reference for this parameter.

Long
Set_Month Dialog Reference

This is the month you want to set all the datetimes to for the new field. If it is -1, it will use the current time period determined by the datetime object.

There is no python reference for this parameter.

Long
Set_Day Dialog Reference

This is the day you want to set all the datetimes to for the new field. If it is -1, it will use the current time period determined by the datetime object.

There is no python reference for this parameter.

Long
Set_Hour Dialog Reference

This is the hour you want to set all the datetimes to for the new field. If it is -1, it will use the current time period determined by the datetime object.

There is no python reference for this parameter.

Long
Set_Minute Dialog Reference

This is the minute you want to set all the datetimes to for the new field. If it is -1, it will use the current time period determined by the datetime object.

There is no python reference for this parameter.

Long
Set_Second Dialog Reference

This is the second you want to set all the datetimes to for the new field. If it is -1, it will use the current time period determined by the datetime object.

There is no python reference for this parameter.

Long

Add Time String Field

This tool is a simple strf time script intended to add a new text field with a formatted string based on the format string input into it. This tool uses pandas to convert and add the new unique field using the arcpy.da extend table function.

Usage

This tool is intended to provide an easy way to created formatted string fields using the strftime function.

Parameters

Parameter Explanation Data Type
Input_Feature_Class Dialog Reference

Is the input feature class or table for which a new time field will be added.

___________________

Python Reference
Feature Layer
Date_Time_Field Dialog Reference

This is the ArcGIS date field that will be used to construct the datetime objects used in the created Pandas data frame.

___________________

Python Reference

Generally the fields are selected from the feature class to be converted into a numpy array, then into a pandas data frame, then back to structured numpy array to be joined based on the object ID. This tool assumes there is an object ID to use to join to.

Field
New_Field_Name Dialog Reference

This is the name of the new text field that will be added to the feature class and then populated by a new time string based on the format string. If the name already exists, then a unique one will be added.

There is no python reference for this parameter.

String
Format_String Dialog Reference

The format string determines the output time format. Do not add quotes.

Check the documentation link here for details.

Directive Meaning Notes

%a Localeӳ abbreviated weekday name.

%A Localeӳ full weekday name.

%b Localeӳ abbreviated month name.

%B Localeӳ full month name.

%c Localeӳ appropriate date and time representation.

%d Day of the month as a decimal number [01,31].

%H Hour (24-hour clock) as a decimal number [00,23].

%I Hour (12-hour clock) as a decimal number [01,12].

%j Day of the year as a decimal number [001,366].

%m Month as a decimal number [01,12].

%M Minute as a decimal number [00,59].

%p Localeӳ equivalent of either AM or PM. (1)

%S Second as a decimal number [00,61]. (2)

%U Week number of the year (Sunday as the first day of the week) as a decimal number [00,53]. All days in a new year preceding the first Sunday are considered to be in week 0. (3)

%w Weekday as a decimal number [0(Sunday),6].

%W Week number of the year (Monday as the first day of the week) as a decimal number [00,53]. All days in a new year preceding the first Monday are considered to be in week 0. (3)

%x Localeӳ appropriate date representation.

%X Localeӳ appropriate time representation.

%y Year without century as a decimal number [00,99].

%Y Year with century as a decimal number.

%Z Time zone name (no characters if no time zone exists).

%% A literal '%' character.

Notes:

When used with the strptime() function, the %p directive only affects the output hour field if the %I directive is used to parse the hour.

The range really is 0 to 61; this accounts for leap seconds and the (very rare) double leap seconds.

When used with the strptime() function, %U and %W are only used in calculations when the day of the week and the year are specified.

Taken from: http://strftime.org/

There is no python reference for this parameter.

String

Round DateTime

This tool is a simple geoprocessing scripting tool intended to assist with temporal data preparation by rounding the datetime field to the nearest unit placed in the respective time settings.

Usage

If the round times are -1, the current date and time will be used for that parameter. The smallest unit to not have a -1 will be used as an indicator that the other units below it should be set to 0.

Parameters

Parameter Explanation Data Type
Input_Feature_Class Dialog Reference

Is the input feature class or table for which a new time field will be added.

___________________

Python Reference
Feature Layer
Date_Time_Field Dialog Reference

This is the ArcGIS date field that will be used to construct the datetime objects used in the created Pandas data frame. Years allowed by the tool will dependon python version. For example 2.7 cannot handle years before 1900.

___________________

Python Reference

Generally the fields are selected from the feature class to be converted into a numpy array, then into a pandas data frame, then back to structured numpy array to be joined based on the object ID. This tool assumes there is an object ID to use to join to.

Field
New_Field_Name Dialog Reference

This is the name of the new text field that will be added to the feature class and then populated by a new rounded datetime. If the name already exists, then a unique one will be added.

There is no python reference for this parameter.

String
Rounding_Year Dialog Reference

This is the number that the current unit will be rounded to. If the round times are -1, the current date and time will be used for that parameter. The smallest unit to not have a -1 will be used as an indicator that the other units below it should be set to 0.

  • Examples: If Hour =2, the date times will be rounded every 2 hour period, and minutes and seconds would be set to zero.

  • Examples: If Minute= 15, the date times will be rounded to every 15 minute period, and seconds would be set zero.

There is no python reference for this parameter.

Long
Rounding_Month Dialog Reference

This is the number that the current unit will be rounded to. If the round times are -1, the current date and time will be used for that parameter. The smallest unit to not have a -1 will be used as an indicator that the other units below it should be set to 0.

  • Examples: If Hour =2, the date times will be rounded every 2 hour period, and minutes and seconds would be set to zero.

  • Examples: If Minute= 15, the date times will be rounded to every 15 minute period, and seconds would be set zero.

There is no python reference for this parameter.

Long
Rounding_Day Dialog Reference

This is the number that the current unit will be rounded to. If the round times are -1, the current date and time will be used for that parameter. The smallest unit to not have a -1 will be used as an indicator that the other units below it should be set to 0.

  • Examples: If Hour =2, the date times will be rounded every 2 hour period, and minutes and seconds would be set to zero.

  • Examples: If Minute= 15, the date times will be rounded to every 15 minute period, and seconds would be set zero.

There is no python reference for this parameter.

Long
Rounding_Hour Dialog Reference

This is the number that the current unit will be rounded to. If the round times are -1, the current date and time will be used for that parameter. The smallest unit to not have a -1 will be used as an indicator that the other units below it should be set to 0.

  • Examples: If Hour =2, the date times will be rounded every 2 hour period, and minutes and seconds would be set to zero.

  • Examples: If Minute= 15, the date times will be rounded to every 15 minute period, and seconds would be set zero.

There is no python reference for this parameter.

Long
Rounding_Minute Dialog Reference

This is the number that the current unit will be rounded to. If the round times are -1, the current date and time will be used for that parameter. The smallest unit to not have a -1 will be used as an indicator that the other units below it should be set to 0.

  • Examples: If Hour =2, the date times will be rounded every 2 hour period, and minutes and seconds would be set to zero.

  • Examples: If Minute= 15, the date times will be rounded to every 15 minute period, and seconds would be set zero.

There is no python reference for this parameter.

Long
Rounding_Second Dialog Reference

This is the number that the current unit will be rounded to. If the round times are -1, the current date and time will be used for that parameter. The smallest unit to not have a -1 will be used as an indicator that the other units below it should be set to 0. *Microseconds will be set to 0 by this script, you can edit it further if you really want to round microsecond times.

  • Examples: If Hour =2, the date times will be rounded every 2 hour period, and minutes and seconds would be set to zero.

  • Examples: If Minute= 15, the date times will be rounded to every 15 minute period, and seconds would be set zero.

There is no python reference for this parameter.

Long

Temporal Split

This tool is a simple geoprocessing scripting tool intended to split a feature class based on a time field or a start or end time into multiple feature classes based on a start or end time. The bins are based on a time interval and a predetermined start time.

Usage

This tool is used to split a feature class based on time interval. After being split, iterators in model builder can be used to do aggregation, kernel densities, and other geoprocessing operations.

Parameters

Parameter Explanation Data Type
Input_Feature_Class Dialog Reference

Is the input feature class or table that will be split based on a datetime field.

___________________

Python Reference

Uses Python deltatime and datetime libraries.

Feature Layer
Output_Workspace Dialog Reference

The output workspace such as a file geodatabase, that will receive the new output feature classes split based on a date field.

There is no python reference for this parameter.

Workspace
Start_Time_or_Single_Time_Field Dialog Reference

Either the single datetime field or a start field that will be used with an endtime to extract all datetime values that are within the range of the created timebins.

There is no python reference for this parameter.

Field
End_Time (Optional) Dialog Reference

This optional field is only used with specific datasets that have an end time field. If there is not end time field chosen, only start time will be used to both construct the time ranges and the final end time.

___________________

Python Reference

if FieldExist(inFeatureClass, end_time) and end_time: arcPrint("Using start and end time to grab feature classes whose bins occur within an events " "start or end time.") end_time_min, end_time_max = get_min_max_from_field(inFeatureClass, end_time) start_time_field = start_time end_time_field = end_time start_time_range = start_time_min end_time_range = end_time_maxelse: arcPrint("Using only first datetime start field to construct time bin ranges.") start_time_field = start_time end_time_field = start_time start_time_range = start_time_min end_time_range = start_time_max

Field
Time_Interval Dialog Reference

The number of seconds, minutes, hours, days, weeks, or years that will represent a single time step. Examples of valid entries for this parameter are 1 Day, 12 Hours, 30 Seconds, or 1 Minute. Units greater than weeks will break the tool, if you need years, put it into day or week equivalents.

___________________

Python Reference

@arcToolReportdef construct_time_bin_ranges(first_time, last_time, time_delta): temporal_counter = first_time total_time_range = last_time - first_time bin_count = int(np.ceil(total_time_range.total_seconds() / time_delta.total_seconds())) nested_time_bin_pairs = [] for bin in range(bin_count): start_time = temporal_counter end_time = temporal_counter + time_delta nested_time_bin_pairs.append([start_time, end_time]) temporal_counter = end_time return nested_time_bin_pairs

Time unit
Bin_Start (Optional) Dialog Reference

This is the time you want the binning process to start from. If you place a datetime here, it will replace the minimum time value of the start time field you selected as the bin start time.

For example selecting 1990/1/1 12:00:00 AM would start the binning interval at that time period rather than a minimum calculated by the script.

There is no python reference for this parameter.

Date
Compact_Workspace Dialog Reference

Optionally will compact the workspace after the tool runs. Will skip on a workspace you can't compact.

There is no python reference for this parameter.

Boolean

Temporal Kernel Density

This geogrocessing script is intended to do batch kernel densities on a feature class based on tool determined time bins. Each bin will be a kernel density raster in a final moasic dataset.

Usage

This tool is used to visualize temporal data by splitting a feature class into time bins with make feature layer and then running a kernel density tool on each time bin. After this tool is run mosaic datasets can be used to create animations of change over time.

Parameters

Parameter Explanation Data Type
Input_Feature_Class Dialog Reference

Is the input feature class or table that will be split based on a datetime field.

___________________

Python Reference

Uses Python deltatime and datetime libraries.

Feature Class
Output_Workspace Dialog Reference

The output workspace such as a file geodatabase, that will receive the new moasic dataset of kernel densities split based on a date field. It is best to use a brand new FGDB.

There is no python reference for this parameter.

Workspace
Output_Time_Table_Name Dialog Reference

This is the name of the output table that is built to create the temporal relationship between the output kernel densities and the mosaic footprint.

There is no python reference for this parameter.

String
Start_Time_or_Single_Time_Field Dialog Reference

Either the single datetime field or a start field that will be used with an endtime to extract all datetime values that are within the range of the created timebins.

There is no python reference for this parameter.

Field
End_Time (Optional) Dialog Reference

This optional field is only used with specific datasets that have an end time field. If there is not end time field chosen, only start time will be used to both construct the time ranges and the final end time.

___________________

Python Reference

if FieldExist(inFeatureClass, end_time) and end_time:arcPrint("Using start and end time to grab feature classes whose bins occur within an events ""start or end time.")end_time_min, end_time_max = get_min_max_from_field(inFeatureClass, end_time)start_time_field = start_timeend_time_field = end_timestart_time_range = start_time_minend_time_range = end_time_maxelse:arcPrint("Using only first datetime start field to construct time bin ranges.")start_time_field = start_timeend_time_field = start_timestart_time_range = start_time_minend_time_range = start_time_max

Field
Time_Interval Dialog Reference

The number of seconds, minutes, hours, days, weeks, or years that will represent a single time step. Examples of valid entries for this parameter are 1 Day, 12 Hours, 30 Seconds, or 1 Minute. Units greater than weeks will break the tool, if you need years, put it into day or week equivalents.

___________________

Python Reference

@arcToolReportdef construct_time_bin_ranges(first_time, last_time, time_delta):temporal_counter = first_timetotal_time_range = last_time - first_timebin_count = int(np.ceil(total_time_range.total_seconds() / time_delta.total_seconds()))nested_time_bin_pairs = []for bin in range(bin_count):start_time = temporal_counterend_time = temporal_counter + time_deltanested_time_bin_pairs.append([start_time, end_time])temporal_counter = end_timereturn nested_time_bin_pairs

Time unit
Bin_Start (Optional) Dialog Reference

This is the time you want the binning process to start from. If you place a datetime here, it will replace the minimum time value of the start time field you selected as the bin start time.

For example selecting 1990/1/1 12:00:00 AM would start the binning interval at that time period rather than a minimum calculated by the script.

There is no python reference for this parameter.

Date
Population_Field (Optional) Dialog Reference

Values in the population field may be integer or floating point.

The options and default behaviors for the field are listed below.

Use None if no item or special value will be used and each feature will be counted once.

You can use Shape if input features contains Z.

Otherwise, the default field is POPULATION. The following conditions may also apply.

If there is no POPULATION field, but there is a POPULATIONxxxx field, this is used by default. The xxxx can be any valid character, such as POPULATION6, POPULATION1974, or POPULATIONROADTYPE.

If there is no POPULATION field or POPULATIONxxxx field, but there is a POP field, this is used by default.

If there is no POPULATION field, POPULATIONxxxx field, or POP field, but there is a POPxxxx field, this is used by default.

If there is no POPULATION field, POPULATIONxxxx field, POP field, or POPxxxx field, NONE is used by default.

There is no python reference for this parameter.

Field
Cell_Size Dialog Reference

The cell size for the output raster dataset.

This is the value in the environment if specifically set. If the environment is not set, then cell size is the shorter of the width or height of the output extent in the output spatial reference, divided by 250.

There is no python reference for this parameter.

Long
Search_Radius Dialog Reference

The search radius within which to calculate density. Units are based on the linear unit of the projection of the output spatial reference.

For example, if the units are in metersشo include all features within a one-mile neighborhoodسet the search radius equal to 1609.344 (1 mile = 1609.344 meters).

There is no python reference for this parameter.

Double
Area_Scale_Unit_Factor Dialog Reference

The desired area units of the output density values.

A default unit is selected based on the linear unit of the output spatial reference. You can change this to the appropriate unit if you wish to convert the density output. Values for line density convert the units of both length and area.

If no output spatial reference is specified, the output spatial reference will be the same as the input feature class. The default output density units is determined by the linear units of the output spatial reference as follows. If the output linear units are meters, the output area density units will be set to SQUARE_KILOMETERS, outputting square kilometers for point features or kilometers per square kilometers for polyline features. If the output linear units are feet, the output area density units will be set to SQUARE_MILES.

If the output units is anything other than feet or meters, the output area density units will be set to SQUARE_MAP_UNITS. That is, the output density units will be the square of the linear units of the output spatial reference. For example, if the output linear units is centimeters, the output area density units will be SQUARE_MAP_UNITS, which would result in square centimeters. If the output linear units is kilometers, the output area density units will be SQUARE_MAP_UNITS, which would result in square kilometers.

The available options and their corresponding output density units are the following:

SQUARE_MAP_UNITS נFor the square of the linear units of the output spatial reference.

SQUARE_MILES נFor miles (U.S.).

SQUARE_KILOMETERS נFor kilometers.

ACRES ؆or acres (U.S.).

HECTARES ؆or hectares.

SQUARE_YARDS ؆or yards (U.S.).

SQUARE_FEET ؆or feet (U.S.).

SQUARE_INCHES נFor inches (U.S.).

SQUARE_METERS ؆or meters.

SQUARE_CENTIMETERS נFor centimeters.

SQUARE_MILLIMETERS נFor millimeters.

There is no python reference for this parameter.

String
Out_Cell_Values Dialog Reference

Determines what the values in the output raster represent.

DENSITIES ؔhe output values represent the predicted density value. This is the default.

EXPECTED_COUNTS ؔhe output values represent the predicted amount of the phenomenon within each cell.Since the cell value is linked to the specified cell size, the resulting raster cannot be resampled to a different cell size and still represent the amount of the phenomenon.

There is no python reference for this parameter.

String
Compact_Workspace Dialog Reference

Optionally will compact the workspace after the tool runs. Will skip on a workspace you can't compact.

There is no python reference for this parameter.

Boolean

About

A collection of ArcGIS geoprocessing tools and utilities to work with geospatial-temporal data.

License:Apache License 2.0


Languages

Language:Python 100.0%