cfusting / arctic-browning

Research code exploring why the arctic is getting brown.
1 stars 1 forks source link

Process snow data #8

Open cfusting opened 7 years ago

cfusting commented 7 years ago

Have a look at extract_lst_data.py, extract_lst.sh, extract_lst_job.sh for an example of how to do this.

cfusting commented 7 years ago

Let's explore dealing directly with the hdf files. Here is an example of exploring and hdf file and getting the data.

from pyhdf.SD import SD, SDC
import numpy as np
f = SD("tests/MOD13A3.A2014274.h20v02.006.2015291193621.hdf", SDC.READ)
for i in f.datasets():
    print i
data = f.select("1 km monthly NDVI")
print data.get()
data.attributes()

See also this post for further ideas. I'm not convinced as to whether we should put back the masked data directly into the original hdf file or if we should begin to construct some "master" hdf file that will hold all the data we wish to use in our model. Either way if dealing directly with the hdf files works out I'd like to go ahead and have you refactor the existing methods to do so as well.