islasimpson / ERA5interp

Apache License 2.0
0 stars 0 forks source link

interpolation to 4D pressure #5

Open islasimpson opened 1 year ago

islasimpson commented 1 year ago

@JulioTBacmeister I'm struggling with doing this efficiently. At some point you posted in our chat what you were doing but I've lost the chat history. Can you let me know what you're doing to interpolate onto a 4-dimensional pressure efficiently? Thanks

JulioTBacmeister commented 1 year ago

I'm not really worrying about efficiency at this point, but here is what I'm doing

1) conservative horizontal remapping from ERA5 to CAM grid using ESMFpy 2) follwed by 1D interpolation in the vertical using scipy's interpolate package. i.e., e.g., "from scipy import interpolate as intr"

My performance numbers - interpolating ERA5 with 6 times X 5 variables (T,q,u,v,w) to an ne30pg3 L58 CAM grid - are these: Reading all ERA5 variables ~160 seconds Vertical interpolation ~140 seconds other processing ~120 seconds

I'm hoping eventually we can exploit the "embarrassing parallelism" of the vertical interpolation using DASK. But as I said I am not worried about efficiency at this point - I just want something that works correctly and that I understand

My codes are here if you want to have a look: /glade/work/juliob/myPythonTools/NudgingDataPrep/

islasimpson commented 1 year ago

Ok, thanks. So at the moment you're just doing a straightforward extrapolation when the CAM lowest model level is below the ERA5 lowest model level? I was finding that GeoCAT interp_hybrid_to_pressure function was essentially unusable. I don't know how long it was taking to do 6 times x 5 variables because I didn't let it get there. I got too impatient. Perhaps I'll follow your approach using interp1d and try add the extrapolation based on lapse rate feature. @brianpm - does that sound like a reasonable approach to you? Or do you think ncremap would be better, as we talked about yesterday.

JulioTBacmeister commented 1 year ago

Right, I just use scipy's fill_value='extrapolate' mode. BTW I am using quadratic vertical interpolation for T.