Hello everyone. I am trying to save some variables that I have obtained into a .nc file following this example.
The variables in question are uwind_pp_save and uwind_pp_save, whose dimensions are 50361201*21. These variables represent ensemble wind forecast, each one with 50 members measured at 361 values of latitude, 201 of longitude and at 21 different days. I also have the vectors with the values of time, latitude and longitude.
I have written the following:
dimTime <- ncdim_def('time', units='hours since 1900-01-01 00:00:00.0', longname='time', calendar="gregorian", vals=times_used)
dimLat <- ncdim_def('latitude', units='degrees_north', longname='latitude', calendar="gregorian", vals=lat_values)
dimLon<- ncdim_def('longitude', units='degrees_east', longname='longitude', calendar="gregorian", vals=lon_values)
dimU<- ncdim_def('U_wind', units='m/s', longname='U component of wind', calendar="gregorian", vals=uwind_pp_save)
dimV<- ncdim_def('V_wind', units='m/s', longname='V component of wind', calendar="gregorian", vals=vwind_pp_save)
vars_to_be_saved <- list(dimTime, dimLat, dimLon, dimU, dimV)
outputfile <- 'postprocessed_ensemble.nc';
con <- nc_create(outputfile, vars_to_be_saved)
and I get the following error
Error in nc_create(outputfile, vars_to_be_saved) :
Error, second arg must either be a ncvar object (created by a call to ncvar_def()) or a list of ncvar objects
I have constructed the dimU, dimV... variables just like in the example and I don't know there the error lies.
Can someone help me?
Regards.
Jaime.