Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Mark Lawrence Newsgroups: comp.lang.python Subject: Re: read 4D binary data Date: Thu, 26 Nov 2015 17:43:34 +0000 Lines: 35 Message-ID: References: <4d15f12abb4c4781168ce05d3b450f63@cptec.inpe.br> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de qBfJy/JmQPP3Vq+GXdutrg9KWjjMw8AmdFYwIQwp3kLw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'binary': 0.05; 'from:addr:yahoo.co.uk': 0.05; 'csv': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.10; 'dimension': 0.16; 'received:194.126': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'language': 0.19; 'lawrence': 0.22; 'header:In-Reply-To:1': 0.24; 'header:User- Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'points': 0.27; 'skip:( 20': 0.28; 'array': 0.29; "i'm": 0.30; 'call.': 0.30; 'language.': 0.32; 'url:python': 0.33; 'open': 0.33; 'structure': 0.34; 'file': 0.34; 'lists': 0.34; 'url:org': 0.36; 'data.': 0.36; 'url:library': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'hi,': 0.38; 'data': 0.39; 'format': 0.39; 'to:addr:python.org': 0.40; 'mark': 0.40; 'url:3': 0.60; 'your': 0.60; 'received:194': 0.61; 'charset:windows-1252': 0.62; 'our': 0.64; 'levels': 0.70; 'latitude': 0.84; 'longitude': 0.84; 'pythonistas,': 0.84; 'subject:read': 0.84; 'url:functions': 0.84 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: 107.93.126.194.pool.dsl.daisyplc.net User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 In-Reply-To: <4d15f12abb4c4781168ce05d3b450f63@cptec.inpe.br> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:99590 On 26/11/2015 17:15, jorge.conrado@cptec.inpe.br wrote: > Hi, > > > I'm startig in Python and I have a 4D binary data. The dimension of my > data is: > > 67 ----> longitude points > 41 ----> latitude points > 10 ----> pressure levels points > 33 ----> time points > > > How can I read this data and what can I do to get a 2D array > (longitude,latitude) for a specific pressure and time dimension. > > > Conrado To open a file to access the contents https://docs.python.org/3/library/functions.html#open If the data is in CSV format see https://docs.python.org/3/library/csv.html For your data structure lists https://docs.python.org/3/library/stdtypes.html#lists and dicts https://docs.python.org/3/library/stdtypes.html#mapping-types-dict are always the first port of call. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence