Skip to content
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

TypeError: object of type 'NoneType' has no len() when run the "config.file" #10

Open
Yorklii opened this issue Nov 6, 2018 · 3 comments

Comments

@Yorklii
Copy link

Yorklii commented Nov 6, 2018

Dear all,
I a student working on the hydrological process, I have stepped to the "METRIC_run" in ArcMap of METRIC model (’METRIC-patch-ovr-issue‘ package), but with the file 'config.txt' from the last step output, the problems come as follow, could anyone help me with them? I will be appreciated, cuz it now the only method I find to finish my project.

"Traceback (most recent call last):
File "", line 306, in execute
File "C:\Users\yorkl\Desktop\daihai\METRIC-master\METRIC-master\METRIC\metric_py.py", line 1380, in run
mike = MetricModel(config_filepath)
File "C:\Users\yorkl\Desktop\daihai\METRIC-master\METRIC-master\METRIC\metric_py.py", line 73, in init
self.dem_path = os.path.join(self.work_dir, config["dem_path"])
File "C:\Python27\ArcGIS10.6\Lib\ntpath.py", line 67, in join
p_drive, p_path = splitdrive(p)
File "C:\Python27\ArcGIS10.6\Lib\ntpath.py", line 115, in splitdrive
if len(p) > 1:
TypeError: object of type 'NoneType' has no len()

Failed to execute (METRIC_run)."

@Yorklii
Copy link
Author

Yorklii commented Nov 6, 2018

this is my 'config.txt' file
param_name ; param_type ; param_value
crop_type ; <type 'unicode'> ; alfalfa
mountains ; <type 'bool'> ; False
dem_dir ; <type 'str'> ; input_dem
metric_workspace ; <type 'unicode'> ; C:\Users\yorkl\Desktop\daihai\outputs
out_dir ; <type 'str'> ; output
landsat_band2 ; <type 'unicode'> ; input_landsat\LC08_L1TP_126032_20160728_20170322_01_T1_B3.TIF
landsat_band3 ; <type 'unicode'> ; input_landsat\LC08_L1TP_126032_20160728_20170322_01_T1_B3.TIF
clip_extent ; <type 'NoneType'> ; None
cold_shp_path ; <type 'str'> ; C:\Users\yorkl\Desktop\daihai\endmember\farmig.shp
landsat_band6 ; <type 'unicode'> ; input_landsat\LC08_L1TP_126032_20160728_20170322_01_T1_B6.TIF
landsat_band7 ; <type 'unicode'> ; input_landsat\LC08_L1TP_126032_20160728_20170322_01_T1_B7.TIF
landsat_band4 ; <type 'unicode'> ; input_landsat\LC08_L1TP_126032_20160728_20170322_01_T1_B4.TIF
landsat_band5 ; <type 'unicode'> ; input_landsat\LC08_L1TP_126032_20160728_20170322_01_T1_B5.TIF
L_green_fac ; <type 'float'> ; 0.5
weather_dir ; <type 'str'> ; input_weather
dem_path ; <type 'NoneType'> ; None
timezone ; <type 'int'> ; 0
geodatabase ; <type 'str'> ; scratch
ref_pixel_dir ; <type 'str'> ; input_ref_pixels
testflag ; <type 'unicode'> ; ET-ONLY
config_filepath ; <type 'str'> ; config.txt
recalc ; <type 'bool'> ; True
wx_elev ; <type 'int'> ; 1
hot_shp_path ; <type 'str'> ; C:\Users\yorkl\Desktop\daihai\endmember\Unclassified.shp
landsat_band10 ; <type 'unicode'> ; input_landsat\LC08_L1TP_126032_20160728_20170322_01_T1_B10.TIF
landsat_band11 ; <type 'unicode'> ; input_landsat\LC08_L1TP_126032_20160728_20170322_01_T1_B11.TIF
wx_zom ; <type 'float'> ; 0.01
LE_ref ; <type 'float'> ; 1.05
landsat_meta ; <type 'unicode'> ; input_landsat\LC08_L1TP_126032_20160728_20170322_01_T1_MTL.txt
weather_path ; <type 'unicode'> ; input_weather\cl20167.txt
middle_dir ; <type 'str'> ; intermediate_calculations
landsat_dir ; <type 'str'> ; input_landsat

