I'm looking to make a climate zone map in Google Earth Engine (GEE). One of the criteria I'm using is frost occurrence- which is defined by having at least 7 days per year with a minimum temperature below 0 degrees Celsius. I'm doing this ideally over a 30-year period as well.
I'm using ERA5's daily minimum air temperature dataset to calculate this. I have created an image collection that has grouped all images of the same year together but am stuck on the next step.
How would I go about filtering down areas that have at least 7 days of minimum temps below zero per year (and vice versa- a variable containing global areas that do not have frost conditions) into variables from this grouped image collection?
// Daily mean 2m air temperature
var era_min_t = ee.ImageCollection("ECMWF/ERA5/DAILY")
.filterDate('1990-01-01', '2020-01-01')
.select('minimum_2m_air_temperature');
// Reduce the collection to a set of unique year representatives
// to serve as the primary collection in a join with the complete
// collection.
var distinctYear = era_min_t.distinct('year');
print(distinctYear, "Distinct Year");
// Define a filter that identifies which images from the complete collection
// match the 'year' from the distinctYear collection.
var filter = ee.Filter.equals({leftField: 'year', rightField: 'year'});
// Define a join.
var join = ee.Join.saveAll('sameYear');
// Apply the join and convert the resulting FeatureCollection to an
// ImageCollection.
var joinCol = ee.ImageCollection(
join.apply(distinctYear, era_min_t, filter)
);
print(joinCol);