Results 1 to 10 of 10

Thread: Off Topic thread

  1. #1
    Join Date
    Apr 2011
    Location
    Alexandria
    Posts
    873
    Post Thanks / Like

    Question Off Topic thread

    Is there a thread or place for off-topic posts not related to cycling? If the admins don't want any non-cycling threads I understand and I guess you can just delete this one. But, since we're all much more than just cycling I figured I would ask for some help on a work topic just in case and maybe get an off-topic thread started.

    I know there are a couple of IT folks here and I'm hoping some folks will also have some programming knowledge. Does anyone know Python (2.5 preferably) and is anyone familiar with .kml files? I have two separate issues relating to the same task.

    Specifically:
    1) I can download a zipped folder from the web using a simple python program, but how can I open a zipped folder in python once it's on a local drive? How about a .tar.gz file? I can't find any code snippets on the python forums that can help me do this.
    2) Using a kml wrapper on a tif file to display it in GoogleEarth, can I manipulate the color scheme in the tif file with the wrapper? I'm thinking no.

    If you think you can help please e-mail me.

    Thanks!
    Chris

  2. #2
    jrenaut's Avatar
    jrenaut is offline I really need to log off the internet and go for a ride.
    Join Date
    Dec 2010
    Location
    Columbia Heights, DC
    Posts
    2,589
    Post Thanks / Like

    Default

    Are you stuck with Python 2.5, or can you upgrade? A quick Google suggests that unzipping got a lot easier with 2.6.

    I'm not quite sure what you mean on #2 - is this something you could do outside of Python, like in GoogleEarth or something? Or are you asking both if it can be done, and if so if it can be done in Python?

    I'm I guess an experienced amateur in Python. I don't use it at work, but i use it for all my personal projects. And I generally use 2.7.

  3. #3
    Join Date
    Feb 2012
    Location
    cincy
    Posts
    114
    Post Thanks / Like

    Default

    HA! I'm literally sitting here unzipping hundreds of .tar.gz files one after another. I've never dealt with them before this task.

    The best way i found of extracting them was by downloading the program called 7-zip (hopefully you have windows as that's its only compatibility).
    That program will let you unzip any type of zip basiclally.
    Right click it as usual, go to the 7-zip option, click "extract files" or "extract here" if you want it put in the same folder you're currently in.

    (The .tar.gz will create a new folder in which you'll find a .tar, just right click and extract that one as well and you'll finally get the whole thing opened.)

  4. #4
    Join Date
    Apr 2011
    Location
    Alexandria
    Posts
    873
    Post Thanks / Like

    Default

    Thanks for the replies guys.

    Quote Originally Posted by jrenaut View Post
    Are you stuck with Python 2.5, or can you upgrade? A quick Google suggests that unzipping got a lot easier with 2.6.
    I think I found similar information too. I think I'll suggest we upgrade our python then because you're right, it did seem much easier according to programmer forum posts. If upgrading is possible, hopefully my other little programs will still work.

    I'm I guess an experienced amateur in Python. I don't use it at work, but i use it for all my personal projects. And I generally use 2.7.
    I'm kinda the same way, but less so. I generally learn enough to do what I need to do with it and nothing more.

    #2 is a separate non-python question. It's more about familiarity with kml files, GoogleEarth and GIS. For example, I created a kml wrapper to display 12-18 MODIS images from the NASA website at one time as overlays on GoogleEarth. Similarly I used a small kml wrapper to overlay the tif file, which is a global modeled snow forecast but it's an impossible to see gray scale and basically useless. I suppose I could try downloading the shapefile and see about automatically manipulating it in ArcMap instead? Oiy... I don't know if I'm capable of that!

    @Spokes
    We started using 7-zip here too and it's very user friendly. Ultimately I'm trying to automate the downloading and unzipping process though so that one doesn't have to do it by hand at all. Like if you had a little untar/unzip python program you could probably get the program running then spend the next 30 minutes shopping for your dream bike while the program does all the work.

  5. #5
    jrenaut's Avatar
    jrenaut is offline I really need to log off the internet and go for a ride.
    Join Date
    Dec 2010
    Location
    Columbia Heights, DC
    Posts
    2,589
    Post Thanks / Like

    Default

    Ok, #2 I can't really help - I don't know anything about KML and related stuff.

    I think going from 2.5 to 2.6 or 2.7 isn't a big deal. 3, on the other hand . . .

  6. #6
    Join Date
    Feb 2012
    Location
    cincy
    Posts
    114
    Post Thanks / Like

    Default

    Quote Originally Posted by creadinger View Post
    We started using 7-zip here too and it's very user friendly. Ultimately I'm trying to automate the downloading and unzipping process though so that one doesn't have to do it by hand at all. Like if you had a little untar/unzip python program you could probably get the program running then spend the next 30 minutes shopping for your dream bike while the program does all the work.
    then please, for the love of god pass this info along when you figure it out. i just had to unzip 500 of those things manually. yesterday and friday.

  7. #7
    Join Date
    Apr 2011
    Location
    Alexandria
    Posts
    873
    Post Thanks / Like

    Default

    Quote Originally Posted by SpokeGrenadeSR View Post
    then please, for the love of god pass this info along when you figure it out. i just had to unzip 500 of those things manually. yesterday and friday.
    Hey man, I think I figured it out! I did a lot more searching and digging and finally found a piece of code that I could use. Here's an example mini-program that opens a .tar.gz file, extracts all the files in it, and then closes the file again.

    #!/usr/bin/python
    import tarfile

    #This part opens file, extracts contents, and puts them in a designated folder.
    print 'Uncompressing files'
    tar = tarfile.open('Pathtofile\File.tar.gz')
    tar.extractall('Pathtoputextractedstuff\\')
    tar.close()

    If you're more of a programming wiz than me, then you could have it loop over all of the files you have to open. Otherwise, you could just hardwire it to extract all 500 of the files you have to do. If they have a naming pattern or similar names at least you could pretty quickly build up the lines of code using a excel, or a word macro.

  8. #8
    jrenaut's Avatar
    jrenaut is offline I really need to log off the internet and go for a ride.
    Join Date
    Dec 2010
    Location
    Columbia Heights, DC
    Posts
    2,589
    Post Thanks / Like

    Default

    I think os.listdir will list filenames in your folder, so you could pass those to tarfile.open()

    Don't have Python on my work computer (damn federal government) so I can't check.

  9. #9
    Join Date
    Apr 2011
    Location
    Alexandria
    Posts
    873
    Post Thanks / Like

    Default

    I was early on the scene to a medical emergency in Arlington yesterday - On Columbia Pike near S. Glebe Rd. I was one of the first to call 911 and I've never ever done that before, which was a tad scary. There was an unresponsive elderly person in a car parked in the left lane of Columbia Pike. Does anyone know where I could possibly get an update on their condition? It was a bit traumatic to see the FD pull up to the scene and initiate CPR.

    This is the only info I can find in the traffic section of ARLnow as it was happening yesterday.
    http://www.arlnow.com/2012/04/26/lan...cal-emergency/

  10. #10
    Join Date
    Apr 2010
    Location
    Capitol Hill
    Posts
    1,375
    Post Thanks / Like

    Default

    Quote Originally Posted by creadinger View Post
    I was early on the scene to a medical emergency in Arlington yesterday - On Columbia Pike near S. Glebe Rd. I was one of the first to call 911 and I've never ever done that before, which was a tad scary. There was an unresponsive elderly person in a car parked in the left lane of Columbia Pike. Does anyone know where I could possibly get an update on their condition? It was a bit traumatic to see the FD pull up to the scene and initiate CPR.

    This is the only info I can find in the traffic section of ARLnow as it was happening yesterday.
    http://www.arlnow.com/2012/04/26/lan...cal-emergency/
    I've wondered about this sort of thing since I saw someone undergoing CPR at the Cherry Blossom 10-miler. I take the fact that I never heard any follow-up as good news. I figure if they had died, the information would have been released, but if they were in medical care it was still confidential.

    Don't know if that's true but it helps me sleep at night.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •