rename MODIS band in R

AttributeError: 'ImageCollection' object has no attribute 'rename'

dataset2 = ee$ImageCollection("MODIS/061/MYD11A2")$filter(ee$Filter$date('2003-01-01', '2003-03-01'));
landSurfaceTemperature2 = dataset2$select('LST_Day_1km', 'LST_Night_1km','QC_Day', 'QC_Night')$rename('LST_Day_1km_1', 'LST_Night_1km_1','QC_Day_1', 'QC_Night_1');
renameBands <- landSurfaceTemperature2$select('LST_Day_1km', 'LST_Night_1km','QC_Day', 'QC_Night')$
rename('LST_Day_1km_1', 'LST_Night_1km_1','QC_Day_1', 'QC_Night_1')

Hi!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

dataset2 = ee$ImageCollection("MODIS/061/MYD11A2")$filter(ee$Filter$date('2003-01-01', '2003-03-01'));
landSurfaceTemperature2 = dataset2$select('LST_Day_1km', 'LST_Night_1km','QC_Day', 'QC_Night')$rename('LST_Day_1km_1', 'LST_Night_1km_1','QC_Day_1', 'QC_Night_1');
 renameBands <- function (image) {
  bands <- image('LST_Day_1km', 'LST_Night_1km','QC_Day', 'QC_Night');
  new_bands <- image('LST_Day_1km_1', 'LST_Night_1km_1','QC_Day_1', 'QC_Night_1');
  return (image$select(bands)$rename(new_bands));
}

myd <- ee$
  ImageCollection("MODIS/061/MYD11A2")$
  map(renameBands)

Error message:

myd <- ee$
ImageCollection("MODIS/061/MYD11A2")$
map(renameBands)

Error in py_call_impl(callable, dots$args, dots$keywords) :
RuntimeError: Evaluation error: 'x' and 'y' values must be finite and non-missing.

If I write rename() end of the 'landSurfaceTemperature2', this below message is creating;

Error in py_get_attr_impl(x, name, silent) : AttributeError: 'ImageCollection' object has no attribute 'rename'

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.