I'm trying to filter an image collection using not bands within each image of the collection, but by pattern matching in the image ID. Using:

var dataset_2099 = ee.ImageCollection('NASA/NEX-DCP30')
                  .filter(ee.Filter.date('2099-01-01', '2099-12-31'));

we can create an image collection with forecasted climate data. If I, suppose, want to access just the RCP 2.5 data, I'm in a bind because there doesn't seem to be a clear-cut way to filter the image collection based on individual image names, which begin with "rcpXX" where XX may be 26, 45, 60, or 85 depending on the RCP scenario being mapped.

Image ID's can be printed using the following code, where you can see the pattern that I'm describing:

// Image ID listing code by Tyler Erickson
// https://gis.stackexchange.com/a/281489/67264
// Create a list of image objects.
var imageList = dataset_2099.toList(5000);
print('imageList', imageList);
// Extract the ID of each image object.
var id_list = imageList.map(function(item) {
  return ee.Image(item).id();
print('id_list', id_list);

The problem is I don't just want to get the names of the images, I want to subset the image collection based on those names.

| improve this question | | | | |

Alright, I figured it out. Filtering can be done using the image properties (you can see what properties are available by searching for the product in the search bar). In this case, NASA's NEX-DCP30 data comes with a 'scenario' property, so adding a single line of code filters to this level. For example, to access only the RCP 4.5 projections:

var dataset_2099 = ee.ImageCollection('NASA/NEX-DCP30')
                  .filter(ee.Filter.date('2099-01-01', '2099-12-31'))

Image property-based filtering can be used for specific models in the NEX-DCP30 collection, so users can specify that they just want to look at CSIRO projections using

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.