I found that the easiest way to create a new NetCDF file containing several GeoTIFF files is using GDAL and then using NCO and CDO tools (Provided by unidata) to add the appropriate metadata.
First you convert the GeoTIFF´s to NetCDF using:
gdal_translate -of netCDF -co "FORMAT=NC4" foo.tif foo.nc
This creates a netCDF in NC4 format (which is the newest version at this time) with some basic metadata like coordinate system, pixel size etc.
Then I rename the variable information to what I want it to be (In my case SST) with the appropriately registered long and short name from the unidata convention page; NCO software download):
ncrename -v Band1,SST foo.nc
ncatted -O -a long_name,SST,o,c,sea_surface_temperature foo.nc
The first renames the variable Band1 to the wanted variable SST.
The second adds the long name of the SST variable.
In my case I added time data to the new nc file using:
ncap2 -Oh -s "tin=$d;" -S mean.nco foo.nc new_foo.nc
where the mean.nco file looks as follows:
/***.nco ncap2 script***/
defdim("time",1);
time[time]=tin;
time@long_name="Time";
time@units="days since 2000-00-00 00:00:00";
time@standard_name="time";
time@axis="T";
time@coordinate_defines="point";
time@calendar="standard";
/***SST_M@long_name="Sea surface temperature mean";
SST_M@units="Celsius"
/***********/
This adds the third coordinate time where T=$d, which in my case was the january or 1. Then this time is set to the file using:
cdo settime,$d new_foo.nc newer_foo.nc
Finally, all the files converted to NetCDF are joined together using:
cdo mergetime folder_containing_all_nc/*.nc final.nc
This joins all files with the appropriate timestamp to one file. This can be with several parameters in one file.