Showing posts with label data. Show all posts
Showing posts with label data. Show all posts
Monday, February 16, 2015
pentaho data integration PDI basics
Pentaho Online Tutorial
http://infocenter.pentaho.com/help/index.jsp?topic=%2Fpdi_user_guide%2Fconcept_pdi_usr_kettle_components.html
Transformations :
* A Transformation is made of Steps linked by Hops.
* These Steps and Hops form paths through which data flows.
* Therefore its said that a Transformation is data-flow oriented.
Jobs are used to coordinate ETL activities such as:
• Defining the flow and dependencies for what order transformations should be run
• Preparing for execution by checking conditions such as, "Is my source file available?," or "Does a table exist?"
• Performing bulk load database operations
• File Management such as posting or retrieving files using FTP, copying files and deleting files
• Sending success or failure notifications through email
http://infocenter.pentaho.com/help/index.jsp?topic=%2Fpdi_user_guide%2Fconcept_pdi_usr_kettle_components.html
Transformations :
* A Transformation is made of Steps linked by Hops.
* These Steps and Hops form paths through which data flows.
* Therefore its said that a Transformation is data-flow oriented.
Jobs are used to coordinate ETL activities such as:
• Defining the flow and dependencies for what order transformations should be run
• Preparing for execution by checking conditions such as, "Is my source file available?," or "Does a table exist?"
• Performing bulk load database operations
• File Management such as posting or retrieving files using FTP, copying files and deleting files
• Sending success or failure notifications through email
Pentaho Data Integration Components
Pentaho Data Integration is composed of the following primary components:
- Spoon. Introduced earlier, Spoon is a desktop application that uses a graphical interface and editor for transformations and jobs. Spoon provides a way for you to create complex ETL jobs without having to read or write code. When you think of Pentaho Data Integration as a product, Spoon is what comes to mind because, as a database developer, this is the application on which you will spend most of your time. Any time you author, edit, run or debug a transformation or job, you will be using Spoon.
- Pan. A standalone command line process that can be used to execute transformations and jobs you created in Spoon. The data transformation engine Pan reads data from and writes data to various data sources. Pan also allows you to manipulate data.
- Kitchen. A standalone command line process that can be used to execute jobs. The program that executes the jobs designed in the Spoon graphical interface, either in XML or in a database repository. Jobs are usually scheduled to run in batch mode at regular intervals.
- Carte. Carte is a lightweight Web container that allows you to set up a dedicated, remote ETL server. This provides similar remote execution capabilities as the Data Integration Server, but does not provide scheduling, security integration, and a content management system.
Whats with all the Culinary Terms?
If you are new to Pentaho, you may sometimes see or hear Pentaho Data Integration referred to as, "Kettle." To avoid confusion, all you must know is that Pentaho Data Integration began as an open source project called. "Kettle." The term, K.E.T.T.L.E is a recursive that stands for KettleExtraction Transformation Transport Load Environment. When Pentaho acquired Kettle, the name was changed to Pentaho Data Integration. Other PDI components such as Spoon, Pan, and Kitchen, have names that were originally meant to support a "restaurant" metaphor of ETL offerings.
Wednesday, February 11, 2015
Selecting and Downloading Raster Data via ftp using Python
My problem was to browse through a large number of Radarsat-2 images on a ftp-server and download the ones falling into my area of interest. Each image is available as a *.zip file and a corresponding *.tif map projected quicklook
There is two main pieces that help solving this problem:
1) You can in fact use gdalinfo to retrieve information about a raster file on ftp without having to download the file itself. The command (which I found documented here ) is, the output is here redirected to the output_tempfile:
or calling from within Python using os.system with the variables defined before:
2) The second step is then to read the centre coordinate from the output_tempfile and if matching download the file. The ftp download is described here , lets see the whole script, which hopefully is self-explanatory with its comments:
There is two main pieces that help solving this problem:
1) You can in fact use gdalinfo to retrieve information about a raster file on ftp without having to download the file itself. The command (which I found documented here ) is, the output is here redirected to the output_tempfile:
gdalinfo /vsicurl/ftp://username:password@ftp.adress.no/outfolder/filename.tif > output_tempfile
or calling from within Python using os.system with the variables defined before:
os.system(rgdalinfo /vsicurl/ftp:// + username + : + password + "@" + ftpserver + workingfolder + file + > + output_tempfile)
2) The second step is then to read the centre coordinate from the output_tempfile and if matching download the file. The ftp download is described here , lets see the whole script, which hopefully is self-explanatory with its comments:
import ftplib, os
#DEFINE FTP SERVER PARAMETERS
ftpserver = ftp.youradress.no
username = anonymous
password = guest
workingfolder = /Out/max/
#temporary file storing location info from quicklook
output_tempfile = C:UsersmaxDesktop\test.txt
#destinationfolder for download
destination_folder = C:UsersmaxDocuments\
#Open ftp
ftp = ftplib.FTP(ftpserver, username , password)
ftp.cwd(workingfolder)
#Create a file list of all quicklooks
filelist = []
try:
filelist = ftp.nlst(*.tif)
except ftplib.error_perm, resp:
if str(resp) == "550 No files found":
print "No files in this directory"
else:
raise
for file in filelist:
#get quicklook file info and save in temporary file
os.system(rgdalinfo /vsicurl/ftp:// + username + : + password + "@" + ftpserver + workingfolder + file + > + output_tempfile)
#Read from temporary file the centre coordinates of the quicklook
search = open(output_tempfile)
for line in search:
if "Center" in line:
longitude_quicklook = float(line[15:25])
latitude_quicklook = float(line[28:38])
search.close()
print Longitude , longitude_quicklook
print Latitude , latitude_quicklook
#Check if scene is contained in area of interest, divided in two areas since not rectangular
if ((-23.0 < longitude_quicklook < 67.0) and (71.0 < latitude_quicklook < 90.0)):
contained = True
print true
elif ((-33.0 < longitude_quicklook < 14.0) and (66.0 < latitude_quicklook < 71.0)):
contained = True
print true
else:
contained = False
zipfile = file[:-7] + .zip
zipsavefile = destination_folder + file[:-7] + .zip
print zipfile
print zipsavefile
#If file contained in area of interest, download the file
if contained == True:
print transferring , zipfile
ftp.cwd(workingfolder)
ftp.retrbinary(RETR + zipfile, open(zipsavefile, wb).write)
print transferred , zipfile
#Close ftp connection
ftp.quit()
#Remove temporary file
os.remove(rC:UsersmaxDesktop est.txt)
#End
Friday, January 23, 2015
Share your devices mobile data connection via USB Wi Fi or Bluetooth
How to turn your android smartphones into Wi-Fi Router .Share your devices mobile data connection via USB,Wi-Fi or Bluetooth .
Do you know , you can turn your smartphone into portable Wi-Fi hotspot, to share its internet connection with other devices(Laptop,tablets,smartphones ). You can share your Android Device internet with computer , smartphones and tablets.This is amazing built in Android OS feature which allow other users to use your mobile data from different devices.
We will discuss these option step by step.
i) How to turn your Android mobile phone into Wi-Fi Router .
ii) How to turn your Android phone into Internet Modem .
iii) How to share your Android device mobile data via Bluetooth.
We will discuss these option step by step.
i) How to turn your Android mobile phone into Wi-Fi Router .
ii) How to turn your Android phone into Internet Modem .
iii) How to share your Android device mobile data via Bluetooth.
you need few simple steps .
1. How to turn your android smartphones into Wi-Fi Router ?
First you need to activate mobile data. (Wi-fi hotspot will work on 3g,4g and other fast services.)
Go to setting and click on More settings.

