-1

I have two files with the same spatial and temporal dimension, with ERA5_w1 being the observation and CCMP_w1 being the forecast file.

I wonder how I can calculate the R-M-S-E to get a spatial distribution of the R-M-S-E over the 28 timesteps in a 3-dimensional field?

File information and download link are below:

ERA5_w1

CCMP_w1

I would like to generate an R-M-S-E plot like the image below:

enter image description here

Link to download the files: Files

Michael Delgado
  • 13,789
  • 3
  • 29
  • 54
  • 1
    you can certainly do this in xarray too - implementing RMSE is pretty trivial. Can you post what you've tried and where you're stuck? also, [please don't upload images of data, code, or errors](//meta.stackoverflow.com/q/285551) - instead, paste them as [formatted code blocks](/help/formatting). For datasets, you can paste the output generated by `print(ds)`, or better yet, create the data synthetically to form a [mre]. Thanks! – Michael Delgado Aug 23 '22 at 17:39

1 Answers1

1

One option for doing this is my package nctoolkit. The following code will calculate RSME for your data.

import nctoolkit as nc
# load the two files as datasets
ds1 = nc.open_data("CCMP_w1")
ds2 = nc.open_data("ERA5_w1")
# subtract the data in one dataset from the other
ds1.subtract(ds2)
#square the differences
ds1.power(2)
# sum up over all time steps
ds1.tsum()
# divide by the number of time steps
ds1.divide(28)
#square the results
ds1.sqrt()
# view the results
ds1.plot("WS10")

At present there isn't an explicit rsme method in nctoolkit, but I plan to add one in an upcoming release.

More details about the package here

Robert Wilson
  • 3,192
  • 11
  • 19
  • Thank you very much, my friend! Do you have any documentation on how I could do the same to get MAE, MAPE and other metrics? I appreciate it! – William Jacondino Aug 23 '22 at 17:53
  • You could calculate all of those using a similar approach to that above with the arithmetic methods listed here https://nctoolkit.readthedocs.io/en/latest/api.html – Robert Wilson Aug 23 '22 at 19:44