Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds option for adding a temporary path #54

Merged
merged 1 commit into from
Jan 5, 2024
Merged

Adds option for adding a temporary path #54

merged 1 commit into from
Jan 5, 2024

Conversation

havok2063
Copy link
Collaborator

Closes #48. This PR adds a new method to the Path, add_temp_path, which allows the addition of new temporary path templates into the local Python environment for use in sdss_access. This can be useful when developing new paths in code, when using sdss_acces and a tagged version of tree. This lets you add the paths in the interim until they can get properly added into the tree product and a new tag made. They are not persistent and only work for local path stuff only.

You specify a template name and path. The path must start with an environment variable and if it doesn't exist in the local environment already, you can define it with the envvar_path keyword.

from sdss_access import Access

access = Access()
access.add_temp_path("newCalib", "$LVM_SPECTRO_REDUX/{drpver}/@tilegrp|/{tileid}/new_calib.fits")
access.full("newCalib", drpver="1.0.0", tileid="1234567")
'/Users/Brian/Work/sdss/sas/sdsswork/lvm/spectro/redux/1.0.0/1234XX/1234567/new_calib.fits'

# add with a temporary envvar
access.add_temp_path('testFile', '$TEST_DIR/test_file_{ver}.fits', envvar_path='/tmp/test/dir')
access.full('testFile', ver='1.0')
'/tmp/test/dir/test_file_1.0.fits'

@havok2063 havok2063 self-assigned this Jan 5, 2024
Copy link
Contributor

@joelbrownstein joelbrownstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a useful feature!

@havok2063 havok2063 merged commit 08f1738 into main Jan 5, 2024
4 checks passed
@havok2063 havok2063 deleted the temppath branch March 8, 2024 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add ability to download files not in tree
2 participants