Select tethering and portable hotspot.

You will have these 3 options. Turn on Portable Wi-Fi and click on it for further options.

It will automatically turn into hotspot and will allow devices to connect. Your device name will be shown as AndroidAP from other devices .


Your devices will be shown in Wi-Fi connection of other smartphones and tablets as shown in below image.


you can Allow and Disallow other devices by tapping a + sign to be connected or not. You can allow devices to connect manually by configuring other device name and Mac Address.



2. How to turn your android phone into Internet Modem .How to use internet on computer via Android Mobile .
You can also turn your android smartphones into internet modem to use internet on computer. There is nothing difficult to turn your smartphone into internet modem.
Go to setting and click on more setting

Now select Tethering and portable hostpot .

Now select USB tethering and connect your smartphone with computer via data cable.

Computer will recognized attached device ans will start installing drivers. After installing drivers your smartphone will be attach to computer as modem. you can view it by clicking on device manager as highlighted in picture,as " Remote NDIS based Internet Sharing Device ".You can check this connection as well in My Network .

3. How to share your Android device mobile data via Bluetooth.
Following option will not work on lower then 4.3. To share your mobile data via bluetooth to other devices your smartphone or tablet must be on Android OS 4.3 or Higher. Pair your devices via bluetooth first then go to more setting . Turn on Portable Wi-Fi hotspot . Select Bluetooth tethering .

Now go to bluetooth tab. See Desired Paired Device. Click on paired device setting .You will see Internet access with bluetooth sign under Profiles tab. Click on it to allow paired device to start using internet via your device.

Note: The above method is based on Author personal experience . Found nothing harmful .
Subscribe to:
Posts (Atom)