bleutner / RStoolbox

Remote Sensing Data Analysis in R 🛰
260 stars 82 forks source link

readMeta fails to read Landsat MSS metadata (*MTL.txt) files #7

Closed aszeitz closed 8 years ago

aszeitz commented 8 years ago

Hi,

Thanks bleutner for this package, it has been very helpful so far in processing Landsat scenes!

An issue I have encountered is that readMeta fails to properly load the *MTL.txt metadata files from the various Landsat MSS scenes I have tried to process.

Here is a basic example of trying to load the metadata and the error it throws:

meta <- readMeta("./MSS/1978/LM30520251978217PAC03_MTL.txt")

Error in `rownames<-`(`*tmp*`, value = "B6_dn") : 
attempt to set 'rownames' on an object with no dimensions

and if I use the example you provide in the documentation, readMeta throws a different error because mtlFile is only an empty character vector.

mtlFile <- system.file("./MSS/1978/LM30520251978217PAC03_MTL.txt", package = "RStoolbox")
print(mtlFile)
[1] ""

meta <- readMeta(mtlFile)

Error: Metadata file does not exist. Looking for:

I have attached one of the metadata .txt files as obtained when the MSS scene was downloaded from the USGS. Any suggestions on how to get around this issue if I am trying to run radCor and topCor on the MSS data?

LM30520251978217PAC03_MTL.txt

Thanks, Andras

bleutner commented 8 years ago

Hi Andras,

thanks for reporting. I think it should work now if you install the current Github version.

Out of interest: where did you download this data from? I wasn't aware that USGS are now offering reflectance scaling coefficients for MSS data, which is pretty cool. I tried to find it on EarthExplorer but couldn't.

Let me know if it works

aszeitz commented 8 years ago

Hi,

Thank you for your work to provide the update. readMeta does indeed work with MSS metadata now. However, another issue popped up as I re-ran my processing script with the MSS data. radCor only converts the first of the four MSS bands, regardless of whether any other processing has been done, like topCor or if it's directly fed from stackMeta.

For example:

mss_sref <- radCor(mss_stack, mtl, method = "costz", bandSet = "full",
                                verbose = TRUE)

Bands to convert to reflectance: B4_dn
Excluding bands: B5_dn, B6_dn, B7_dn
hazeValues was not provided -> Estimating hazeValues automatically
hazeValues estimated as: 19
Selecting atmosphere: 'moderate'
Processing radiance / reflectance

Explicitly setting the bands for bandSet makes no difference either. I'm unsure if this might be intentional (if there is some reason that invalidates the other bands from having radiometric corrections applied), or a bug, or user error. On a side note, I also applied topCor to the MSS data and it worked fine.

As for your question, I downloaded the MSS data from the USGS's bulk data downloader: Landsat Data Bulk Download *login required

And for the Data Set: "Landsat Archive:L1-5 MSS" and I provided a Scene List with the scene ID's.

bleutner commented 8 years ago

There was a look-up mismatch with the haze look-up tables which expected bands 1 to 4, but in Landsat 1-3 these bands are designated bands 4 to 7... It should be fixed now.

aszeitz commented 8 years ago

It works great now. Thank you very much!

sethilana commented 7 years ago

I have tried installing RStoolbox as a zip file from github and it installed but when I load the MTL file I get an empty "" FILE. Iam using R version 3.3.4 in windows 10. Please help Sethi

bleutner commented 7 years ago

Could you please provide the MTL file which doesn't work or are you referring to the one in this issue?

sethilana commented 7 years ago

Hi Thanx for your response. Attached are the 2 MTL files I have tried

Kind regards

On Mon, Jan 30, 2017 at 2:51 PM, Benjamin Leutner notifications@github.com wrote:

Could you please provide the MTL file which doesn't work or are you referring to the one in this issue?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bleutner/RStoolbox/issues/7#issuecomment-276055114, or mute the thread https://github.com/notifications/unsubscribe-auth/AYLcX604ChT2PJBTUbF6CxKQTeJAES66ks5rXdzYgaJpZM4Im_GE .

GROUP = L1_METADATA_FILE GROUP = METADATA_FILE_INFO ORIGIN = "Image courtesy of the U.S. Geological Survey" REQUEST_ID = "0501506192654_00064" LANDSAT_SCENE_ID = "LC81710742015170LGN00" FILE_DATE = 2015-06-19T15:47:57Z STATION_ID = "LGN" PROCESSING_SOFTWARE_VERSION = "LPGS_2.5.1" END_GROUP = METADATA_FILE_INFO GROUP = PRODUCT_METADATA DATA_TYPE = "L1T" ELEVATION_SOURCE = "GLS2000" OUTPUT_FORMAT = "GEOTIFF" SPACECRAFT_ID = "LANDSAT_8" SENSOR_ID = "OLI_TIRS" WRS_PATH = 171 WRS_ROW = 74 NADIR_OFFNADIR = "NADIR" TARGET_WRS_PATH = 171 TARGET_WRS_ROW = 74 DATE_ACQUIRED = 2015-06-19 SCENE_CENTER_TIME = "08:06:13.1718013Z" CORNER_UL_LAT_PRODUCT = -19.17947 CORNER_UL_LON_PRODUCT = 27.22066 CORNER_UR_LAT_PRODUCT = -19.16369 CORNER_UR_LON_PRODUCT = 29.41701 CORNER_LL_LAT_PRODUCT = -21.29669 CORNER_LL_LON_PRODUCT = 27.22367 CORNER_LR_LAT_PRODUCT = -21.27901 CORNER_LR_LON_PRODUCT = 29.44993 CORNER_UL_PROJECTION_X_PRODUCT = 523200.000 CORNER_UL_PROJECTION_Y_PRODUCT = -2120700.000 CORNER_UR_PROJECTION_X_PRODUCT = 754200.000 CORNER_UR_PROJECTION_Y_PRODUCT = -2120700.000 CORNER_LL_PROJECTION_X_PRODUCT = 523200.000 CORNER_LL_PROJECTION_Y_PRODUCT = -2355000.000 CORNER_LR_PROJECTION_X_PRODUCT = 754200.000 CORNER_LR_PROJECTION_Y_PRODUCT = -2355000.000 PANCHROMATIC_LINES = 15621 PANCHROMATIC_SAMPLES = 15401 REFLECTIVE_LINES = 7811 REFLECTIVE_SAMPLES = 7701 THERMAL_LINES = 7811 THERMAL_SAMPLES = 7701 FILE_NAME_BAND_1 = "LC81710742015170LGN00_B1.TIF" FILE_NAME_BAND_2 = "LC81710742015170LGN00_B2.TIF" FILE_NAME_BAND_3 = "LC81710742015170LGN00_B3.TIF" FILE_NAME_BAND_4 = "LC81710742015170LGN00_B4.TIF" FILE_NAME_BAND_5 = "LC81710742015170LGN00_B5.TIF" FILE_NAME_BAND_6 = "LC81710742015170LGN00_B6.TIF" FILE_NAME_BAND_7 = "LC81710742015170LGN00_B7.TIF" FILE_NAME_BAND_8 = "LC81710742015170LGN00_B8.TIF" FILE_NAME_BAND_9 = "LC81710742015170LGN00_B9.TIF" FILE_NAME_BAND_10 = "LC81710742015170LGN00_B10.TIF" FILE_NAME_BAND_11 = "LC81710742015170LGN00_B11.TIF" FILE_NAME_BAND_QUALITY = "LC81710742015170LGN00_BQA.TIF" METADATA_FILE_NAME = "LC81710742015170LGN00_MTL.txt" BPF_NAME_OLI = "LO8BPF20150619072700_20150619081108.02" BPF_NAME_TIRS = "LT8BPF20150619072303_20150619081203.02" CPF_NAME = "L8CPF20150401_20150630.03" RLUT_FILE_NAME = "L8RLUT20150303_20431231v11.h5" END_GROUP = PRODUCT_METADATA GROUP = IMAGE_ATTRIBUTES CLOUD_COVER = 0.00 CLOUD_COVER_LAND = 0.00 IMAGE_QUALITY_OLI = 9 IMAGE_QUALITY_TIRS = 9 TIRS_SSM_POSITION_STATUS = "NOMINAL" ROLL_ANGLE = -0.001 SUN_AZIMUTH = 35.71310933 SUN_ELEVATION = 37.22810550 EARTH_SUN_DISTANCE = 1.0161032 GROUND_CONTROL_POINTS_VERSION = 2 GROUND_CONTROL_POINTS_MODEL = 515 GEOMETRIC_RMSE_MODEL = 6.107 GEOMETRIC_RMSE_MODEL_Y = 4.357 GEOMETRIC_RMSE_MODEL_X = 4.280 GROUND_CONTROL_POINTS_VERIFY = 194 GEOMETRIC_RMSE_VERIFY = 2.909 END_GROUP = IMAGE_ATTRIBUTES GROUP = MIN_MAX_RADIANCE RADIANCE_MAXIMUM_BAND_1 = 736.16266 RADIANCE_MINIMUM_BAND_1 = -60.79255 RADIANCE_MAXIMUM_BAND_2 = 753.83954 RADIANCE_MINIMUM_BAND_2 = -62.25232 RADIANCE_MAXIMUM_BAND_3 = 694.65668 RADIANCE_MINIMUM_BAND_3 = -57.36497 RADIANCE_MAXIMUM_BAND_4 = 585.77362 RADIANCE_MINIMUM_BAND_4 = -48.37338 RADIANCE_MAXIMUM_BAND_5 = 358.46426 RADIANCE_MINIMUM_BAND_5 = -29.60209 RADIANCE_MAXIMUM_BAND_6 = 89.14680 RADIANCE_MINIMUM_BAND_6 = -7.36177 RADIANCE_MAXIMUM_BAND_7 = 30.04725 RADIANCE_MINIMUM_BAND_7 = -2.48131 RADIANCE_MAXIMUM_BAND_8 = 662.93457 RADIANCE_MINIMUM_BAND_8 = -54.74535 RADIANCE_MAXIMUM_BAND_9 = 140.09596 RADIANCE_MINIMUM_BAND_9 = -11.56917 RADIANCE_MAXIMUM_BAND_10 = 22.00180 RADIANCE_MINIMUM_BAND_10 = 0.10033 RADIANCE_MAXIMUM_BAND_11 = 22.00180 RADIANCE_MINIMUM_BAND_11 = 0.10033 END_GROUP = MIN_MAX_RADIANCE GROUP = MIN_MAX_REFLECTANCE REFLECTANCE_MAXIMUM_BAND_1 = 1.210700 REFLECTANCE_MINIMUM_BAND_1 = -0.099980 REFLECTANCE_MAXIMUM_BAND_2 = 1.210700 REFLECTANCE_MINIMUM_BAND_2 = -0.099980 REFLECTANCE_MAXIMUM_BAND_3 = 1.210700 REFLECTANCE_MINIMUM_BAND_3 = -0.099980 REFLECTANCE_MAXIMUM_BAND_4 = 1.210700 REFLECTANCE_MINIMUM_BAND_4 = -0.099980 REFLECTANCE_MAXIMUM_BAND_5 = 1.210700 REFLECTANCE_MINIMUM_BAND_5 = -0.099980 REFLECTANCE_MAXIMUM_BAND_6 = 1.210700 REFLECTANCE_MINIMUM_BAND_6 = -0.099980 REFLECTANCE_MAXIMUM_BAND_7 = 1.210700 REFLECTANCE_MINIMUM_BAND_7 = -0.099980 REFLECTANCE_MAXIMUM_BAND_8 = 1.210700 REFLECTANCE_MINIMUM_BAND_8 = -0.099980 REFLECTANCE_MAXIMUM_BAND_9 = 1.210700 REFLECTANCE_MINIMUM_BAND_9 = -0.099980 END_GROUP = MIN_MAX_REFLECTANCE GROUP = MIN_MAX_PIXEL_VALUE QUANTIZE_CAL_MAX_BAND_1 = 65535 QUANTIZE_CAL_MIN_BAND_1 = 1 QUANTIZE_CAL_MAX_BAND_2 = 65535 QUANTIZE_CAL_MIN_BAND_2 = 1 QUANTIZE_CAL_MAX_BAND_3 = 65535 QUANTIZE_CAL_MIN_BAND_3 = 1 QUANTIZE_CAL_MAX_BAND_4 = 65535 QUANTIZE_CAL_MIN_BAND_4 = 1 QUANTIZE_CAL_MAX_BAND_5 = 65535 QUANTIZE_CAL_MIN_BAND_5 = 1 QUANTIZE_CAL_MAX_BAND_6 = 65535 QUANTIZE_CAL_MIN_BAND_6 = 1 QUANTIZE_CAL_MAX_BAND_7 = 65535 QUANTIZE_CAL_MIN_BAND_7 = 1 QUANTIZE_CAL_MAX_BAND_8 = 65535 QUANTIZE_CAL_MIN_BAND_8 = 1 QUANTIZE_CAL_MAX_BAND_9 = 65535 QUANTIZE_CAL_MIN_BAND_9 = 1 QUANTIZE_CAL_MAX_BAND_10 = 65535 QUANTIZE_CAL_MIN_BAND_10 = 1 QUANTIZE_CAL_MAX_BAND_11 = 65535 QUANTIZE_CAL_MIN_BAND_11 = 1 END_GROUP = MIN_MAX_PIXEL_VALUE GROUP = RADIOMETRIC_RESCALING RADIANCE_MULT_BAND_1 = 1.2161E-02 RADIANCE_MULT_BAND_2 = 1.2453E-02 RADIANCE_MULT_BAND_3 = 1.1475E-02 RADIANCE_MULT_BAND_4 = 9.6766E-03 RADIANCE_MULT_BAND_5 = 5.9216E-03 RADIANCE_MULT_BAND_6 = 1.4726E-03 RADIANCE_MULT_BAND_7 = 4.9636E-04 RADIANCE_MULT_BAND_8 = 1.0951E-02 RADIANCE_MULT_BAND_9 = 2.3143E-03 RADIANCE_MULT_BAND_10 = 3.3420E-04 RADIANCE_MULT_BAND_11 = 3.3420E-04 RADIANCE_ADD_BAND_1 = -60.80471 RADIANCE_ADD_BAND_2 = -62.26477 RADIANCE_ADD_BAND_3 = -57.37645 RADIANCE_ADD_BAND_4 = -48.38306 RADIANCE_ADD_BAND_5 = -29.60802 RADIANCE_ADD_BAND_6 = -7.36324 RADIANCE_ADD_BAND_7 = -2.48181 RADIANCE_ADD_BAND_8 = -54.75630 RADIANCE_ADD_BAND_9 = -11.57148 RADIANCE_ADD_BAND_10 = 0.10000 RADIANCE_ADD_BAND_11 = 0.10000 REFLECTANCE_MULT_BAND_1 = 2.0000E-05 REFLECTANCE_MULT_BAND_2 = 2.0000E-05 REFLECTANCE_MULT_BAND_3 = 2.0000E-05 REFLECTANCE_MULT_BAND_4 = 2.0000E-05 REFLECTANCE_MULT_BAND_5 = 2.0000E-05 REFLECTANCE_MULT_BAND_6 = 2.0000E-05 REFLECTANCE_MULT_BAND_7 = 2.0000E-05 REFLECTANCE_MULT_BAND_8 = 2.0000E-05 REFLECTANCE_MULT_BAND_9 = 2.0000E-05 REFLECTANCE_ADD_BAND_1 = -0.100000 REFLECTANCE_ADD_BAND_2 = -0.100000 REFLECTANCE_ADD_BAND_3 = -0.100000 REFLECTANCE_ADD_BAND_4 = -0.100000 REFLECTANCE_ADD_BAND_5 = -0.100000 REFLECTANCE_ADD_BAND_6 = -0.100000 REFLECTANCE_ADD_BAND_7 = -0.100000 REFLECTANCE_ADD_BAND_8 = -0.100000 REFLECTANCE_ADD_BAND_9 = -0.100000 END_GROUP = RADIOMETRIC_RESCALING GROUP = TIRS_THERMAL_CONSTANTS K1_CONSTANT_BAND_10 = 774.8853 K1_CONSTANT_BAND_11 = 480.8883 K2_CONSTANT_BAND_10 = 1321.0789 K2_CONSTANT_BAND_11 = 1201.1442 END_GROUP = TIRS_THERMAL_CONSTANTS GROUP = PROJECTION_PARAMETERS MAP_PROJECTION = "UTM" DATUM = "WGS84" ELLIPSOID = "WGS84" UTM_ZONE = 35 GRID_CELL_SIZE_PANCHROMATIC = 15.00 GRID_CELL_SIZE_REFLECTIVE = 30.00 GRID_CELL_SIZE_THERMAL = 30.00 ORIENTATION = "NORTH_UP" RESAMPLING_OPTION = "CUBIC_CONVOLUTION" END_GROUP = PROJECTION_PARAMETERS END_GROUP = L1_METADATA_FILE END

