Page 1 of 1

Oceans Melting Greenland (OMG) MBES and SBES Bathymetry L2 V

PostPosted: Tue Oct 22, 2019 7:17 am
by fraser
I'm not having much success reading the .nc files assocaiated with:
https://podaac.jpl.nasa.gov/dataset/OMG ... ES_Gridded
https://podaac.jpl.nasa.gov/dataset/OMG ... ES_Gridded

I tried reading in ArcMap 10.7 but just got a single point instead or raster. Below shows results from using gdalinfo to read header one of the files.

E:\OSGeo4W64\bin>gdalinfo OMG_Bathy_MBES_L2_20160907000000.nc
Warning 1: Recode from UTF-8 to CP_ACP failed with the error: "Invalid argument".
Warning 1: OMG_Bathy_MBES_L2_20160907000000.nc is a netCDF file, but without any dimensions >= 2.
ERROR 4: `OMG_Bathy_MBES_L2_20160907000000.nc' not recognized as a supported file format.
gdalinfo failed - unable to open 'OMG_Bathy_MBES_L2_20160907000000.nc'.

Any suggestions?

David

Re: Oceans Melting Greenland (OMG) MBES and SBES Bathymetry

PostPosted: Wed Oct 23, 2019 11:51 am
by yiboj
Hi David,
Thanks for the inquiry.
The OMG MBES and SBES Bathymetry L2 data format is not in GMT configuration, but you still can read it using netCDF reader such as https://github.com/nasa/podaac_tools_and_services/tree/master/read_nc_py. Please try and let us know.
Regards,

-PODAAC DE

Re: Oceans Melting Greenland (OMG) MBES and SBES Bathymetry

PostPosted: Wed Oct 23, 2019 3:08 pm
by fraser
Thank you for your reply!!

I am still not clear why I can't use gdal functions with these .netCDF files. What is GMT configuration? Any suggestions on how to translate these datasets to geotiff.

Best regards,

David

Re: Oceans Melting Greenland (OMG) MBES and SBES Bathymetry

PostPosted: Wed Jun 03, 2020 10:16 pm
by caseyebrayton
I am trying to plot data in these .nc files in Python - but I'm a little confused by how the variables are organized. For instance, in OMG_Bathy_MBES_L2_20150725000000.nc, all of the variables have the shape (21698046,). In order to plot this, do I need to reshape the data into an array of x,y,z dimensions? How do I determine what the shape is supposed to be? Many thanks!

Re: Oceans Melting Greenland (OMG) MBES and SBES Bathymetry

PostPosted: Fri Jun 05, 2020 3:33 pm
by yiboj
Hi,
Thanks for your inquiry.
The latitude, longitude and depth variables in the L2 files are all 1D array, so you may need to reshape them into 2D or 3D matrix if you ant to plot contour or 3D plot. Hope this helps and please let me know if you have any further questions.
Regards,
PODAAC DE

Re: Oceans Melting Greenland (OMG) MBES and SBES Bathymetry

PostPosted: Tue Jun 23, 2020 2:44 pm
by caseyebrayton
Thank you for your response! I do need a little extra help with reshaping - potentially a stupid question, but I am used to working with uniformly spaced model output. I imagined that to reshape into a 3D array, I just need to use the min/max lat/lon and resolution to determine what the shape should be. However, is the resolution not uniform? I see that spacing between lat/lon gets progressively larger.

Since you need to know what the dimensions of the array are supposed to be able to reshape an array, how do I know what the shape should be? How many depth levels are there?

Re: Oceans Melting Greenland (OMG) MBES and SBES Bathymetry

PostPosted: Tue Jun 23, 2020 9:25 pm
by yiboj
Hi,
Thanks for your inquiry and support.
Please check the reshape function manual for better instruction.
Regards,
PODAAC DE

Re: Oceans Melting Greenland (OMG) MBES and SBES Bathymetry

PostPosted: Wed Jun 24, 2020 11:42 am
by caseyebrayton
Thank you again for your reply.

I am aware of how to use the reshape function. To use the reshape function, you need to specify the shape of the desired array. I’m asking how the data in the 1D arrays is organized to better understand what shape the new array needs to be (what len the lat, lon, and depth dimension should be). Should the new array be (21698046, 21698046)?

Re: Oceans Melting Greenland (OMG) MBES and SBES Bathymetry

PostPosted: Fri Jun 26, 2020 8:47 am
by yiboj
Hi,
Thanks for your inquiry and support.
It seems like you may have to use meshgrid function in numpy package to interpret 1D arrays of lat, lon and depth into 3D or 2D matrix in order to make 2D or 3D plot. Please check the meshgrid function to see if it fits your need, and let me know if this works for you.
Regards,
PODAAC DE