A Python3 library to handle contents of ARTECS: Archive of terrestrial-type climate simulations \n\nhttp://wwwuser.oats.inaf.it/exobio/climates/\n
\n\nthrough TAP and the PYVO services.
\n\nAuthors: Michele Maris (1), Marco Molinaro (1)
\n\n(1) INAF/Trieste Astronomical Observatory\n
\n\nFirst Issue: 2019 Nov 20
\n\nDependencies:
\n\nThis package needs: \n numpy, scipy, pandas, pyvo
\n\nInstallation
\n\nFor the latest release:
\n\n\n
>>> pip3 install py_artecs\n
\n
\n\nfor the dev version clone this GitLab repository.
\n\nFiles in py_artecs
\n\n__init__.py : the init file
\n\ntap.py : the file with the TAP library
\n\nartecs_map.py : a utility class to handle a local fits file with a Temperature MAP downloaded from the archive
\n\nmodelDB.py : a utility class to handle a local csv file with the result of a query, this module is kept for backward compatibility, but its use is deprecated
\n\nExample of session:
\n\nThe archive is accessed from the exop_pubblic_tap in py_artecs:
\n\n\n
>>> from artecs import exop_pubblic_tap\n
\n
\n\nThen instantiate a database object
\n\n\n
>>> atap=exop_pubblic_tap()\n
\n
\n\nall the queries to ARTECS are made through the methods in atap.
\n\nQueries follows the Astronomical Data Query Language (ADQL) format
\n\n\n
>>> ptab=atap.search('power(SMA,1.5)>0.87');\n
\n
\n\nsee the appendix for further references on the ADQL.
\n\nTo know wether the search is successfull:
\n\n\n
>>> atap.success()\nTrue\n
\n
\n\nThe result of a query is stored in ptab as a PANDAS data_frame.
\n\nIn order to save the table as a csv file use the \"to_csv\" method of pandas data frame:
\n\n\n
>>> ptab.to_csv('result.csv',sep=' ')\n
\n
\n\nIn order to get a map corresponding to the first entry in the ptab use:
\n\n\n
>>> TMAP=atap.get_map(ptab.URL[0])\n
\n
\n\nthe command creates a fits file to rercover the fits filename
\n\n\n
>>> print(MAP.filename)\n/tmp/artecs_download_file_669d40064f5bddc8.fits\n
\n
\n\nnote that the get_map method saved the fits inside the /tmp directory and gives it a dummy name.
\n\nTo specify a different name and directory use the outfile keyword in get_map
\n\n\n
>>> TMAP=atap.get_map(ptab.URL[0],outfile='./test.fits')\n>>> print(TMAP.filename)\n./test.fits\n
\n
\n\nTMAP is an object of class artecs_map, so it contains the temperature MAP in the ARTECS fits file, as well as the other keywords in the original fits file.
\n\nNote that the artecs_map class can be used also local copies of the ARTECS temperature maps.
\n\nAt last, to perform a new query reset the old one with:
\n\n\n\nAppendix A: ADQL Queries
\n\nA query is a string \n . SELECTION set of data to be selected\n . HOW_MANY elements to select\n . WHICH_FIELDS fields to select\n . FROM which table\n . WHERE condition for selection is true
\n\nExamples of query strings:
\n\n\nDownload all the data:
\n\n\n SELECT * FROM exo.EXO
\n
\nDownload only the first 10 elements:
\n\n\n SELECT TOP 10 * FROM exo.EXO
\n
\nDownload only the first 10 elements with SMA in the range 0.9 to 1.1:
\n\n\n SELECT TOP 10 * FROM exo.EXO WHERE SMA BETWEEN 0.9 AND 1.1
\n
\n\nalternativelly
\n\n\n SELECT TOP 10 * FROM exo.EXO WHERE (0.9 <= SMA) AND (SMA <= 1.1)
\n
\nDownload only the first 10 elements with SMA in the range 0.9 to 1.1 and CONTHAB>=0.5
\n\n\n SELECT TOP 10 * FROM exo.EXO WHERE SMA BETWEEN 0.9 AND 1.1 AND CONTHAB>=0.5
\n
\nArithmetic calculations are allowed if needed for selection so to download the first 10 elements with SMA^1.5 > 0.87
\n\n\n SELECT TOP 10 * FROM exo.EXO WHERE power(SMA,1.5)> 0.87
\n
\nreturns just columns SMA and CONTHAB from previous example:
\n\n\n SELECT TOP 10 SMA,CONTHAB FROM exo.EXO WHERE power(SMA,1.5)> 0.87
\n
\n
\n\nNote that the query string is not sensitive to uppercase or lowercase.
\n\nFor tutorials see:
\n\n\n\nA reminder of how to form query strings can be recalled by calling:
\n\n\n\nAppendix B: REFERENCES
\n\nPlease quote
\n\nClimate bistability of Earth-like exoplanets
\n\nMurante G., Provenzale A., Vladilo G.,Taffoni G., Silva L., Palazzi E.,von Hardenberg J.,Maris M., Londero E., Knapic C., Zorba C.
\n\nMNRAS 492, 2638\u20132650 (2020)
\n\ndoi: 10.1093/mnras/stz3529
\n\nAppendix C: Example of session with TAP
\n\nIt is possible to access the archive directly with TAP
\n\n\n
>>> import pyvo as vo\n>>> tap_service = vo.dal.TAPService("http://archives.ia2.inaf.it/vo/tap/exo")\n>>> tap_results = tap_service.search("SELECT top 1 exp_id, url FROM exo.EXO")\n>>> print(tap_results)\n>>>...\n>>> len(tap_results)\n>>>...\n>>> tap_results.getrecord(0)\n>>>...\n
\n
\n\nAppendix D: to install pyvo
\n\n\n
>>> sudo pip3 install pyvo\n
\n
\n"}, {"fullname": "py_artecs.artecs_map", "modulename": "py_artecs.artecs_map", "kind": "module", "doc": "\n"}, {"fullname": "py_artecs.artecs_map.artecs_map", "modulename": "py_artecs.artecs_map", "qualname": "artecs_map", "kind": "class", "doc": "A class to handle a temperature map from ARTECS.
\n\nIt reads the artecs_map from a fits file.
\n\n\n
>>> AMAP=artecs_map("artecs_map.fits")\n
\n
\n\nKeywords in the map are returned as members of the class or using the method \"parameter\".
\n\nExample:
\n\n\n\nreturns the temperature map,
\n\n\n
>>> AMAP.parameter('temp')\n
\n
\n\nreturns the temperature map.
\n\n\n\nreturns the shape of the map (rows, columns)
\n"}, {"fullname": "py_artecs.artecs_map.artecs_map.__init__", "modulename": "py_artecs.artecs_map", "qualname": "artecs_map.__init__", "kind": "function", "doc": "To instantiate the class pass the filename from which to load the Temperature map
\n\n\n Keywords:
\n
\n\n\n \n verbose: if True verbose output
\n
\n
\n\n\n \n closeFits: if True the fits file is closed after reading
\n
\n
\n", "signature": "(filename, closeFits=True, verbose=False)"}, {"fullname": "py_artecs.artecs_map.artecs_map.filename", "modulename": "py_artecs.artecs_map", "qualname": "artecs_map.filename", "kind": "variable", "doc": "parameter: the filename
\n"}, {"fullname": "py_artecs.artecs_map.artecs_map.p", "modulename": "py_artecs.artecs_map", "qualname": "artecs_map.p", "kind": "variable", "doc": "the fits file pointer, normally closed.
\n"}, {"fullname": "py_artecs.artecs_map.artecs_map.lst_lat", "modulename": "py_artecs.artecs_map", "qualname": "artecs_map.lst_lat", "kind": "variable", "doc": "list of latitude bands
\n"}, {"fullname": "py_artecs.artecs_map.artecs_map.lst_year", "modulename": "py_artecs.artecs_map", "qualname": "artecs_map.lst_year", "kind": "variable", "doc": "list of time intervals
\n"}, {"fullname": "py_artecs.artecs_map.artecs_map.shape", "modulename": "py_artecs.artecs_map", "qualname": "artecs_map.shape", "kind": "variable", "doc": "the shape of the 2D maps
\n"}, {"fullname": "py_artecs.artecs_map.artecs_map.TMGLOB", "modulename": "py_artecs.artecs_map", "qualname": "artecs_map.TMGLOB", "kind": "variable", "doc": "the mean surface temperature
\n"}, {"fullname": "py_artecs.artecs_map.artecs_map.keys", "modulename": "py_artecs.artecs_map", "qualname": "artecs_map.keys", "kind": "function", "doc": "returns the list of quantities in the map
\n\nKeywords:
\n\n\n maps (default False), if True returns just the list of of elements which are 2D maps
\n
\n", "signature": "(self, maps=False):", "funcdef": "def"}, {"fullname": "py_artecs.artecs_map.artecs_map.has_key", "modulename": "py_artecs.artecs_map", "qualname": "artecs_map.has_key", "kind": "function", "doc": "True if required key is in the map
\n", "signature": "(self, key):", "funcdef": "def"}, {"fullname": "py_artecs.artecs_map.artecs_map.parameter", "modulename": "py_artecs.artecs_map", "qualname": "artecs_map.parameter", "kind": "function", "doc": "returns a parameter from the fits file from its `key'
\n", "signature": "(self, key):", "funcdef": "def"}, {"fullname": "py_artecs.artecs_map.artecs_map.description", "modulename": "py_artecs.artecs_map", "qualname": "artecs_map.description", "kind": "function", "doc": "returns the description of a parameter in the fits file from its `key'
\n", "signature": "(self, key):", "funcdef": "def"}, {"fullname": "py_artecs.modelDb", "modulename": "py_artecs.modelDb", "kind": "module", "doc": "DEPRECATED
\n"}, {"fullname": "py_artecs.modelDb.modelDb", "modulename": "py_artecs.modelDb", "qualname": "modelDb", "kind": "class", "doc": "DEPRECATED
\n\nClass to handle a local version of the ARTECS DB.
\n\nIt takes in input a csv file generated from a query of ARTECS and saved in csv format.
\n\nSee the example in the introductory page.
\n\nThis module is kept for compatibility with early releases of py_artecs, but it is not maintained so its use is DEPRECATED.
\n"}, {"fullname": "py_artecs.modelDb.modelDb.__init__", "modulename": "py_artecs.modelDb", "qualname": "modelDb.__init__", "kind": "function", "doc": "\n", "signature": "(\tproject_name,\tproject_path,\tcsv_name,\tVerbose=True,\tcsv_sep='!',\tcsv_comment='#',\tcsv_index_col='index',\tfigures_path='png',\tfilterBad=True,\tnew=False,\tquery=None)"}, {"fullname": "py_artecs.modelDb.modelDb.to_csv", "modulename": "py_artecs.modelDb", "qualname": "modelDb.to_csv", "kind": "function", "doc": "\n", "signature": "(self, outFile, COMMENT=''):", "funcdef": "def"}, {"fullname": "py_artecs.modelDb.modelDb.reset", "modulename": "py_artecs.modelDb", "qualname": "modelDb.reset", "kind": "function", "doc": "\n", "signature": "(self):", "funcdef": "def"}, {"fullname": "py_artecs.modelDb.modelDb.copy", "modulename": "py_artecs.modelDb", "qualname": "modelDb.copy", "kind": "function", "doc": "\n", "signature": "(self):", "funcdef": "def"}, {"fullname": "py_artecs.modelDb.modelDb.unique_values", "modulename": "py_artecs.modelDb", "qualname": "modelDb.unique_values", "kind": "function", "doc": "\n", "signature": "(self):", "funcdef": "def"}, {"fullname": "py_artecs.modelDb.modelDb.list_unique_values", "modulename": "py_artecs.modelDb", "qualname": "modelDb.list_unique_values", "kind": "function", "doc": "\n", "signature": "(self):", "funcdef": "def"}, {"fullname": "py_artecs.modelDb.modelDb.classification_indexes", "modulename": "py_artecs.modelDb", "qualname": "modelDb.classification_indexes", "kind": "function", "doc": "\n", "signature": "(self, *arg, **karg):", "funcdef": "def"}, {"fullname": "py_artecs.modelDb.modelDb.show_classTable", "modulename": "py_artecs.modelDb", "qualname": "modelDb.show_classTable", "kind": "function", "doc": "\n", "signature": "(self):", "funcdef": "def"}, {"fullname": "py_artecs.modelDb.modelDb.unique", "modulename": "py_artecs.modelDb", "qualname": "modelDb.unique", "kind": "function", "doc": "\n", "signature": "(self, key):", "funcdef": "def"}, {"fullname": "py_artecs.modelDb.modelDb.sort", "modulename": "py_artecs.modelDb", "qualname": "modelDb.sort", "kind": "function", "doc": "\n", "signature": "(self, sort_by):", "funcdef": "def"}, {"fullname": "py_artecs.modelDb.modelDb.sorted_query", "modulename": "py_artecs.modelDb", "qualname": "modelDb.sorted_query", "kind": "function", "doc": "\n", "signature": "(self, sort_by, qstr):", "funcdef": "def"}, {"fullname": "py_artecs.modelDb.modelDb.query", "modulename": "py_artecs.modelDb", "qualname": "modelDb.query", "kind": "function", "doc": "\n", "signature": "(self, qstr):", "funcdef": "def"}, {"fullname": "py_artecs.modelDb.modelDb.select_by_loc", "modulename": "py_artecs.modelDb", "qualname": "modelDb.select_by_loc", "kind": "function", "doc": "\n", "signature": "(self, loc_argument):", "funcdef": "def"}, {"fullname": "py_artecs.modelDb.modelDb.select_by_iloc", "modulename": "py_artecs.modelDb", "qualname": "modelDb.select_by_iloc", "kind": "function", "doc": "\n", "signature": "(self, iloc_argument):", "funcdef": "def"}, {"fullname": "py_artecs.modelDb.modelDb.classification_string2numeric", "modulename": "py_artecs.modelDb", "qualname": "modelDb.classification_string2numeric", "kind": "function", "doc": "\n", "signature": "(self, strg):", "funcdef": "def"}, {"fullname": "py_artecs.modelDb.modelDb.calc_iclass", "modulename": "py_artecs.modelDb", "qualname": "modelDb.calc_iclass", "kind": "function", "doc": "\n", "signature": "(self, string_classification_array):", "funcdef": "def"}, {"fullname": "py_artecs.modelDb.modelDb.keys", "modulename": "py_artecs.modelDb", "qualname": "modelDb.keys", "kind": "function", "doc": "\n", "signature": "(self):", "funcdef": "def"}, {"fullname": "py_artecs.modelDb.modelDb.has_key", "modulename": "py_artecs.modelDb", "qualname": "modelDb.has_key", "kind": "function", "doc": "\n", "signature": "(self, this):", "funcdef": "def"}, {"fullname": "py_artecs.modelDb.modelDb.reset_plot_status", "modulename": "py_artecs.modelDb", "qualname": "modelDb.reset_plot_status", "kind": "function", "doc": "resets the self._last_plot dictionary where handles from the last plot generated are stored
\n", "signature": "(self):", "funcdef": "def"}, {"fullname": "py_artecs.modelDb.modelDb.plot2", "modulename": "py_artecs.modelDb", "qualname": "modelDb.plot2", "kind": "function", "doc": "creates a 2 axis plot, the handles for the plot objects are stored in self._last_plot
\n", "signature": "(\tself,\tx,\ty='MolecularDepth',\tylog=True,\txlog=False,\tnewfig=True,\tlegend_loc=3,\txylim=None,\tsavefig=None,\tone2one_line=False):", "funcdef": "def"}, {"fullname": "py_artecs.modelDb.modelDb.set_iceTOT_threshold", "modulename": "py_artecs.modelDb", "qualname": "modelDb.set_iceTOT_threshold", "kind": "function", "doc": "set iceTOT_threshold : the ice coverage over which the planet is considered a snowball\nsuggested values 0.95 or 0.99
\n", "signature": "(self, iceTOT_threshold):", "funcdef": "def"}, {"fullname": "py_artecs.modelDb.modelDb.flag_class_warm", "modulename": "py_artecs.modelDb", "qualname": "modelDb.flag_class_warm", "kind": "function", "doc": "returns Murante's classifications for warm calculated from scratch\niceTOT_threshold is the ice coverage over which the planet is considered a snowball\nsuggested values 0.95 or 0.99
\n", "signature": "(self):", "funcdef": "def"}, {"fullname": "py_artecs.modelDb.modelDb.flag_class_warm_hot", "modulename": "py_artecs.modelDb", "qualname": "modelDb.flag_class_warm_hot", "kind": "function", "doc": "returns Murante's classifications for warm_hot calculated from scratch\niceTOT_threshold is the ice coverage over which the planet is considered a snowball\nsuggested values 0.95 or 0.99
\n", "signature": "(self):", "funcdef": "def"}, {"fullname": "py_artecs.modelDb.modelDb.flag_class_snowball", "modulename": "py_artecs.modelDb", "qualname": "modelDb.flag_class_snowball", "kind": "function", "doc": "returns Murante's classifications for warm_hot calculated from scratch\niceTOT_threshold is the ice coverage over which the planet is considered a snowball\nsuggested values 0.95 or 0.99
\n", "signature": "(self):", "funcdef": "def"}, {"fullname": "py_artecs.modelDb.modelDb.flag_class_waterbelt", "modulename": "py_artecs.modelDb", "qualname": "modelDb.flag_class_waterbelt", "kind": "function", "doc": "returns Murante's classifications for warm_hot calculated from scratch\niceTOT_threshold is the ice coverage over which the planet is considered a snowball\nsuggested values 0.95 or 0.99
\n", "signature": "(self):", "funcdef": "def"}, {"fullname": "py_artecs.tap", "modulename": "py_artecs.tap", "kind": "module", "doc": "\n"}, {"fullname": "py_artecs.tap.EXOP_TAP", "modulename": "py_artecs.tap", "qualname": "EXOP_TAP", "kind": "class", "doc": "\n"}, {"fullname": "py_artecs.tap.EXOP_TAP.__init__", "modulename": "py_artecs.tap", "qualname": "EXOP_TAP.__init__", "kind": "function", "doc": "\n", "signature": "(\ttap_url='http://archives.ia2.inaf.it/vo/tap/exo',\ttable_name='exo.EXO',\ttemporary_files_path='/tmp')"}, {"fullname": "py_artecs.tap.EXOP_TAP.keys", "modulename": "py_artecs.tap", "qualname": "EXOP_TAP.keys", "kind": "function", "doc": "list of fields in the database
\n", "signature": "(self):", "funcdef": "def"}, {"fullname": "py_artecs.tap.EXOP_TAP.has_key", "modulename": "py_artecs.tap", "qualname": "EXOP_TAP.has_key", "kind": "function", "doc": "has_key
\n", "signature": "(self, this):", "funcdef": "def"}, {"fullname": "py_artecs.tap.EXOP_TAP.success", "modulename": "py_artecs.tap", "qualname": "EXOP_TAP.success", "kind": "function", "doc": "returns True if last search was successfull
\n", "signature": "(self):", "funcdef": "def"}, {"fullname": "py_artecs.tap.EXOP_TAP.clean", "modulename": "py_artecs.tap", "qualname": "EXOP_TAP.clean", "kind": "function", "doc": "cleans information from last search
\n", "signature": "(self):", "funcdef": "def"}, {"fullname": "py_artecs.tap.EXOP_TAP.adql_search", "modulename": "py_artecs.tap", "qualname": "EXOP_TAP.adql_search", "kind": "function", "doc": "search on database using ADQL string
\n", "signature": "(self, adql_string):", "funcdef": "def"}, {"fullname": "py_artecs.tap.EXOP_TAP.search_string", "modulename": "py_artecs.tap", "qualname": "EXOP_TAP.search_string", "kind": "function", "doc": "creates a properly formatted adql query_string
\n", "signature": "(self, SELECTION, TOP, FIELDS, WHERE, SORT):", "funcdef": "def"}, {"fullname": "py_artecs.tap.EXOP_TAP.search", "modulename": "py_artecs.tap", "qualname": "EXOP_TAP.search", "kind": "function", "doc": "download a table from the database\nsearch('') or search(WHERE='') returns all the data in the database
\n\nthe table can be returned as :\n pandas dataframe (default)\n astropy table (as_astropy = True)\n votable (as_votable=True)
\n", "signature": "(\tself,\tWHERE,\tSELECTION=None,\tFIELDS=None,\tTOP=None,\tSORT=None,\tas_astropy=False,\tas_votable=False):", "funcdef": "def"}, {"fullname": "py_artecs.tap.EXOP_TAP.get_map", "modulename": "py_artecs.tap", "qualname": "EXOP_TAP.get_map", "kind": "function", "doc": "gets a map
\n", "signature": "(self, _URL, outfile=None):", "funcdef": "def"}, {"fullname": "py_artecs.tap.EXOP_TAP.download_map", "modulename": "py_artecs.tap", "qualname": "EXOP_TAP.download_map", "kind": "function", "doc": "download the fits file corresponding at a given URL\nif outfile is not specified the fits file name from the URL is used\nif path is not specified the current file is stored in the current path
\n", "signature": "(self, URL, outfile=None, path=None):", "funcdef": "def"}, {"fullname": "py_artecs.tap.EXOP_TAP.EXPLAIN", "modulename": "py_artecs.tap", "qualname": "EXOP_TAP.EXPLAIN", "kind": "function", "doc": "print a short introduction on the query language
\n", "signature": "(self):", "funcdef": "def"}];
+
+ // mirrored in build-search-index.js (part 1)
+ // Also split on html tags. this is a cheap heuristic, but good enough.
+ elasticlunr.tokenizer.setSeperator(/[\s\-.;&_'"=,()]+|<[^>]*>/);
+
+ let searchIndex;
+ if (docs._isPrebuiltIndex) {
+ console.info("using precompiled search index");
+ searchIndex = elasticlunr.Index.load(docs);
+ } else {
+ console.time("building search index");
+ // mirrored in build-search-index.js (part 2)
+ searchIndex = elasticlunr(function () {
+ this.pipeline.remove(elasticlunr.stemmer);
+ this.pipeline.remove(elasticlunr.stopWordFilter);
+ this.addField("qualname");
+ this.addField("fullname");
+ this.addField("annotation");
+ this.addField("default_value");
+ this.addField("signature");
+ this.addField("bases");
+ this.addField("doc");
+ this.setRef("fullname");
+ });
+ for (let doc of docs) {
+ searchIndex.addDoc(doc);
+ }
+ console.timeEnd("building search index");
+ }
+
+ return (term) => searchIndex.search(term, {
+ fields: {
+ qualname: {boost: 4},
+ fullname: {boost: 2},
+ annotation: {boost: 2},
+ default_value: {boost: 2},
+ signature: {boost: 2},
+ bases: {boost: 2},
+ doc: {boost: 1},
+ },
+ expand: true
+ });
+})();
\ No newline at end of file