GROUP = L1_METADATA_FILE GROUP = METADATA_FILE_INFO ORIGIN = "Image courtesy of the U.S. Geological Survey" REQUEST_ID = "0101405281170_00389" LANDSAT_SCENE_ID = "LT51710752005158JSA00" FILE_DATE = 2014-05-29T10:26:19Z STATION_ID = "JSA" PROCESSING_SOFTWARE_VERSION = "LPGS_12.4.1" DATA_CATEGORY = "NOMINAL" END_GROUP = METADATA_FILE_INFO GROUP = PRODUCT_METADATA DATA_TYPE = "L1T" DATA_TYPE_L0RP = "TMR_L0RP" ELEVATION_SOURCE = "GLS2000" OUTPUT_FORMAT = "GEOTIFF" EPHEMERIS_TYPE = "DEFINITIVE" SPACECRAFT_ID = "LANDSAT_5" SENSOR_ID = "TM" SENSOR_MODE = "BUMPER" WRS_PATH = 171 WRS_ROW = 075 DATE_ACQUIRED = 2005-06-07 SCENE_CENTER_TIME = 07:54:48.3550440Z CORNER_UL_LAT_PRODUCT = -20.71125 CORNER_UL_LON_PRODUCT = 26.83674 CORNER_UR_LAT_PRODUCT = -20.69812 CORNER_UR_LON_PRODUCT = 29.13241 CORNER_LL_LAT_PRODUCT = -22.61400 CORNER_LL_LON_PRODUCT = 26.83458 CORNER_LR_LAT_PRODUCT = -22.59954 CORNER_LR_LON_PRODUCT = 29.16053 CORNER_UL_PROJECTION_X_PRODUCT = 483000.000 CORNER_UL_PROJECTION_Y_PRODUCT = -2290200.000 CORNER_UR_PROJECTION_X_PRODUCT = 722100.000 CORNER_UR_PROJECTION_Y_PRODUCT = -2290200.000 CORNER_LL_PROJECTION_X_PRODUCT = 483000.000 CORNER_LL_PROJECTION_Y_PRODUCT = -2500800.000 CORNER_LR_PROJECTION_X_PRODUCT = 722100.000 CORNER_LR_PROJECTION_Y_PRODUCT = -2500800.000 REFLECTIVE_LINES = 7021 REFLECTIVE_SAMPLES = 7971 THERMAL_LINES = 7021 THERMAL_SAMPLES = 7971 FILE_NAME_BAND_1 = "LT51710752005158JSA00_B1.TIF" FILE_NAME_BAND_2 = "LT51710752005158JSA00_B2.TIF" FILE_NAME_BAND_3 = "LT51710752005158JSA00_B3.TIF" FILE_NAME_BAND_4 = "LT51710752005158JSA00_B4.TIF" FILE_NAME_BAND_5 = "LT51710752005158JSA00_B5.TIF" FILE_NAME_BAND_6 = "LT51710752005158JSA00_B6.TIF" FILE_NAME_BAND_7 = "LT51710752005158JSA00_B7.TIF" GROUND_CONTROL_POINT_FILE_NAME = "LT51710752005158JSA00_GCP.txt" REPORT_VERIFY_FILE_NAME = "LT51710752005158JSA00_VER.txt" BROWSE_VERIFY_FILE_NAME = "LT51710752005158JSA00_VER.jpg" METADATA_FILE_NAME = "LT51710752005158JSA00_MTL.txt" CPF_NAME = "L5CPF20050401_20050630.11" END_GROUP = PRODUCT_METADATA GROUP = IMAGE_ATTRIBUTES CLOUD_COVER = 0.00 IMAGE_QUALITY = 9 SUN_AZIMUTH = 37.92663515 SUN_ELEVATION = 35.13912566 GROUND_CONTROL_POINTS_MODEL = 208 GEOMETRIC_RMSE_MODEL = 4.029 GEOMETRIC_RMSE_MODEL_Y = 2.745 GEOMETRIC_RMSE_MODEL_X = 2.949 GROUND_CONTROL_POINTS_VERIFY = 2828 GEOMETRIC_RMSE_VERIFY = 0.187 GEOMETRIC_RMSE_VERIFY_QUAD_UL = 0.116 GEOMETRIC_RMSE_VERIFY_QUAD_UR = 0.142 GEOMETRIC_RMSE_VERIFY_QUAD_LL = 0.257 GEOMETRIC_RMSE_VERIFY_QUAD_LR = 0.262 END_GROUP = IMAGE_ATTRIBUTES GROUP = MIN_MAX_RADIANCE RADIANCE_MAXIMUM_BAND_1 = 193.000 RADIANCE_MINIMUM_BAND_1 = -1.520 RADIANCE_MAXIMUM_BAND_2 = 365.000 RADIANCE_MINIMUM_BAND_2 = -2.840 RADIANCE_MAXIMUM_BAND_3 = 264.000 RADIANCE_MINIMUM_BAND_3 = -1.170 RADIANCE_MAXIMUM_BAND_4 = 221.000 RADIANCE_MINIMUM_BAND_4 = -1.510 RADIANCE_MAXIMUM_BAND_5 = 30.200 RADIANCE_MINIMUM_BAND_5 = -0.370 RADIANCE_MAXIMUM_BAND_6 = 15.303 RADIANCE_MINIMUM_BAND_6 = 1.238 RADIANCE_MAXIMUM_BAND_7 = 16.500 RADIANCE_MINIMUM_BAND_7 = -0.150 END_GROUP = MIN_MAX_RADIANCE GROUP = MIN_MAX_PIXEL_VALUE QUANTIZE_CAL_MAX_BAND_1 = 255 QUANTIZE_CAL_MIN_BAND_1 = 1 QUANTIZE_CAL_MAX_BAND_2 = 255 QUANTIZE_CAL_MIN_BAND_2 = 1 QUANTIZE_CAL_MAX_BAND_3 = 255 QUANTIZE_CAL_MIN_BAND_3 = 1 QUANTIZE_CAL_MAX_BAND_4 = 255 QUANTIZE_CAL_MIN_BAND_4 = 1 QUANTIZE_CAL_MAX_BAND_5 = 255 QUANTIZE_CAL_MIN_BAND_5 = 1 QUANTIZE_CAL_MAX_BAND_6 = 255 QUANTIZE_CAL_MIN_BAND_6 = 1 QUANTIZE_CAL_MAX_BAND_7 = 255 QUANTIZE_CAL_MIN_BAND_7 = 1 END_GROUP = MIN_MAX_PIXEL_VALUE GROUP = PRODUCT_PARAMETERS CORRECTION_GAIN_BAND_1 = "CPF" CORRECTION_GAIN_BAND_2 = "CPF" CORRECTION_GAIN_BAND_3 = "CPF" CORRECTION_GAIN_BAND_4 = "CPF" CORRECTION_GAIN_BAND_5 = "CPF" CORRECTION_GAIN_BAND_6 = "INTERNAL_CALIBRATION" CORRECTION_GAIN_BAND_7 = "CPF" CORRECTION_BIAS_BAND_1 = "CPF" CORRECTION_BIAS_BAND_2 = "CPF" CORRECTION_BIAS_BAND_3 = "CPF" CORRECTION_BIAS_BAND_4 = "CPF" CORRECTION_BIAS_BAND_5 = "CPF" CORRECTION_BIAS_BAND_6 = "CPF" CORRECTION_BIAS_BAND_7 = "CPF" END_GROUP = PRODUCT_PARAMETERS GROUP = RADIOMETRIC_RESCALING RADIANCE_MULT_BAND_1 = 0.766 RADIANCE_MULT_BAND_2 = 1.448 RADIANCE_MULT_BAND_3 = 1.044 RADIANCE_MULT_BAND_4 = 0.876 RADIANCE_MULT_BAND_5 = 0.120 RADIANCE_MULT_BAND_6 = 0.055 RADIANCE_MULT_BAND_7 = 0.066 RADIANCE_ADD_BAND_1 = -2.28583 RADIANCE_ADD_BAND_2 = -4.28819 RADIANCE_ADD_BAND_3 = -2.21398 RADIANCE_ADD_BAND_4 = -2.38602 RADIANCE_ADD_BAND_5 = -0.49035 RADIANCE_ADD_BAND_6 = 1.18243 RADIANCE_ADD_BAND_7 = -0.21555 END_GROUP = RADIOMETRIC_RESCALING GROUP = PROJECTION_PARAMETERS MAP_PROJECTION = "UTM" DATUM = "WGS84" ELLIPSOID = "WGS84" UTM_ZONE = 35 GRID_CELL_SIZE_REFLECTIVE = 30.00 GRID_CELL_SIZE_THERMAL = 30.00 ORIENTATION = "NORTH_UP" RESAMPLING_OPTION = "CUBIC_CONVOLUTION" MAP_PROJECTION_L0RA = "NA" END_GROUP = PROJECTION_PARAMETERS END_GROUP = L1_METADATA_FILE END

