Python: script to import multiple LANDSAT images to Grass GIS
By : Thevoidrzx
Date : March 29 2020, 07:55 AM
hope this fix your issue I believe your main problem is that dirname in os.walk() returns a list (not a string), so your subsequent strings (namely dirname = os.path.join(dirpath,dirname)) are a bit malformed. Here is one possible alternative - to test this, I used the full path to the directory as sys.argv[1], but you can make it more dynamic to suit your case. Also, avoid using variable names such as file since they are Python keywords. I couldn't test out your grass.* functions, but hopefully this will be a clear enough example so you can tweak how you need. os.walk() natively handles a lot of standard parsing, so you can remove some of the directory-manipulating functions: code :
def import_tifs(dirpath):
for dirpath, dirname, filenames in os.walk(dirpath):
# Iterate through the files in the current dir returned by walk()
for tif_file in filenames:
# If the suffix is '.TIF', process
if tif_file.upper().endswith('.tif'):
# This will contain the full path to your file
full_path = os.path.join(dirpath, tif_file)
# tif_file will already contain the name, so you can call from here
grass.message('Importing %s -> %s@%s...' % (full_path, tif_file, dirpath))
grass.run_command('r.in.gdal',
flags = 'o',
input = full_path,
output = tif_file,
quiet = True,
overwrite = True)
|
Python script to read LANDSAT XML metafile
By : Mike Skutta
Date : March 29 2020, 07:55 AM
|
Python xarray: Extract first and last time value within each month of a timeseries
By : cycneavox
Date : March 29 2020, 07:55 AM
wish of those help Since 'time' is a coordinate in the DataArray you provided, for the moment it is not possible1 preform resample directly upon it. A possible workaround is to create a new DataArray with the time coordinate values as a variable (still linked with the same coordinate 'time') If arr is the DataArray you are starting from I would suggest something like this: code :
time = xray.DataArray(arr.time.values, coords=[arr.time.values], dims=['time'])
time_first = time.resample('1M', 'time', how='first')
time_last = time.resample('1M', 'time', how='last')
time_diff = time_last - time_first
|
Google Earth Engine: how to map a function over a collection of all Landsat sensors to create NDVI timeseries
By : Avelar
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further The system:time_start property was lost at the masking stage. This property is necessary for plotting time series, as it is used to construct the time axis. Change those two functions to reassign that property to the image the functions return, as in: code :
var maskL8SR = function(image) {
// Bits 3 and 5 are cloud shadow and cloud, respectively.
var cloudShadowBitMask = ee.Number(2).pow(3).int();
var cloudsBitMask = ee.Number(2).pow(5).int();
// Get the QA band.
var qa = image.select('pixel_qa');
// Both flags should be set to zero, indicating clear conditions.
var mask = qa.bitwiseAnd(cloudShadowBitMask).eq(0)
.and(qa.bitwiseAnd(cloudsBitMask).eq(0));
return image
// Scale the data to reflectance and temperature.
.select(['B4', 'B5'], ['Red', 'NIR']).multiply(0.0001)
.updateMask(mask)
.set('system:time_start', image.get('system:time_start'));
};
|
Extract all noon data from a timeseries
By : Hsu Ming-Yi
Date : March 29 2020, 07:55 AM
|