Accessing tiled NetCDFs at xarray (MSLSP30NA)
Posted: Fri Dec 08, 2023 1:13 pm America/New_York
Hello,
I am interested in working with phenology data over my study area and want to use the MSLSP30NA product ( https://doi.org/10.5067/Community/MuSLI/MSLSP30NA.011) for that.
My goal is to have a gridded product over my area that I can use for easy visualization and as input into modelling. I am familiar with STAC and xarray and have had no issues building similar products using HLS (e.g., https://lpdaac.usgs.gov/products/hlsl30v002/), for example. I am trying to convert the NetCDF tiles that make up this dataset into this xarray format over a larger area. This would involve merging all the tiles along lat/lon and maybe time (e.g., get the mean value for variables between 2018/2019 years for each pixel).
I have tried a couple different ways to accomplish this but without success.
1. Earthaccess > xarray.open_mfdataset. If I narrow the earthaccess search to a single granule this works. However, if increase to more than one (e.g., a second time dimension) it will error out (e.g., ValueError: Could not find any dimension coordinates to use to order the datasets for concatenation). It is possible some combination of parameters will allow me to specify dimension coordinates but I am unsure.
2. Accessing the STAC directly using pystac_client and stackstac. The main issue here appears to be the lack of an EPSG metadata attribute 'out_epsg' (the x/y variables looks like lat/lon EPSG:4326).
I am not experienced with using NetCDF files, especially in an xarray environment. So I am not sure if the issue with how to load them or if there is an issue with this dataset (e.g., lack of set EPSG) that prevents it being manipulated in this way.
Thanks for your help.
Mitchell B.
I am interested in working with phenology data over my study area and want to use the MSLSP30NA product ( https://doi.org/10.5067/Community/MuSLI/MSLSP30NA.011) for that.
My goal is to have a gridded product over my area that I can use for easy visualization and as input into modelling. I am familiar with STAC and xarray and have had no issues building similar products using HLS (e.g., https://lpdaac.usgs.gov/products/hlsl30v002/), for example. I am trying to convert the NetCDF tiles that make up this dataset into this xarray format over a larger area. This would involve merging all the tiles along lat/lon and maybe time (e.g., get the mean value for variables between 2018/2019 years for each pixel).
I have tried a couple different ways to accomplish this but without success.
1. Earthaccess > xarray.open_mfdataset. If I narrow the earthaccess search to a single granule this works. However, if increase to more than one (e.g., a second time dimension) it will error out (e.g., ValueError: Could not find any dimension coordinates to use to order the datasets for concatenation). It is possible some combination of parameters will allow me to specify dimension coordinates but I am unsure.
2. Accessing the STAC directly using pystac_client and stackstac. The main issue here appears to be the lack of an EPSG metadata attribute 'out_epsg' (the x/y variables looks like lat/lon EPSG:4326).
I am not experienced with using NetCDF files, especially in an xarray environment. So I am not sure if the issue with how to load them or if there is an issue with this dataset (e.g., lack of set EPSG) that prevents it being manipulated in this way.
Thanks for your help.
Mitchell B.