# Add additional support for more product files by producing similar product files with already-supported product files

**URL:** https://forum.atmospherictoolbox.org/t/add-additional-support-for-more-product-files-by-producing-similar-product-files-with-already-supported-product-files/444
**Category:** HARP
**Created:** [December 20, 2021, 3:34pm UTC](https://forum.atmospherictoolbox.org/t/add-additional-support-for-more-product-files-by-producing-similar-product-files-with-already-supported-product-files/444 "2021-12-20T15:34:38Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![PowderL](https://forum.atmospherictoolbox.org/user_avatar/forum.atmospherictoolbox.org/powderl/32/213_2.png) [@PowderL](https://forum.atmospherictoolbox.org/u/PowderL)
#### Post date: [December 20, 2021, 3:34pm UTC](https://forum.atmospherictoolbox.org/t/add-additional-support-for-more-product-files-by-producing-similar-product-files-with-already-supported-product-files/444/1 "2021-12-20T15:34:38Z")

</div>

Like the question I asked in [github](https://github.com/stcorp/harp/issues/258), is there any possibility to generate a fake product file by replacing the original values of the geolocation variable and concerned variable with values from another unsupported product file? This should help support more product files.

---

<div class="post-metadata">

### Author: ![sander.niemeijer](https://forum.atmospherictoolbox.org/user_avatar/forum.atmospherictoolbox.org/sander.niemeijer/32/5_2.png) [@sander.niemeijer](https://forum.atmospherictoolbox.org/u/sander.niemeijer)
#### Post date: [December 21, 2021, 3:18pm UTC](https://forum.atmospherictoolbox.org/t/add-additional-support-for-more-product-files-by-producing-similar-product-files-with-already-supported-product-files/444/2 "2021-12-21T15:18:37Z")

</div>

You have to be aware that HARP supports two types of products:

- Products that are already stored [using HARP conventions](http://stcorp.github.io/harp/doc/html/conventions/index.html) (which can be [netcdf3](http://stcorp.github.io/harp/doc/html/conventions/netcdf3.html), [hdf4](http://stcorp.github.io/harp/doc/html/conventions/hdf4.html), or [netcdf4/hdf5](http://stcorp.github.io/harp/doc/html/conventions/hdf5.html))
- Products in one of the foreign formats for which an importer is available (as listed [in the documentation](http://stcorp.github.io/harp/doc/html/ingestions/index.html))

Trying to modify a product which is in an external format to allow it to be read by HARP does not make sense. You are then better of creating your own product having HARP conventions directly (i.e. creating your own HARP importer).

Creating a converter is not that difficult if you use the HARP python interface.

A template script for how to do this is the following:

```
import numpy as np
from datetime import datetime, timedelta

import harp

product = harp.Product()

# replace this section with reading routines to get data from your own product
times = [datetime(2020,1,1) + timedelta(seconds=x) for x in range(100)]
latitude_bounds = np.zeros([100,4])
longitude_bounds = np.zeros([100,4])
co2 = np.zeros([100])

# datetime
time_origin = datetime(2000, 1, 1)
times = np.array([(t - time_origin).total_seconds() / (24 * 60 * 60) for t in times])
product.datetime = harp.Variable(times, ["time"])
product.datetime.unit = "days since 2000-01-01"

# latitude
product.latitude_bounds = harp.Variable(latitude_bounds, ["time", None])
product.latitude_bounds.unit = "degree_north"
# longitude
product.longitude_bounds = harp.Variable(longitude_bounds, ["time", None])
product.longitude_bounds.unit = "degree_east"
# value
product.CO2_column_number_density = harp.Variable(co2, ["time"])
product.CO2_column_number_density.unit = "molec/cm^2" # replace with actual unit of measurement

# Export as HARP product
harp.export_product(product, "myproduct.nc")

```

If you want to create a L3 grid from it, you don’t even have to export to a file. You could then directly use the following to get your grid:

```
gridded_product = harp.execute_operations(product, 'bin_spatial(....)')
```

---

<div class="post-metadata">

### Author: ![PowderL](https://forum.atmospherictoolbox.org/user_avatar/forum.atmospherictoolbox.org/powderl/32/213_2.png) [@PowderL](https://forum.atmospherictoolbox.org/u/PowderL)
#### Post date: [December 25, 2021, 2:21pm UTC](https://forum.atmospherictoolbox.org/t/add-additional-support-for-more-product-files-by-producing-similar-product-files-with-already-supported-product-files/444/3 "2021-12-25T14:21:18Z")

</div>

Thanks for your help. Harp is a powerful tool and can do more than I thought. I obtained the L3 grid data of OCO-2 product.