sethilana commented 7 years ago

I wish I could open these in Rstudio and start working on my analysis

bleutner commented 7 years ago

Both files are read just fine, even on R-devel in Windows. Something must be wrong with your installation. Are you sure you followed the installation instructions correctly?

sethilana commented 7 years ago

Iam not sure but it did not install using the library(devtools) and the github script I had to download it from the website as a zip file. OK let me try to install again . I also want to confirm the library, should it be an external one or can work on C-

Regards

On Jan 30, 2017 16:40, "Benjamin Leutner" notifications@github.com wrote:

Both files are read just fine, even on R-devel in Windows. Something must be wrong with your installation. Are you sure you followed the installation instructions https://github.com/bleutner/RStoolbox correctly?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bleutner/RStoolbox/issues/7#issuecomment-276078760, or mute the thread https://github.com/notifications/unsubscribe-auth/AYLcX-_6gNS_zS_7MRBLQvlWFO8slyKrks5rXfZVgaJpZM4Im_GE .

bleutner commented 7 years ago

I don't understand your last question.

Why don't you use the regular release of R (3.2.2)? Then you can install directly from CRAN, i.e. with install.packages(RStoolbox), without needing to compile it yourself.

sethilana commented 7 years ago

I got information from github that R version should be 3.3. for RStoolbox to work properly. Ok thank you let me install it from CRAN and see.

