Skip to content

Update interpolation in fill_from_pandas to handle NaN values#180

Open
hmkhatri wants to merge 1 commit into
OMS-NetZero:masterfrom
hmkhatri:master
Open

Update interpolation in fill_from_pandas to handle NaN values#180
hmkhatri wants to merge 1 commit into
OMS-NetZero:masterfrom
hmkhatri:master

Conversation

@hmkhatri
Copy link
Copy Markdown

@hmkhatri hmkhatri commented Mar 3, 2026

This pull request adds a feature that allows interpolation to ignore NaN values. Sometimes, CSV files containing emissions data may include NaN values for specific years.

Filter NaN values (if present in csv files) before interpolation to ensure valid results.
@SallyDa
Copy link
Copy Markdown
Contributor

SallyDa commented Apr 1, 2026

Hi Hemant,
With fill_from_pandas you can easily manipulate your csv file (pandas dataframe) before using it to fill values in the FaIR model. This way is more transparent about the input data going into FaIR. Or have I not what you are trying to do here?

@hmkhatri
Copy link
Copy Markdown
Author

hmkhatri commented Apr 1, 2026

Hi @SallyDa,

The added feature ensures that the fill_from_pandas call avoids using those years that have NaNs during the interpolation step. It fills those years with interpolated values whenever NaNs are present in the emissions CSV files. In the current version, if any missing values (NaNs) exist in the CSV files, the interpolation inside fill_from_pandas results in NaNs across all years and triggers an error.
I have been using emissions data from the RCMIP protocol (https://zenodo.org/records/4589756), which contains missing values. As a user, I can preprocess this emissions file and fill the missing values before supplying it to FaIR. However, I suggest adding built‑in interpolation handling for NaNs (as implemented in this pull request), so that FaIR manages missing values internally and users do not need to preprocess the data beforehand.

@SallyDa
Copy link
Copy Markdown
Contributor

SallyDa commented Apr 1, 2026

Yes, I understand what you want to do, and good that you can already do it, with the preprocessing step. Normally FaIR requires users to be very conscious of their input data (i.e. checking and cleaning it before using it in the model), but I will leave @chrisroadmap to make the decision on this pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants