-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limited resampling methods with convertModisGDAL #110
Comments
Hi Jess, sorry for the delay in the answer. I check the code and It should work, I have not time to test right now, I will try in the next days |
Hi Luca,
Great to hear from you. Would be nice to figure out what is going on here. Let me know once you’ve had a chance to look at it.
Thanks for your help with this.
Jess
From: Luca Delucchi <[email protected]>
Reply-To: lucadelu/pyModis <[email protected]>
Date: Monday, 27 August 2018 at 15:04
To: lucadelu/pyModis <[email protected]>
Cc: Jess Baker <[email protected]>, Author <[email protected]>
Subject: Re: [lucadelu/pyModis] Limited resampling methods with convertModisGDAL (#110)
Hi Jess, sorry for the delay in the answer.
I check the code and It should work, I have not time to test right now, I will try in the next days
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#110 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AmNM9PbkOnvzybyaAiy-sd3s22tSCOl6ks5uU_xcgaJpZM4UgBhJ>.
|
Hi Luca, Just wondering if you had a chance to look at this? I am still keen to get this working if I can, as it seems a straightforward way to regrid. Can you post some example working script using BILINEAR interpolation instead of NEAREST_NEIGHBOUR? Thanks so much. Jess |
Hi Jess, no sorry, I had no time, could you please share one of you dataset? So I will test with it thanks |
Hi Jess: from pymodis import convertmodis_gdal createMosaic = convertmodis_gdal.createMosaicGDAL( However, the failure occurred on the following codes: C:\Users\wwg\AppData\Local\Programs\Python\Python37\python.exe E:/f/modis/mosaic/pymodis_mosaic.py Process finished with exit code 1 Any suggestions could you give me, thanks a lot. Weiguo Wang |
Hi Weiguo, I think @lucadelu will be able to answer your question better than me at pymodis is their package, but it seems from your error message that you are missing the xml file that needs to accompany the hdf files. These aren't automatically provided but can be obtained by appending ".xml" to the end of the links that you used to download the MODIS hdf files (assuming you used wget and a file containing the download links). Hope that helps! Jess |
Hi Jess and Luca, Weiguo Wang |
Hello,
I am using the pymodis module to process MOD16A2 evapotranspiration files. I have mosaicked the data and am trying to convert to a lower resolution geotiff file using convertModisGDAL. My script works fine for the following resampling methods: 'AVERAGE', 'MODE', 'NEAREST_NEIGHBOUR' but doesn't work for 'BILINEAR', 'CUBIC', 'CUBIC_SPLINE' or 'LANCZOS'. I would ideally like to use a bilinear interpolation to reproject the data. Do you know why this method might be failing?
Some code:
import pymodis
import os
import glob
import gdal
import cf_units
from pymodis.convertmodis_gdal import createMosaicGDAL
from pymodis.convertmodis_gdal import convertModisGDAL
path = '/…/MODIS_ET/hdf_files_V006/data/'
year = str(2001)
day = str(1).zfill(3)
subset = [1,0,0,0,0,0,0]
Change to data directory
fpath = path + year + '/' + day + '/'
os.chdir(fpath)
Set up output variable names
output_tif = 'MOD16A2.A' + year + day + '.mosaic.tif'
output_pref = os.path.join(fpath, 'MOD16A2.A' + year + day + '.mosaic')
Get list of all hdf files in directory
fnames = glob.glob(os.path.join(fpath, '*.hdf'))
Mosaic MODIS data from hdf
mosaic = createMosaicGDAL(fnames, subset, outformat='GTiff')
mosaic.run(output_tif)
Write VRT file (format driver for GDAL)
mosaic.write_vrt(output_pref)
collect names of vrt files
vrtfiles = glob.glob(os.path.join(fpath, 'MOD16A2*.vrt'))
Convert mosaic to tiff
for f in vrtfiles:
base = os.path.basename(f).replace('.vrt', '_vrt')
output = os.path.join(fpath, base)
convertsingle = convertModisGDAL(hdfname=f, prefix=output,
subset=subset, epsg=4326,
vrt=True, res=0.25,
resampl=’BILINEAR’)
convertsingle.run_vrt_separated()
ERROR
Traceback (most recent call last):
File "", line 1, in
convertsingle.run_vrt_separated()
File "/nfs/see-fs-02_users/earjba/anaconda3/lib/python3.6/site-packages/pymodis/convertmodis_gdal.py", line 277, in run_vrt_separated
self._reprojectOne(self.in_name)
File "/nfs/see-fs-02_users/earjba/anaconda3/lib/python3.6/site-packages/pymodis/convertmodis_gdal.py", line 266, in _reprojectOne
'{name}'.format(name=l))
Exception: Not possible to reproject dataset /nfs/a68/gyjcab/datasets/MODIS_ET/hdf_files_V006/data/2001/001/MOD16A2.A2001001.mosaic_ET_500m.vrt
Many thanks,
Jess
The text was updated successfully, but these errors were encountered: