gempy icon indicating copy to clipboard operation
gempy copied to clipboard

Question about save solution to netCDF

Open ooooohhhhhxxx opened this issue 2 years ago • 3 comments

What is your question? I want to save solution to netCDF for farther analysis in ArcGIS Pro. I found the solution_to_netcdf function in io.py and tried to use it after I installed subsurface.

import gempy as gp

load_model_path = '/Users/jinxuanchen/Documents/AGS_Project/modelsave/testsave'
loaded_model = gp.load_model(name='testsave', path=load_model_path)
gp.set_interpolator(loaded_model)
model_solutions = gp.compute_model(loaded_model, compute_mesh=True, to_subsurface=True)

from gempy.api_modules.io import solution_to_netcdf

saveparameter = {}
solution_to_netcdf(saveparameter,loaded_model,'test1','/Users/jinxuanchen/Documents/AGS_Project/modelsave/test')

I successfully export netCDF, but when I add it into ArcGIS Pro, a warning appeared and cannot be loaded.

image

I also tried to load the file in xarray, the result is as follows

image

So I'm not sure whether netCDF is exporting correctly, or if ArcGIS Pro has a problem supporting data in netCDF format.

ooooohhhhhxxx avatar Jul 11 '22 15:07 ooooohhhhhxxx

From looking at the xarray, it seems allright. Does ArcGIS not load at all? Possibly, you can ignore the warnings? X Y Z seem to be populated and are not empty. You could check in the xarray, whether X Y Z have also NaN values there?

Japhiolite avatar Jul 26 '22 08:07 Japhiolite

From looking at the xarray, it seems allright. Does ArcGIS not load at all? Possibly, you can ignore the warnings? X Y Z seem to be populated and are not empty. You could check in the xarray, whether X Y Z have also NaN values there?

I tried to adjust the parameters in the subsurface so that the _FillValue value is -9999 instead of NaN. Although the attribute '_FillValue' is NaN error is no longer reported, a new error has appeared. It seems that ArcGIS only supports {X,Y,Z ,T} or {T,Z,Y,X} order netCDF files, when using the solution_to_netcdf function, is there a parameter to adjust the order?

ooooohhhhhxxx avatar Jul 29 '22 10:07 ooooohhhhhxxx

What is T in your order? The parameter value at positions xyz? There is not a parameter for that in the gempy method. In the end, we use the xarray method to_netcdf, so it might work best to adjust an order with xarray if possible.

Japhiolite avatar Jul 29 '22 13:07 Japhiolite

@ooooohhhhhxxx is there still a problem here?

AlexanderJuestel avatar Dec 29 '22 18:12 AlexanderJuestel

Closing due to inactivity, feel free to reopen if the issue still persists.

AlexanderJuestel avatar Mar 17 '23 13:03 AlexanderJuestel