0% found this document useful (0 votes)
24 views2 pages

Python Scripting Due by Friday 1-Feb-2013 5pm: Dlverbyla@alaska - Edu

The document provides instructions for a Python scripting assignment due on February 1, 2013 at 5pm. Students are asked to write 4 Python scripts (.py files) to perform operating system tasks like creating directories and subfolders using climate data. The scripts should create folders for each month of the year, years from 2000 to 2013, subfolders for each month inside the year folders, and check that shapefiles have defined coordinate systems. Help is available during a class or by email.

Uploaded by

manalva
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views2 pages

Python Scripting Due by Friday 1-Feb-2013 5pm: Dlverbyla@alaska - Edu

The document provides instructions for a Python scripting assignment due on February 1, 2013 at 5pm. Students are asked to write 4 Python scripts (.py files) to perform operating system tasks like creating directories and subfolders using climate data. The scripts should create folders for each month of the year, years from 2000 to 2013, subfolders for each month inside the year folders, and check that shapefiles have defined coordinate systems. Help is available during a class or by email.

Uploaded by

manalva
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

NRM638 Spring 2013 Python Scripting Due By Friday 1-Feb-2013 5pm

Python scripting

If you are on the UAF campus, I will help you during class time Monday 3:30 pm ONEILL 359. If your off-campus, you can email me any scripting problems as they arise and I will try to email you back the same day. The Python os module allows you to perform operating system tasks such as making directories (folders), renaming files, and listing files. The os.mkdir() function allows you to make a directory using your python script. Email me at [email protected] your four python script .py files. I need them by Friday 1-Feb-2013 5pm, so I can grade all the student scripts on Saturday. 1) You will be working with SNAP climate data as monthly mean temperature and monthly total precipitation rasters. Write a python script named months.py that creates a folder for each month of the yearsubdirectories Jan, Feb, MarDec

2) Write a python script named years.py that creates folders from 2000 to 2013.

3) Write a python scripted named MonthsYear.py that creates month folders inside each of your existing subdirectories 2000, 2001, 2013.

NRM638 Spring 2013

Python scripting

4) Write a script named check_shapefiles.py that will check that of all shapefiles in a folder have a defined coordinate system. A *.shp file would have a companion *.prj file if it has a defined coordinate system Download and unzip the file Shapefiles.exe from http://nrm.salrm.uaf.edu/~dverbyla/nrm638/data For example, the script discovers the following :

As an example,

You can do this by using the glob module to create a list of files *.shp, then stripping off the shp extension, and searching for the companion .prj file. For example, for one shapefile line2.shp

You might also like