@dgketchum
Copy link

dgketchum commented Nov 7, 2018 via email

@Yorklii
Copy link
Author

Yorklii commented Nov 16, 2018

If you're interested in working with METRIC, I highly recommend you check out pyMETRIC (https://github.com/DRI-WSWUP/pymetric). It uses only open-source python tools, and is under active development. As far as I can tell NASA-DEVELOP METRIC was never completely implemented, and hasn't been touched in a couple of years. Cheers, David

On Tue, Nov 6, 2018 at 1:50 AM Yorklii @.***> wrote: this is my 'config.txt' file param_name ; param_type ; param_value crop_type ; <type 'unicode'> ; alfalfa mountains ; <type 'bool'> ; False dem_dir ; <type 'str'> ; input_dem metric_workspace ; <type 'unicode'> ; C:\Users\yorkl\Desktop\daihai\outputs out_dir ; <type 'str'> ; output landsat_band2 ; <type 'unicode'> ; input_landsat\LC08_L1TP_126032_20160728_20170322_01_T1_B3.TIF landsat_band3 ; <type 'unicode'> ; input_landsat\LC08_L1TP_126032_20160728_20170322_01_T1_B3.TIF clip_extent ; <type 'NoneType'> ; None cold_shp_path ; <type 'str'> ; C:\Users\yorkl\Desktop\daihai\endmember\farmig.shp landsat_band6 ; <type 'unicode'> ; input_landsat\LC08_L1TP_126032_20160728_20170322_01_T1_B6.TIF landsat_band7 ; <type 'unicode'> ; input_landsat\LC08_L1TP_126032_20160728_20170322_01_T1_B7.TIF landsat_band4 ; <type 'unicode'> ; input_landsat\LC08_L1TP_126032_20160728_20170322_01_T1_B4.TIF landsat_band5 ; <type 'unicode'> ; input_landsat\LC08_L1TP_126032_20160728_20170322_01_T1_B5.TIF L_green_fac ; <type 'float'> ; 0.5 weather_dir ; <type 'str'> ; input_weather dem_path ; <type 'NoneType'> ; None timezone ; <type 'int'> ; 0 geodatabase ; <type 'str'> ; scratch ref_pixel_dir ; <type 'str'> ; input_ref_pixels testflag ; <type 'unicode'> ; ET-ONLY config_filepath ; <type 'str'> ; config.txt recalc ; <type 'bool'> ; True wx_elev ; <type 'int'> ; 1 hot_shp_path ; <type 'str'> ; C:\Users\yorkl\Desktop\daihai\endmember\Unclassified.shp landsat_band10 ; <type 'unicode'> ; input_landsat\LC08_L1TP_126032_20160728_20170322_01_T1_B10.TIF landsat_band11 ; <type 'unicode'> ; input_landsat\LC08_L1TP_126032_20160728_20170322_01_T1_B11.TIF wx_zom ; <type 'float'> ; 0.01 LE_ref ; <type 'float'> ; 1.05 landsat_meta ; <type 'unicode'> ; input_landsat\LC08_L1TP_126032_20160728_20170322_01_T1_MTL.txt weather_path ; <type 'unicode'> ; input_weather\cl20167.txt middle_dir ; <type 'str'> ; intermediate_calculations landsat_dir ; <type 'str'> ; input_landsat — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#10 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/ALg6Mp3L2DymL6kUy5JB1jrfyIaq5DE6ks5usU07gaJpZM4YPxFh .
-- David Ketchum Hydrologist, PhD Student Montana DNRC College of Forestry and Conservation, University of Montana Missoula, MT c. 8022227119

Thank you so much, Sir, I will try it later.
Best regards.
Yu LI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants