Question about exporting as netcdf

Hi there

I’m working with SNAP 2.0 using a ERS-2 SAR PRImage. After applying
radiometric calibration, speckle filter and terrain correction I want to
save my image as a netcdf file. So far so good, but I’ve managed to
save only the variables latitude, longitude and sigma0. However, I need
to save as well the date of the image.

My question then. How can I export a netcdf file including the date of the image?

Thank you for your time.

cheers

If your product has a start and/or stop date it should be automatically written to the NetCDF file.
You should find start_date and stop_date in the Global_Attributes.
Maybe you product does not have such values set?
If not, you can set it manually. Right-click on the product and choose from context menu Properties.
Enter the dates in the format dd-MMM-yyyy HH:mm:ss. Example: 13-AUG-2006 07:35:28
It is considered as UTC time.

Dear Marpet
Thank you very much for your reply.
When I try to extract the global attributes, that’s the output

gattname = netcdf.inqAttName(ncid,netcdf.getConstant(‘NC_GLOBAL’),0);
gattval = netcdf.getAtt(ncid,netcdf.getConstant(‘NC_GLOBAL’),gattname)

gattval =

CF-1.4

I’m not quite sure if the dates are there.
I didn’t understand how to set it manually, could you please clarify?
cheers If not, you can set it manually. Right-click on the product and choose from context menu Properties
How?

Below follows how to extract dates, cheers marpet for the tips

% start date
gattname = netcdf.inqAttName(ncid,netcdf.getConstant(‘NC_GLOBAL’),2);
start_date = netcdf.getAtt(ncid,netcdf.getConstant(‘NC_GLOBAL’),gattname);

% stop date
gattname = netcdf.inqAttName(ncid,netcdf.getConstant(‘NC_GLOBAL’),3);
stop_date = netcdf.getAtt(ncid,netcdf.getConstant(‘NC_GLOBAL’),gattname);