This backend will receive .seg files and process them by using different. Python is chosen for the implementation, taking advantage of its capabilities in data analysis.
Beyond seismic files, spreadsheet files (.csv .tsv .xlsx) will be also studied by applying data analysis techniques.
Well known data analysis tools will be used on the backend, like:
- numpy
- pandas
- scipy
In addition to Python's data analysis tools, specialized libraries are used to handle SEG files, for example:
- segysak
- segyio
Once a SEGY file arrives to the server, chart images are generated in .png format. The way to process it can be selected, mofifying the number of these images.
Being an APIrest based on json, png files must be converted to string files and finally be injected to the response json.
Gunicorn is the most used option, ideal for robust applications
python -m gunicorn mybackend.asgi:application -k uvicorn.workers.UvicornWorker
This can be executed as a wsgi application. In this case waitress is used. It is a python pure server, ideal for web applications built with Django.
waitress-serve --port=8000 mybackend.wsgi:application
The development server is built for debugging and fast tests, not for production and supported on Windows buffers. However, when large files are uploaded, Django's server is unable to handle them properly because mentioned buffers get fill.
That's why waitress is used. This wsgi server is robust and estable for handling heavy files uploading, being able to process chunks more efficiently, avoiding the overuse of Windows buffers and preventing related issues.
As an alternative to the above commad, a sever.py file can be used.
python serve.py
Pushing by using access token:
git remote set-url origin https://TOKEN@github.com/OWNER/REPOSITORY.git
For older versions like mine, which is a windows 7 32 bits, older libraries are used. This is the case of Pandas, Numpy, Scipy, h5py, among others. These can be installed using the pip tool, indicating the specific version:
pip install pandas==1.3.4
It's the same than downloading its wheel directly and typing:
pip install <example.whl>
Examples are:
- pandas-1.3.4-cp38-cp38-win32.whl
- numpy-1.21.4-cp38-cp38-win32.whl
- scipy-1.5.4-cp38-cp38-win32.whl
which are in
- https://pypi.org/project/pandas/1.3.4/#files
- https://pypi.org/project/numpy/1.21.4/#files
- https://pypi.org/project/scipy/1.5.4/#files
Curl is used to send multipart forms using a plain file test, called upload.txt in this case, by typinh the following command:
curl -K tests/upload.txt