Regards

On Mon, Jan 30, 2017 at 5:43 PM, Benjamin Leutner notifications@github.com wrote:

I don't understand your last question.

Why don't you use the regular release of R (3.2.2)? Then you can install directly from CRAN, i.e. with install.packages(RStoolbox), without needing to compile it yourself.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bleutner/RStoolbox/issues/7#issuecomment-276097046, or mute the thread https://github.com/notifications/unsubscribe-auth/AYLcX7ClrZE9N8URWFPboNHAwGFhZ4BVks5rXgU-gaJpZM4Im_GE .

bleutner commented 7 years ago

oh sorry, thats what I meant. 3.3.2

sethilana commented 7 years ago

In this 3.3.2 version there is RStoolbox version 0.1.7.9 was giving an empty MTL file . Let me re install and try again.

On Mon, Jan 30, 2017 at 5:57 PM, Benjamin Leutner notifications@github.com wrote:

oh sorry, thats what I meant. 3.3.2

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bleutner/RStoolbox/issues/7#issuecomment-276101148, or mute the thread https://github.com/notifications/unsubscribe-auth/AYLcX1u5782_ERf5S0JDyvQxfDaqXjgxks5rXghugaJpZM4Im_GE .

sethilana commented 7 years ago

My you please check my scripts

mtlFile<-system.file("external/landsat/LC81710742015170LGN00/LC81710742015170LGN00_MTL.txt",package="RStoolbox") metaData<-readMeta(mtlFile) Error: Metadata file does not exist. Looking for:

Iam thinking it is the path that has a problem

On Mon, Jan 30, 2017 at 5:57 PM, Benjamin Leutner notifications@github.com wrote:

oh sorry, thats what I meant. 3.3.2

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bleutner/RStoolbox/issues/7#issuecomment-276101148, or mute the thread https://github.com/notifications/unsubscribe-auth/AYLcX1u5782_ERf5S0JDyvQxfDaqXjgxks5rXghugaJpZM4Im_GE .

sethilana commented 7 years ago

I was saying maybe the problem is the path to the file

On Mon, Jan 30, 2017 at 5:43 PM, Benjamin Leutner notifications@github.com wrote:

I don't understand your last question.

Why don't you use the regular release of R (3.2.2)? Then you can install directly from CRAN, i.e. with install.packages(RStoolbox), without needing to compile it yourself.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bleutner/RStoolbox/issues/7#issuecomment-276097046, or mute the thread https://github.com/notifications/unsubscribe-auth/AYLcX7ClrZE9N8URWFPboNHAwGFhZ4BVks5rXgU-gaJpZM4Im_GE .

bleutner commented 7 years ago

I see. The system.file function is only needed to load the built-in example file. What happened was that you were requesting a file which did not exist in the installation directory and hence system.file returned an empty character: ""

All you have to do is provide the path to your file without the system.file function: readMeta("path/to/your/file_MTL.txt")

