Importing CSV Files
Updated: Jan 4, 2022
"CSV" files are text files where each line is a row of data with fields separated by commas or tabs. Assisi Forest can import data from CVS files using its Import tool.
Here is a sample CSV file of measured trees:
The fields in the CSV file are described using an "INI" file. Below is the INI file for the above CSV file:
The name and data type of each column in the CSV file is described in the INI file using the format shown above. The column names and types must match the spelling and data types of fields in an Assisi database. Custom fields (see below) must have the table name prepended to the column name.
INI Data Types
The data types in the INI file are defined as:
Char - Any length string.
Bit - Boolean fields.
Long - Integer fields of any size.
Date - Date and DateTime fields.
Single - 8 byte floating point numbers (Access 'single', SQL Server 'real').
Double - 8 byte floating point numbers (Access 'double', SQL Server 'float').
Required Fields and Defaults
A CSV file must have certain fields so that Assisi can properly identity each data row. The required fields are minimal and many can be defaulted so that they don't have to be entered while in the field. The defaults are:
The required fields for each Content are:
Stands - None. Both Unit and Stand can be defaulted.
Cruises - None. Unit, Stand and Cruise can be defaulted.
Expansions - Expansion ID.
Plots - Plot ID.
Trees - Plot & Tree ID.
Transects - SubPlot ID. SubPlot defines unique transects.
DWD - Plot & DWD ID.
Cover - Plot & Cover ID.
Samples - Plot & Sample ID.
Sub Plot Fields
Every plot in Assisi is really a nested plot where many data types can be sampled using different designs. The different designs that are sampled at each plot are called "Sub Plots".
Sub plot is required for compilation but not when importing. Data can be imported with or without a sub plot. However, sub plots will still have to be set when data is compiled.
Each item sampled (a tree, a transect, a vegetation record, etc.) must identify the sub plot it was sampled on. For example, if your cruise design has a BAF sub plot for large trees and a fixed radius sub plot for regeneration, each tree must be assigned to either the BAF or the fixed radius sub plot.
Import can assign sub plots itself if the sub plots defined for the cruise design include min and max DBH criteria. The "Update Sub Plots Based on Cruise Design" button will attempt to re-assign sub plots based on the criteria. Assisi can usually guess the correct sub plot when criteria are set however, if the Cruise Design does not specify criteria or if the criteria overlap with other sub plots, then Import will not be able to assign a sub plot.
Custom fields are fields that have been added to Assisi's standard list of tables and fields. Data for custom fields can be imported using CSV files as well.
Describe custom fields in INI files by prepending the table name of the custom field to the start of the field name. For example, a custom field called "MyCustomField" in the table "Trees" would be described as: Col9="TreesMyCustomField" Char.
The Import tool looks for custom fields that match the Content being imported. For example, because the above custom field has "Trees" prepended to it, the CSV file must be opened as Content = "Trees". Here is a screen shot of the CSV with a custom field opened in Import.