Cannot keep nonexistent variable delta_time in harpconvert command?

I’m trying to keep the delta_time variable in my harpconvert command as follows:

harpconvert -a 'tropospheric_NO2_column_number_density_validity>75; derive(tropospheric_NO2_column_number_density [Pmolec/cm2]); bin_spatial(340, 40, 0.05, 420, -95, 0.05); derive(latitude {latitude}); derive(longitude {longitude}); keep(NO2_column_number_density, tropospheric_NO2_column_number_density, latitude_bounds, longitude_bounds, latitude, longitude, delta_time)' large.nc large_timeutc.nc

This is the error I get back:
ERROR: cannot keep non-existent variable delta_time

How do I keep this variable?

As a follow up to this, I read the mapping description for the datetime_start variable and I see that it is using the delta_time variable. However, the dimension is still 1 when I run the harpconvert tool, when it should definitely be greater than 1.

Command used:
harpconvert -a 'tropospheric_NO2_column_number_density_validity>75; bin_spatial(340, 40, 0.05, 420, -95, 0.05); derive(tropospheric_NO2_column_number_density [Pmolec/cm2]); derive(latitude {latitude}); derive(longitude {longitude}); keep(tropospheric_NO2_column_number_density, latitude_bounds, longitude_bounds, latitude, longitude, datetime_start)' large.nc output.nc

Any help would be appreciated!

I see that you already found the mapping and that you need to use datetime_start.

Note that a spatial binning is not only a lat/lon binning, but also a temporal binning. You are creating a single grid from measurements at different locations and different times. This means that your final grid will have a datetime_start equal to the minimum start time of all measurements and datetime_stop equal to the maximum end time of all measurements (assuming you have a datetime_start and datetime_stop before you call bin_spatial()).

I understand. Do you have any recommendations on how to retain the time variable, or at least extract the different time values for different points across my area? The minimum and maximum values aren’t detailed enough for me, unfortunately.

If you perform a binning, then you will loose the information regarding the individual elements. There is no way around this.

If you actually want to have the information per measurement for your area, then you probably don’t want to perform a binning, but just perform a lat/lon filter (e.g. latitude>=40;latitude<=57;longitude>=-95;longitude<=-74).

Thank you. I ran it without binning, as follows:
harpconvert -a 'tropospheric_NO2_column_number_density_validity>75; latitude>=40; latitude<=57; longitude>=-95; longitude<=-74; derive(tropospheric_NO2_column_number_density [Pmolec/cm2]); derive(latitude {latitude}); derive(longitude {longitude}); keep(tropospheric_NO2_column_number_density, latitude_bounds, longitude_bounds, latitude, longitude, datetime_start)' large.nc output.nc

However, the latitude variable could not be derived.

ERROR: could not derive variable 'latitude {latitude}'

How do I create a lat/lon grid without binning? Thank you!

You can only have one or the other, but not both at the same time.
You can’t spatially regrid a time axis (especially not when you combine data from multiple overpasses).

So, you should probably first reconsider what you really want and why you actually want to have time values per pixel (and why an overall start/stop time for a single overpass for your area is not sufficient).

This clears things up for me. I will keep the bin() operation as that is the most important parameter.

One final question - the datetime_start parameter is providing the start time over my specific area, and not the beginning of the swath, correct? I know that’s what you said in your response but I just want to confirm.

That is correct. It will provide the minimum datetime_start of all pixels that contributed to the target grid (i.e. have at least some overlap).

This clears up all of my questions. I can’t thank you enough!