I am using "TerraClimate: Monthly Climate and Climatic Water Balance for Global Terrestrial Surfaces, University of Idaho" dataset...

When I try my code, I have this error message Error generating chart: Data column(s) for axis #0 cannot be of type string.

I'm interesting to vapor pressure deficit. Here is my code:

var dataset = ee.ImageCollection('IDAHO_EPSCOR/TERRACLIMATE')
.filter(ee.Filter.date('1958-01-01', '2020-12-01'))
print (dataset); 

var Vapor_pressure_deficit = dataset.select('vpd');
print (Vapor_pressure_deficit);

var VPD = Vapor_pressure_deficit.map(function(img){
var date = img.get('system:time_start');
return img.multiply(0.01).set('system_time_start', date);

var createTS = function(img){
var date = img.get('system_time_start');
var value = img.reduceRegion(ee.Reducer.mean(), geometry).get('vpd');
var ft = ee.Feature(null, {'system:time_start': date, 
                             'date': ee.Date(date).format('Y/M/d'), 
                             'value': value});
  return ft;
var vpd_final = VPD.map(createTS);

var graph = ui.Chart.feature.byFeature(vpd_final, 'system:time_start', 'value');

           .setOptions({vAxis: {title: 'VPD [kPa]'},
                        hAxis: {title: 'Date'}}));
Export.table.toDrive({collection: vpd_final, selectors: 'date, value'});
  • 1
    Welcome to Geographic Information Systems! Welcome to GIS SE! We're a little different from other sites; this isn't a discussion forum but a Q&A site. Your questions should as much as possible describe not just what you want to do, but precisely what you have tried and where you are stuck trying that. Please check out our short tour for more about how the site works
    – Ian Turton
    May 6, 2021 at 8:49
  • Sorry. when I try my code, I have this error message Error generating chart: Data column(s) for axis #0 cannot be of type string May 6, 2021 at 8:52
  • Can someone help me to solve the problem? May 6, 2021 at 8:52

2 Answers 2


Not sure what the problem is, I ran the code without any issues. enter image description here


I have been experiencing this issue with only one of my polygon geometries (the smallest polygon, covering only two sentinel pixels), while all of my other larger ones work fine. I have only been able to solve the issue by using a point geometry instead, for the one not working. This solution is fine for my situation, but probably not for everyone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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