neonutilities.stack_by_table

neonutilities.stack_by_table(filepath, savepath=None, save_unzipped_files=False, progress=True, cloud_mode=False, datasetq=False)

Join data files in a zipped or unzipped NEON data package by table type. This function can be used on a zip file downloaded from the NEON data portal or on a set of files downloaded by zips_by_product().

Parameters

filepath: str

The location of the zip file or downloaded files.

savepath: str, optional

The location to save the output files to. If omitted, output files will be saved in the same location as the input file.

save_unzipped_files: bool, optional

Should the unzipped monthly data folders be retained? Defaults to False.

progress: bool, optional

Should the function display progress bars as it runs? Defaults to True.

cloud_mode: bool, optional

Use cloud mode to transfer files cloud-to-cloud? If used, stack_by_table() expects a list of file urls as input. Defaults to False; in general this option should be used via load_by_product(), in which stack_by_table() is a helper function.

datasetq: bool, optional

Should the function return an arrow dataset for a single table, instead of a set of stacked tables? Defaults to False.

Return

All files are unzipped and one file for each table type is created and written. If savepath=”envt” is specified, output is a named list of tables; otherwise, function output is null and files are saved to the location specified.

Example

To stack PAR data (DP1.00024.001) downloaded from the NEON data portal

>>> pardat = stack_by_table("/filepath/NEON_par.zip")

Notes

Windows Path Length Limitations: When using this function, you may encounter path length limitations on Windows systems. Windows has a default maximum path length of 260 characters, which can cause download and unzip functions to fail if this limit is exceeded. If the file path exceeds 260 characters on a Windows system, the package will issue a warning.You can choose to ignore or filter these warnings using Python’s warnings module if you prefer not to see them. If the function is unable to unzip a folder due to path length limitations, an OSError will be raised.

Created on Tue Mar 5 2024

@author: Zachary Nickerson