I am mapping annual rainfall in the Eastern Sahel. I have a wide colour palette which allows me to see approx rainfall p.a. within the region of interest (not elegant, but sufficient) (Image 1). My problem is that when I try to export the map to an asset it loses the palette. (Image 2) I have also tried using visualize() but without success. Any advice?
var chirps = ee.ImageCollection("UCSB-CHG/CHIRPS/PENTAD");
// Use GAUL Administrative Boundaries dataset - Admin1 dataset with district boundaries
// Set focus on the Eastern Sahel (Sudan and Eritrea)
var gaul = ee.FeatureCollection("FAO/GAUL_SIMPLIFIED_500m/2015/level1")
var Sahel = gaul.filter(ee.Filter.inList('ADM0_NAME', ['Eritrea','Sudan']))
// Overlay the district boundaries for the state
Map.addLayer(Sahel, {color: '#000000', width: 3}, 'Admin1 Boundaries')
var filtered = chirps.filter(ee.Filter.date('2020-01-01', '2020-12-31'))
//Find cumulative rainfall
var total = filtered.reduce(ee.Reducer.sum())
//print (total)
// Clip the classified image to the regional boundary
var SahelRainfall = total.clip(Sahel)
Map.addLayer(SahelRainfall, {min:0, max:1000, palette: ['#ff0000','#ff5300','#ffa500','#ffd200','#ffff00','#80c000','#008000','#004080',
'#0000ff','#2600c1','#4b0082']}, 'Sahel Rainfall')
// Specify area to clip and export.
var geometry = Sahel;
Export.image.toAsset({
image: SahelRainfall,
description: 'imageExport',
assetId: 'rf',
region: Sahel,
});