diff --git a/bin/Socetnet2ISIS.py b/bin/Socetnet2ISIS.py new file mode 100644 index 0000000000000000000000000000000000000000..79765170ee5246e52d1f60a9634ad51b68ae01b8 --- /dev/null +++ b/bin/Socetnet2ISIS.py @@ -0,0 +1,49 @@ +import os +import numpy as np + +# Reads a .atf file and outputs all of the +# .ipf, .gpf, .sup, .prj, and path to locate the +# .apf file (should be the same as all others) +def read_atf(atf_file): + with open(atf_file) as f: + + files = [] + ipf = [] + sup = [] + files_dict = [] + + # Grabs every PRJ, GPF, SUP, and IPF image from the ATF file + for line in f: + if line[-4:-1] == 'prj' or line[-4:-1] == 'gpf' or line[-4:-1] == 'sup' or line[-4:-1] == 'ipf' or line[-4:-1] == 'atf': + files.append(line) + + files = np.array(files) + + # Creates appropriate arrays for certain files in the right format + for file in files: + file = file.strip() + file = file.split(' ') + + # Grabs all the IPF files + if file[1].endswith('.ipf'): + ipf.append(file[1]) + + # Grabs all the SUP files + if file[1].endswith('.sup'): + sup.append(file[1]) + + files_dict.append(file) + + # Creates a dict out of file lists for GPF, PRJ, IPF, and ATF + files_dict = (dict(files_dict)) + + # Sets the value of IMAGE_IPF to all IPF images + files_dict['IMAGE_IPF'] = ipf + + # Sets the value of IMAGE_SUP to all SUP images + files_dict['IMAGE_SUP'] = sup + + # Sets the value of PATH to the path of the ATF file + files_dict['PATH'] = os.path.dirname(os.path.abspath(atf_file)) + + return files_dict diff --git a/notebooks/.ipynb_checkpoints/Socet2ISIS-checkpoint.ipynb b/notebooks/.ipynb_checkpoints/Socet2ISIS-checkpoint.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..2fd64429bf421126b7000c94ce0f6fd186fbd01f --- /dev/null +++ b/notebooks/.ipynb_checkpoints/Socet2ISIS-checkpoint.ipynb @@ -0,0 +1,6 @@ +{ + "cells": [], + "metadata": {}, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/notebooks/Socet2ISIS.ipynb b/notebooks/Socet2ISIS.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..c5130953f65be68c481936fb3d3731abc33f58ba --- /dev/null +++ b/notebooks/Socet2ISIS.ipynb @@ -0,0 +1,173 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 67, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'ATF_FILE': 'CTX_Athabasca_Middle_step0.atf',\n", + " 'GP_FILE': 'CTX_Athabasca_Middle.gpf',\n", + " 'IMAGE_IPF': ['P19_008344_1894_XN_09N203W.ipf',\n", + " 'P20_008845_1894_XN_09N203W.ipf',\n", + " 'P03_002371_1888_XI_08N204W.ipf',\n", + " 'P01_001540_1889_XI_08N204W.ipf',\n", + " 'P01_001606_1897_XI_09N203W.ipf',\n", + " 'P03_002226_1895_XI_09N203W.ipf'],\n", + " 'IMAGE_SUP': ['P19_008344_1894_XN_09N203W.sup',\n", + " 'P20_008845_1894_XN_09N203W.sup',\n", + " 'P03_002371_1888_XI_08N204W.sup',\n", + " 'P01_001540_1889_XI_08N204W.sup',\n", + " 'P01_001606_1897_XI_09N203W.sup',\n", + " 'P03_002226_1895_XI_09N203W.sup'],\n", + " 'PATH': '/home/tthatcher/Desktop/Projects/Plio/plio/notebooks',\n", + " 'PROJECT': 'D:\\\\data\\\\CTX_Athabasca_Middle.prj'}" + ] + }, + "execution_count": 67, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import os\n", + "import numpy as np\n", + "\n", + "# Reads a .atf file and outputs all of the \n", + "# .ipf, .gpf, .sup, .prj, and path to locate the \n", + "# .apf file (should be the same as all others) \n", + "def read_atf(atf_file):\n", + " with open(atf_file) as f:\n", + "\n", + " files = []\n", + " ipf = []\n", + " sup = []\n", + " files_dict = []\n", + " \n", + " # Grabs every PRJ, GPF, SUP, and IPF image from the ATF file\n", + " for line in f:\n", + " if line[-4:-1] == 'prj' or line[-4:-1] == 'gpf' or line[-4:-1] == 'sup' or line[-4:-1] == 'ipf' or line[-4:-1] == 'atf':\n", + " files.append(line)\n", + " \n", + " files = np.array(files)\n", + " \n", + " # Creates appropriate arrays for certain files in the right format\n", + " for file in files:\n", + " file = file.strip()\n", + " file = file.split(' ')\n", + "\n", + " # Grabs all the IPF files\n", + " if file[1].endswith('.ipf'):\n", + " ipf.append(file[1])\n", + "\n", + " # Grabs all the SUP files\n", + " if file[1].endswith('.sup'):\n", + " sup.append(file[1])\n", + "\n", + " files_dict.append(file)\n", + "\n", + " # Creates a dict out of file lists for GPF, PRJ, IPF, and ATF\n", + " files_dict = (dict(files_dict))\n", + " \n", + " # Sets the value of IMAGE_IPF to all IPF images\n", + " files_dict['IMAGE_IPF'] = ipf\n", + " \n", + " # Sets the value of IMAGE_SUP to all SUP images\n", + " files_dict['IMAGE_SUP'] = sup\n", + " \n", + " # Sets the value of PATH to the path of the ATF file\n", + " files_dict['PATH'] = os.path.dirname(os.path.abspath(atf_file))\n", + " \n", + " return files_dict\n", + " \n", + "read_atf('CTX_Athabasca_Middle_step0.atf')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.4" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}