{"action":"created","issue":{"url":"https://api.github.com/repos/sunpy/sunpy/issues/1919","repository_url":"https://api.github.com/repos/sunpy/sunpy","labels_url":"https://api.github.com/repos/sunpy/sunpy/issues/1919/labels{/name}","comments_url":"https://api.github.com/repos/sunpy/sunpy/issues/1919/comments","events_url":"https://api.github.com/repos/sunpy/sunpy/issues/1919/events","html_url":"https://github.com/sunpy/sunpy/issues/1919","id":182806707,"number":1919,"title":"Map should error nicely if not passed a 2D array","user":{"login":"kkozarev","id":5508374,"avatar_url":"https://avatars.githubusercontent.com/u/5508374?v=3","gravatar_id":"","url":"https://api.github.com/users/kkozarev","html_url":"https://github.com/kkozarev","followers_url":"https://api.github.com/users/kkozarev/followers","following_url":"https://api.github.com/users/kkozarev/following{/other_user}","gists_url":"https://api.github.com/users/kkozarev/gists{/gist_id}","starred_url":"https://api.github.com/users/kkozarev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kkozarev/subscriptions","organizations_url":"https://api.github.com/users/kkozarev/orgs","repos_url":"https://api.github.com/users/kkozarev/repos","events_url":"https://api.github.com/users/kkozarev/events{/privacy}","received_events_url":"https://api.github.com/users/kkozarev/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/sunpy/sunpy/labels/affects-released","name":"affects-released","color":"fbca04"},{"url":"https://api.github.com/repos/sunpy/sunpy/labels/Bug?","name":"Bug?","color":"e11d21"},{"url":"https://api.github.com/repos/sunpy/sunpy/labels/effort-low","name":"effort-low","color":"d4c5f9"},{"url":"https://api.github.com/repos/sunpy/sunpy/labels/hacktoberfest","name":"hacktoberfest","color":"0052cc"},{"url":"https://api.github.com/repos/sunpy/sunpy/labels/package-novice","name":"package-novice","color":"207de5"},{"url":"https://api.github.com/repos/sunpy/sunpy/labels/priority-medium","name":"priority-medium","color":"5319e7"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-10-13T14:32:58Z","updated_at":"2016-10-16T21:30:06Z","closed_at":null,"body":"Hello, I am getting the following errors when attempting to create a map from the attached fits file:\r\n```python\r\nIn [6]: map.Map('1130643840_vv_c076-077_f8-14_t034345_t034444_XX_d002.fits')\r\nOut[6]: ---------------------------------------------------------------------------\r\nTypeError                                 Traceback (most recent call last)\r\n/Users/kamen/anaconda/lib/python2.7/site-packages/IPython/core/formatters.pyc in __call__(self, obj)\r\n    697                 type_pprinters=self.type_printers,\r\n    698                 deferred_pprinters=self.deferred_printers)\r\n--> 699             printer.pretty(obj)\r\n    700             printer.flush()\r\n    701             return stream.getvalue()\r\n\r\n/Users/kamen/anaconda/lib/python2.7/site-packages/IPython/lib/pretty.pyc in pretty(self, obj)\r\n    381                             if callable(meth):\r\n    382                                 return meth(obj, self, cycle)\r\n--> 383             return _default_pprint(obj, self, cycle)\r\n    384         finally:\r\n    385             self.end_group()\r\n\r\n/Users/kamen/anaconda/lib/python2.7/site-packages/IPython/lib/pretty.pyc in _default_pprint(obj, p, cycle)\r\n    501     if _safe_getattr(klass, '__repr__', None) not in _baseclass_reprs:\r\n    502         # A user-provided repr. Find newlines and replace them with p.break_()\r\n--> 503         _repr_pprint(obj, p, cycle)\r\n    504         return\r\n    505     p.begin_group(1, '<')\r\n\r\n/Users/kamen/anaconda/lib/python2.7/site-packages/IPython/lib/pretty.pyc in _repr_pprint(obj, p, cycle)\r\n    692     \"\"\"A pprint that just redirects to the normal repr function.\"\"\"\r\n    693     # Find newlines and replace them with p.break_()\r\n--> 694     output = repr(obj)\r\n    695     for idx,output_line in enumerate(output.splitlines()):\r\n    696         if idx:\r\n\r\n/Users/kamen/anaconda/lib/python2.7/site-packages/sunpy/map/mapbase.py in __repr__(self)\r\n    221            obs=self.observatory, inst=self.instrument, det=self.detector,\r\n    222            meas=self.measurement, wave=self.wavelength, date=self.date, dt=self.exposure_time,\r\n--> 223            dim=u.Quantity(self.dimensions),\r\n    224            scale=u.Quantity(self.scale),\r\n    225            tmf=TIME_FORMAT)\r\n\r\n/Users/kamen/anaconda/lib/python2.7/site-packages/sunpy/map/mapbase.py in dimensions(self)\r\n    301         The dimensions of the array (x axis first, y axis second).\r\n    302         \"\"\"\r\n--> 303         return Pair(*u.Quantity(np.flipud(self.data.shape), 'pixel'))\r\n    304 \r\n    305     @property\r\n\r\nTypeError: __new__() takes exactly 3 arguments (5 given)\r\n```\r\n\r\nAny thoughts? The fits file contains radio observations of the Sun by the Murchison Widefield Array telescope in Australia. Thanks!\r\n\r\n[1130643840_c076-077_f8-14_t034345_t034444_XX_d002.fits.zip](https://github.com/sunpy/sunpy/files/527362/1130643840_c076-077_f8-14_t034345_t034444_XX_d002.fits.zip)\r\n"},"comment":{"url":"https://api.github.com/repos/sunpy/sunpy/issues/comments/254076392","html_url":"https://github.com/sunpy/sunpy/issues/1919#issuecomment-254076392","issue_url":"https://api.github.com/repos/sunpy/sunpy/issues/1919","id":254076392,"user":{"login":"Cadair","id":1391051,"avatar_url":"https://avatars.githubusercontent.com/u/1391051?v=3","gravatar_id":"","url":"https://api.github.com/users/Cadair","html_url":"https://github.com/Cadair","followers_url":"https://api.github.com/users/Cadair/followers","following_url":"https://api.github.com/users/Cadair/following{/other_user}","gists_url":"https://api.github.com/users/Cadair/gists{/gist_id}","starred_url":"https://api.github.com/users/Cadair/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Cadair/subscriptions","organizations_url":"https://api.github.com/users/Cadair/orgs","repos_url":"https://api.github.com/users/Cadair/repos","events_url":"https://api.github.com/users/Cadair/events{/privacy}","received_events_url":"https://api.github.com/users/Cadair/received_events","type":"User","site_admin":false},"created_at":"2016-10-16T21:30:06Z","updated_at":"2016-10-16T21:30:06Z","body":"The easiest solution would be to raise an error if it was not 2D, but that would exclude the file of the original report here, in an ideal world a file with dimensions `[1, 1, x, y]` would read.\r\n\r\nMaybe the best approach would be to just slice the data array to 2D in the `__init__`, then it would always take the last two dimensions (which if I am not mistaken should correspond to '1' and '2' keys in the header) and it would happily ignore everything else. In this situation it would be correct to issue a warning to the user so that they know we are silently ignoring a hunk of the input data.\r\n\r\nTo clarify, the ordering of the arrays FITS files provide are reversed (they are column major) so the last two axes of the array would be what we would need, unless I am mistaken. (ping @dpshelio ?)"}}
{"actor":{"display_login":"Cadair"}}