Skip to content

Commit 034eaaa

Browse files
committed
add info on how windows path length limitations are handled
1 parent dac5213 commit 034eaaa

File tree

2 files changed

+65
-6
lines changed

2 files changed

+65
-6
lines changed

src/neonutilities/aop_download.py

+40-2
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,8 @@ def list_available_dates(dpid, site):
431431
--------
432432
Returns:
433433
prints the Release Tag (or PROVISIONAL) and the corresponding available dates (YYYY-MM) for each tag
434-
--------
435-
Usage:
434+
435+
Examples:
436436
--------
437437
>>> list_available_dates('DP3.30015.001','JORN')
438438
RELEASE-2025 Available Dates: 2017-08, 2018-08, 2019-08, 2021-08, 2022-09
@@ -443,6 +443,11 @@ def list_available_dates(dpid, site):
443443
444444
>>> list_available_dates('DP1.10098.001','HOPB')
445445
ValueError: There are no data available for the data product DP1.10098.001 at the site HOPB.
446+
447+
Created on Feb 17 2025
448+
449+
@author: Bridget Hass
450+
446451
"""
447452
product_url = "http://data.neonscience.org/api/v0/products/" + dpid
448453
response = get_api(api_url=product_url) # add input for token?
@@ -581,6 +586,10 @@ def get_aop_tile_extents(dpid,
581586
# This returns a list of the UTM x,y extent for all CHM tiles at the site MCRA collected in 2021.
582587
# It also displays the minimum and maximum UTM Easting and Northing (x and y) values for this product - site -year.
583588
589+
Created on Feb 17 2025
590+
591+
@author: Bridget Hass
592+
584593
"""
585594

586595
# raise value error and print message if dpid isn't formatted as expected
@@ -720,6 +729,18 @@ def by_file_aop(dpid,
720729
--------
721730
The function creates a folder in the 'savepath' directory, containing all AOP files meeting the query criteria.
722731
If 'savepath' is not provided, data are downloaded to the working directory.
732+
733+
Windows Path Length Limitations:
734+
When using this function to download files from the NEON data portal, you may encounter path length limitations
735+
on Windows systems. Windows has a default maximum path length of 260 characters, which can cause download
736+
functions to fail if this limit is exceeded. If the file path exceeds 260 characters on a Windows system,
737+
the package will issue a warning.If you see this warning and no files are downloaded, either change your
738+
working or savepath directory to be closer to the root directory, or enable long paths on Windows. You can
739+
choose to ignore or filter these warnings using Python's warnings module if you prefer not to see them.
740+
741+
Created on Feb 28 2024
742+
743+
@author: Bridget Hass
723744
"""
724745

725746
# raise value error and print message if dpid isn't formatted as expected
@@ -945,6 +966,23 @@ def by_tile_aop(dpid,
945966
# This will download any tiles overlapping the specified UTM coordinates for
946967
# 2021 canopy height model data from McRae Creek to the './test_download' directory.
947968
969+
Notes
970+
--------
971+
The function creates a folder in the 'savepath' directory, containing all AOP files meeting the query criteria.
972+
If 'savepath' is not provided, data are downloaded to the working directory.
973+
974+
Windows Path Length Limitations:
975+
When using this function to download files from the NEON data portal, you may encounter path length limitations
976+
on Windows systems. Windows has a default maximum path length of 260 characters, which can cause download
977+
functions to fail if this limit is exceeded. If the file path exceeds 260 characters on a Windows system,
978+
the package will issue a warning.If you see this warning and no files are downloaded, either change your
979+
working or savepath directory to be closer to the root directory, or enable long paths on Windows. You can
980+
choose to ignore or filter these warnings using Python's warnings module if you prefer not to see them.
981+
982+
Created on Feb 28 2024
983+
984+
@author: Bridget Hass
985+
948986
"""
949987

950988
# raise value error and print message if dpid isn't formatted as expected

src/neonutilities/unzip_and_stack.py

+25-4
Original file line numberDiff line numberDiff line change
@@ -1084,17 +1084,17 @@ def stack_by_table(filepath,
10841084
------------------
10851085
filepath: str
10861086
The location of the zip file or downloaded files.
1087-
1087+
10881088
savepath: str, optional
10891089
The location to save the output files to. If omitted, output files will be
10901090
saved in the same location as the input file.
1091-
1091+
10921092
save_unzipped_files: bool, optional
10931093
Should the unzipped monthly data folders be retained? Defaults to False.
1094-
1094+
10951095
progress: bool, optional
10961096
Should the function display progress bars as it runs? Defaults to True.
1097-
1097+
10981098
cloud_mode: bool, optional
10991099
Use cloud mode to transfer files cloud-to-cloud? If used, stack_by_table()
11001100
expects a list of file urls as input. Defaults to False; in general this
@@ -1112,6 +1112,17 @@ def stack_by_table(filepath,
11121112
To stack PAR data (DP1.00024.001) downloaded from the NEON data portal
11131113
>>> pardat = stack_by_table("/filepath/NEON_par.zip")
11141114
1115+
Notes
1116+
--------
1117+
1118+
Windows Path Length Limitations:
1119+
When using this function, you may encounter path length limitations on Windows systems.
1120+
Windows has a default maximum path length of 260 characters, which can cause download and unzip
1121+
functions to fail if this limit is exceeded. If the file path exceeds 260 characters on a Windows system,
1122+
the package will issue a warning.You can choose to ignore or filter these warnings using Python's warnings
1123+
module if you prefer not to see them. If the function is unable to unzip a folder due to path length
1124+
limitations, an OSError will be raised.
1125+
11151126
Created on Tue Mar 5 2024
11161127
11171128
@author: Zachary Nickerson
@@ -1338,6 +1349,16 @@ def load_by_product(dpid, site="all", startdate=None, enddate=None,
13381349
startdate="2018-01", enddate="2018-12",
13391350
token=None)
13401351
1352+
Notes
1353+
--------
1354+
Windows Path Length Limitations:
1355+
When using this function, you may encounter path length limitations on Windows systems.
1356+
Windows has a default maximum path length of 260 characters, which can cause download and unzip
1357+
functions to fail if this limit is exceeded. If the file path exceeds 260 characters on a Windows system,
1358+
the package will issue a warning.You can choose to ignore or filter these warnings using Python's warnings
1359+
module if you prefer not to see them. If the function is unable to unzip a folder due to path length
1360+
limitations, an OSError will be raised.
1361+
13411362
Created on June 12 2024
13421363
13431364
@author: Claire Lunch

0 commit comments

Comments
 (0)