This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
Author: Fraser McCrossan | |
Tested on G9, should work on most cameras. | |
Modified by Nick Santos for use in synchronizing two cameras. | |
Designed for A495 and adapted from previous code - Works so long as the interval time is set to a number that divides evenly into 60 and that is longer than the time it. Creative Commons Attribution licensed - please cite both authors above. | |
An accurate intervalometer script, with pre-focus and screen power off options. | |
Features: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def copy_field_attributes_to_new_field(source_table, current_field, target_table, target_field): | |
""" | |
Copies the attributes of a field (data type, precision, scale, length, isNullable, required, domain) to a new field on a new table. | |
Correctly maps data types pulled from Describe tool to data types needed for field creation. | |
:param source_table: The table containing the existing field | |
:param current_field: The field to copy attributes from | |
:param target_table: The field to create the new field on | |
:param target_field: The name of the new field to create with the attributes from current_field | |
:return: | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def permanent_join(target_table, target_attribute, source_table, source_attribute, attribute_to_attach, rename_attribute=None): | |
""" | |
Provides a way to permanently attach a field to another table, as in a one to one join, but without performing a | |
join then exporting a new dataset. Operates in place by creating a new field on the existing dataset. | |
Or, in other words, Attaches a field to a dataset in place in ArcGIS - instead of the alternative of doing an | |
actual join and then saving out a new dataset. Only works as a one to one join. | |
:param target_table: the table to attach the joined attribute to | |
:param target_attribute: the attribute in the table to base the join on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
First, this was written back when I wrote Python a bit more like C - I know it needs some work! But for setting delimiters, | |
you can do the following: | |
my_dataset = data_file(r"path_to_data") | |
my_dataset.delim_open # gives you the opening delimeter | |
my_dataset.delim_close # gives you the closing delimeter | |
""" | |
import logging |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This script should cause error 999998 on ArcGIS 10.5 and ArcGIS Pro 1.4 if the mask environment is set using an invalid mask | |
and should succeed if no mask is set | |
""" | |
import tempfile | |
import numpy | |
import arcpy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Allows you to pass in a list of environments to get the values of, then pass it back in to reset. | |
Usage: | |
original_envs = store_environments(["workspace","mask"]) # gives back a dict with current environment values for workspace and mask | |
arcpy.env.workspace = my_workspace | |
arcpy.env.mask = my_raster | |
# some more code here to do some work with those environments | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from time import sleep | |
from csv import DictWriter, writer | |
import re | |
from habanero import Crossref # CrossRef API access | |
HABANERO_USERNAME = "" # provide an email address so they can contact you if your script misbehaves | |
ISSN = "" # ISSN of the journal to dump data for | |
BASE_FOLDER = os.path.dirname(os.path.abspath(__file__)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Calls the full pipeline needed to get a PDF with BibTex working | |
# pdfLaTeX->BibTeX->pdfLaTeX->pdfLaTeX | |
# | |
# Designed for use as a called script from TeXworks in the TeXLive distribution, but | |
# easily adapted for other workflows | |
# Make sure to set texlive_folder below! | |
# Adapted from https://tex.stackexchange.com/a/308727 | |
import os | |
import sys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import amaptor | |
base_folder = os.path.split(os.path.abspath(__file__))[0] | |
def make_project(item, base_folder=base_folder, skip_items=()): | |
""" | |
Makes the .mxd in item into an ArcGIS Pro project in the same folder with the same name | |
:param item: a full path to an ArcMap Document |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ProductionVMName = "DAP_Production" | |
$StagingVMName = "DAP_Staging" | |
$ExportFolder = "C:/HyperVExports" # I created a folder that removed all permissions for users - could add anyone with hyper-v permissions to a group with read/write here, along with System | |
$ExportToFolder = "$ExportFolder/$ProductionVMName/" | |
$ImportToFolder = "$ExportFolder/$StagingVMName/" | |
# caution, deletes existing exports in the next block. The try/catch doesn't work as intended. It was supposed to abandon it if it can't find the staging VMs, but proceeds through each step. Needs some work there. | |
try{ | |
Get-VM -Name $StagingVMName # (not true, but this was the design): this will throw an exception if it doesn't exist, so the following lines in this block won't run | |
Stop-VM -Name $StagingVMName -TurnOff # Turn of the VM forcibly - it's fine if it gets corrupted - we're about to destroy it |
OlderNewer