sethilana commented 7 years ago

ok thanx so much let me try Regards

On Tue, Jan 31, 2017 at 10:38 AM, Benjamin Leutner <notifications@github.com

wrote:

I see. The system.file function is only needed to load the built-in example file. What happened was that you were requesting a file which did not exist in the installation directory and hence system.file returned an empty character: ""

All you have to do is provide the path to your file without the system.file function: readMeta("path/to/your/file_MTL.txt")

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bleutner/RStoolbox/issues/7#issuecomment-276305151, or mute the thread https://github.com/notifications/unsubscribe-auth/AYLcX9O52gGSXbzDeFecFJXSM9b9GSIKks5rXvMEgaJpZM4Im_GE .

sethilana commented 7 years ago

Morning Leutner sorry to bother you, I have tried that;

mtlFile<-readMeta<-("C:/Users/Sethi/Documents/R/Landsat/June images/LC81710742015170LGN00/LC81710742015170LGN00_MTL.txt") readMeta<-(mtlFile) print(mtlFile) [1] "C:/Users/Sethi/Documents/R/Landsat/June images/LC81710742015170LGN00/LC81710742015170LGN00_MTL.txt" summary(mtlFile) Length Class Mode 1 character character I do not know where Iam getting it wrong

On Tue, Jan 31, 2017 at 10:38 AM, Benjamin Leutner <notifications@github.com

wrote:

I see. The system.file function is only needed to load the built-in example file. What happened was that you were requesting a file which did not exist in the installation directory and hence system.file returned an empty character: ""

All you have to do is provide the path to your file without the system.file function: readMeta("path/to/your/file_MTL.txt")

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bleutner/RStoolbox/issues/7#issuecomment-276305151, or mute the thread https://github.com/notifications/unsubscribe-auth/AYLcX9O52gGSXbzDeFecFJXSM9b9GSIKks5rXvMEgaJpZM4Im_GE .

bleutner commented 7 years ago
readMeta("C:/Users/Sethi/Documents/R/Landsat/Juneimages/LC81710742015170LGN00/LC81710742015170LGN00_MTL.txt")
sethilana commented 7 years ago

Thanx it has imported

sethilana commented 7 years ago

Hi Leutner Thank you so much, God BLESS YOU

Regards

On Tue, Jan 31, 2017 at 11:47 AM, Benjamin Leutner <notifications@github.com

wrote:

readMeta("C:/Users/Sethi/Documents/R/Landsat/Juneimages/LC81710742015170LGN00/LC81710742015170LGN00_MTL.txt")

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bleutner/RStoolbox/issues/7#issuecomment-276319269, or mute the thread https://github.com/notifications/unsubscribe-auth/AYLcXyPBIYrHRY2MS9u_IAT6k5Fnzpmiks5rXwNNgaJpZM4Im_GE .

sethilana commented 7 years ago

Dear Leutner Hope you are well, I want your help, i was classifying my images using RStoolbox and got a system report error, that I need to restart the whole session and an automatic closure of the session. When I restarted the package RStoolbox is reporting that it has been corrupted, what could be the problem and how can I solve it, so stressed.

Kind regards Sethi

On Tue, Jan 31, 2017 at 11:47 AM, Benjamin Leutner <notifications@github.com

wrote:

readMeta("C:/Users/Sethi/Documents/R/Landsat/Juneimages/LC81710742015170LGN00/LC81710742015170LGN00_MTL.txt")

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bleutner/RStoolbox/issues/7#issuecomment-276319269, or mute the thread https://github.com/notifications/unsubscribe-auth/AYLcXyPBIYrHRY2MS9u_IAT6k5Fnzpmiks5rXwNNgaJpZM4Im_GE .

bleutner commented 7 years ago

Please open a new issue. Every issue should address only one single problem. Also please provide a complete, reproducible example, including the original error messages.

Romaysa commented 7 years ago

