This is a lambda function with S3-caching to retrieve FITS and JPEG images. The function is intended to be served by AWS's Gateway API. URLs requesting data take the following format:
https://HOST/api/images/urn:nasa:pds:gbo.ast.catalina.survey:data_calibrated:703_20220122_2b_n32022_01_0003.arch?ra=107.10813&dec=30.84928&size=5arcmin&format=jpeg
It is used by CATCH and other services maintained by SBN at UMD.
The AWS Lambda function:
- Receives path and query parameters.
- Formulate a unique file name based on the query.
- Checks if a corresponding file exists within a data cache backed by an S3 bucket.
- If the file exists, it is returned to the user.
- If the file does not exist, then the data is retrieved from externally hosted services.
- Images are converted to the user's requested format (e.g., JPEG or PNG).
- The result is cached to S3 and returned to the user.
Catalina Sky Survey, NEAT, and Spacewatch data archived at sbnarchive.psi.edu
are presently supported.
Unit tests are in the src/test_sbn_sis.py file. They are designed to be run with pytest src/
. The tests can also be run with the Makefile, which will setup a virtual environment in the test-venv
directory:
make test
Test Lambda function:
{
"queryStringParameters": {
"lid": "urn:nasa:pds:gbo.ast.catalina.survey:data_calibrated:g96_20210402_2b_f5q9m2_01_0001.arch",
"ra": 190.99166667,
"dec": 23.92305556,
"size": "5 arcmin",
"format": "jpeg"
}
}
Test API Gateway query string:
/images/urn:nasa:pds:gbo.ast.catalina.survey:data_calibrated:g96_20210402_2b_f5q9m2_01_0001.arch?ra=190.99166667&dec=23.92305556&size=5arcmin&format=jpeg
Test API Gateway method:
lid: urn:nasa:pds:gbo.ast.catalina.survey:data_calibrated:g96_20210402_2b_f5q9m2_01_0001.arch Query strings: ra=190.99166667&dec=23.92305556&size=5arcmin