Re: tabs vs. spaces with asciiread

From: Jonathan Vigh <vigh_at_nyahnyahspammersnyahnyah>
Date: Mon Dec 07 2009 - 17:17:26 MST

Wei and David,
    I had started to hand-edit the file and then David's e-mail came. It
took me a bit to execute the commands as I'm an emacs ignormamus, but I
eventually was able to with the help of an emacs person (it turns out
the last command needs to be entered in sequence). Anyway, untabify
worked like a charm.

Wei, thanks for your suggestion also - in the future I might start using
that approach.

Thanks so much for the help!
Jonathan

David Brown wrote:
>
> On Dec 7, 2009, at 3:03 PM, Jonathan Vigh wrote:
>
>> Hi NCL'ers,
>> I have another ASCII reading question. I created a data file by
>> hand using nedit. This file has mixed type (strings, logicals, and
>> integers). My original plan was to use asciiread to read the file
>> into NCL by column position, converting the strings into the
>> appropriate type. Unfortunately, when I was creating the file I used
>> both spaces and tabs to align the columns, and it seems that
>> asciiread is not seeing things in the position they appear within nedit.
>> I'm wondering, first of all, if anyone knows a simple way to save
>> such a file to fix this (maybe in a different text editor?).
>
> Hi Jonathan,
>
> emacs has a command called 'untabify' that changes tabs into the right
> number of spaces.
> If you have never used it, you could try:
>
> emacs <filename>
> <control> spacebar # sets the mark at the top of the file
> <ESC> <shift> > # that is the 'greater than symbol --
> moves to the end of the file.
> <ESC> x untabify # executes the untabify command on the
> region (in this case the whole file)
>
>
> Note that by default emacs assumes a tab stop of 8, so if you are
> using something else you need to change the emacs default.
> Hope this helps.
> -dave
>
>
>> Secondly, does anyone have any ideas on an NCL workaround to read a
>> file like this (a short version of the file is attached). My idea to
>> split the string into tokens and parse each line individually runs
>> into a problem because some of the string fields already have spaces.
>>
>> Please don't spend much time on this - I think I could fix the file
>> by hand in an hour or two (only a few hundred lines) - but I just
>> wanted to ask to see if anyone already knows a solution.
>>
>> A question for the developers - Is tabs vs. spaces a known issue with
>> asciiread?
>>
>> Thanks!
>> Jonathan
>>
>> STORMID STORMNAME CASE TYPE 1ST AIRCRAFT EYE IR
>> DATA USABLE IR EYE t_OPEN Tbmin t_CLOSED
>> Tbmin t_FIRST_EYE Tbmin t_PERSISTENT Tbmin
>> t_STRONG Tbmin DESCRIPTION AT AIRCRAFT EYE
>> Tbmin FORMATION MORPHOLOGY
>> ------- ------------ ------------------- -------------------
>> ------- ------ ------ ----------- ------
>> ------------ ----- ------------ ----- ------------
>> ----- ------------ -----
>> --------------------------- -----
>> --------------------
>> AL142008 NANA no_aircraft_data XXXXXXXXXXXXXXXXXXX
>> True True False
>> AL152008 OMAR intermittant_failure 14 Oct 2008 / 19:53
>> True True True 200810140545 -90 200810140545
>> -90 200809160115 -90 200809160115 -90 Very
>> strong, cold CDO with an embedded warm spot -90 Lots of
>> deep convection with primary band to east, was being sheared from
>> west at first - strong convection persisted near center and at one
>> point formed a col-type warm open warm spot. A strong CDO to west
>> started showing signs of rotation, then a prominent and occasional
>> broad warm spot (but not enough delta T to consider this an eye by
>> our definition) - it seems quite likely that this was the eye but it
>> took quite a while before the delta T was enough to call this a true
>> eye.
>> AL162008 SIXTEEN no_attempt XXXXXXXXXXXXXXXXXXX
>> True True False
>> AL172008 PALOMA complete_success 06 Nov 2008 / 17:07
>> True True True 200811061515 -80 200811062315 -80
>> 200811062315 -80 200811071725 -75 200811072325 -80
>> CDO with indentation and inner cold banding and warm spot. -80
>> Had lots of strong convection which died out somewhat near the
>> center, then two very powerful cells fired off and merged into a CDO
>> with some signs of rotation
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Dec 7 17:17:43 2009

This archive was generated by hypermail 2.1.8 : Thu Dec 10 2009 - 11:30:59 MST