Dear Bleutner, hope you don't mind writing you here so new in Github and i coulden't find how to open a new issue, any how this is my problem have a look to the errors. same problem as Sethi had, the metadata file is not existed. mtfile<- system.file("MTL.txt", package = "RStoolbox") meta<- readMeta("Z:/Band/MTL.txt")

i can read the MTL file perfecctly but when i would like to read the mtlfile so these error happen lsat<- stackMeta(mtfile)

Error: Metadata file does not exist. Looking for:

lsat<- stackMeta("Z:/Band/MTL.txt")

Error in .local(.Object, ...) :

Error in .rasterObjectFromFile(x, band = band, objecttype = "RasterLayer", :

Cannot create a RasterLayer object from this file. (file does not exist)

lsat<- stackMeta(MTL.txt)

Error in inherits(file, "ImageMetaData") : object 'MTL.txt' not found

lsat<- stackMeta(meta)

Error in .local(.Object, ...) :

Error in .rasterObjectFromFile(x, band = band, objecttype = "RasterLayer", : Cannot create a RasterLayer object from this file. (file does not exist)

sdmed commented 6 years ago

Hello everyone I have trying to do radiometric and topographic correction for the Land Sat data using R. However, when I call the meta data in R as you can see below, I have the same problem posted here that Meta data file does not exist . Looking for:

I am using the latest R version 3.5.1 in window. I went through the discussion you had but didn't understand what is the solution at the end Please kindly help me to fix the error. I have also attached the metadata i have.

Thank you. LC08_L1TP_168050_20161225_20170315_01_T1_MTL.txt

library(raster) Loading required package: sp

mtlFile <- system.file("G:/LandSat_processing_practice_in_R/LC08_L1TP_168050_20161225_20170315_01_T1/LC08_L1TP_168050_20161225_20170315_01_T1_MTL.txt", package="RStoolbox") metaData <- readMeta(mtlFile) Error: Metadata file does not exist. Looking for:

aszeitz commented 6 years ago

I downloaded your metadata file. The following works for me to import it in R version 3.4.1:

library(RStoolbox)
setwd("set/to/dir/where/metadata/exists")
meta <- readMeta("./LC08_L1TP_168050_20161225_20170315_01_T1_MTL.txt")
sdmed commented 6 years ago

Dear Aszeitz

Thank you very much indeed. Now i am able to import the meta data using the step you mentioned even in 3,5,1 version. I think the error is when i use the system.file function as i put in my earlier post. Now it is okay to import. Following this i was able to execute the radiometric correction using the command below but could not able to export the corrected stacked landSat image for later use in like in Arcgis ... Here is the step i went through and please kindly help me on how to export the final output as raster dataset to be able to use it outside R.

rm(list = ls())

library(raster) library(RStoolbox) library(devtools) library(rgdal)

Set the working directory

setwd("G:/LandSat_processing_practice_in_R/LC08_L1TP_168050_20161225_20170315_01_T1")

metaData <- readMeta("./LC08_L1TP_168050_20161225_20170315_01_T1_MTL.txt")

To stack the different bands (layer stacking)

lsat <- stackMeta(metaData) summary(lsat) print(lsat)

Radiometric correction

lsat_radcor<- radCor(lsat, metaData, method = "apref", bandSet = "full", hazeValues, hazeBands, atmosphere, darkProp = 0.01, clamp = TRUE) summary(lsat_radcor)

writeGDAL(lsat_radcor, "G:/LandSat_processing_practice_in_R/lsat.tif", drivername="GTiff")

Thank you very much.

aszeitz commented 6 years ago

To quote bleutner from Feb 2017:

Please open a new issue. Every issue should address only one single problem. Also please provide a complete, reproducible example, including the original error messages.

Your problem with exporting the raster stack does not belong in this thread, which refers specifically to issues in loading metadata. Furthermore, your issue with writeGDAL is separate from RStoolbox, as that function is from the rgdal library. I suggest you look into the using the writeRaster function in the raster library, or search for solutions / ask a question on stackoverflow.

beulahevelyn commented 3 years ago

Hi,

mtlFile <- readMeta("./LC08_L2SP_142051_20180107_20200902_02_T1_MTL.txt"), throws a POSIXct Error. Installed (RStoolbox) and (raster) packages. Error seems to point to ACQUISITION_DATE field of MTL.txt. Can someone help?

Error Message: Error in as.POSIXct.default(if (!legacy) meta$PRODUCT_METADATA["DATE_ACQUIRED", : c("do not know how to convert 'if (!legacy) meta$PRODUCT_METADATA[\"DATE_ACQUIRED\", ] else meta$PRODUCT_METADATA[\"ACQUISITION_DATE\", ' to class “POSIXct”", "do not know how to convert ' ]' to class “POSIXct”")

marcelocarvalhoalves commented 2 years ago

I got the same error of beulahevelyn trying to read metadata of Landsat8. I think this error is due to NASA reconfiguration of this file sequence and some terms used.