You are expected to have a python environment with numpy, matplotlib, scikit-learn and optionally jupyter installed.
Please write your code in a private repository using a version control system (git). Make a tar ball or a zip file of your repository and submit it by email.
If you have questions regarding the following instructions, please create an issue or send us an email.
- Install gdal (version>=3) using conda/pip/...
- Open a jupyter notebook session or any python session with access to installed gdal
- Load data of all bands from swir_ortho_standardized.tif to a numpy array using gdal. The loaded numpy array should have a shape of (8, 653, 502). Hints:
- Use
ds = gdal.Open(path)to open a dataset - Use
data = ds.ReadAsArray()to read data - 653 is number of rows, 502 is number of columns, 8 is number of bands. For each pixel, the data in the 8 bands forms a spectrum for that pixel.
- Use
- Load the "facility spectrum" numpy array from facility_spectrum_standardized.npy using
np.load - Calculate the cosine similarity of the spectra of all pixels with the given "facility spectrum" loaded in the previous step using
np.dot, and save the output as an array of shape (653, 502), matching the input image - Plot the cosine similarity using matplotlib and save the plot to an image
- Use 0.995 as the threshold, create a mask array where pixels with
cosine_similarity > thresholdare labeled with value1, and other pixels labeled with value0. Plot the mask and save it to an image
- Instead of just one spectrum in facility_spectrum_standardized.npy, here we need to calculate cosine similarity of spectra for all pixels with 100 reference spectra saved in ref_spectra_standardized.npy. The result should be a 653X502X100 numpy array. You don't need to submit the final result, but please submit your code. Does your code leverage numpy vectorized computation?
- Load training data from train_swir_nr.npy (X) and train_concentration.npy (y). X has 28 features
- Fit X to y using a regression model. Please explain the reason behind your choice of regressor.
- Make a plot of y_pred (predicted y values from your regression model) vs y
- Predict y_test from test data test_swir_nr.npy (Xtest) and save it as a numpy array
- Is there a way to reduce the number of features? Discuss and code.
- Record your solution in a jupyter notebook or a python script
- Data: Satelytics_High_ONA_Sample_SO18013350-3-01_DS_PHR1A_201605121741085_FR1_PX_W097N35_0423_00596.zip
- Purpose: orthorectify the image
Hints if using OTB for this exercise:
- Install OTB (version>=6.6) in a linux box https://www.orfeo-toolbox.org/CookBook/Installation.html#linux
- Use the command
otbcli_OrthoRectification- Instruction: https://www.orfeo-toolbox.org/CookBook/Applications/app_OrthoRectification.html
- Input image in the zip file: 2986325101/IMG_PHR1A_P_001/DIM_PHR1A_P_201605121741085_SEN_2986325101-1.XML
- Use the "skipcarto=true" trick
- DEM: do not use DEM for this exercise
- Interpolation option: use "nn"
- Output a geotiff file
- Plot the orthorectified image and save it
- Wrap the orthorectification procedure in a python function
- Write a test function for the new python function you created in the last step