Xee icon indicating copy to clipboard operation
Xee copied to clipboard

download MODIS (crs: SR-ORG:6974) data appears obscured

Open cug-xyx opened this issue 1 year ago • 8 comments
trafficstars

Dear Developers:

Thank you so much for being able to develop the awesome xee.

I was downloading the MODIS series product (MODIS/061/MOD16A2GF) and noticed that the downloaded data was shaded.

I think it's a problem with the crs.

Here are the images and code:

ic_name = 'MODIS/061/MOD16A2GF'

ic = ee.ImageCollection(ic_name) \
  .select("ET") \
  .filterDate('2013-06-02', '2013-06-03')

ds = xarray.open_dataset(
    ic, engine='ee',
    crs = 'EPSG:4326', 
    scale=0.25
)
ds

image

ds.to_netcdf('test.nc')

r = xr.open_dataarray('test.nc')
r

image

r \
    .assign_attrs(crs='EPSG:4326') \
    .transpose() \
    .plot(
    vmin=0, vmax=300,
    levels=[i for i in range(0, 270, 30)],
    colors=['#ffffff', '#fcd163', '#99b718', '#66a000',
            '#3e8601', '#207401', '#056201', '#004c00', '#011301']
)

image

cug-xyx avatar Dec 29 '23 04:12 cug-xyx

What specifically do you mean by "shaded"?

simonff avatar Jan 02 '24 01:01 simonff

I'm sorry. Maybe I didn't describe it properly.

This image is ok on GEE.

var dataset = ee.ImageCollection('MODIS/NTSG/MOD16A2/105');
var ET = dataset.select('ET').filterDate('2013-06-02', '2013-06-03');
var ETVis = {
  min: 0,
  max: 300,
  palette:
      ['#ffffff', '#fcd163', '#99b718', '#66a000',
            '#3e8601', '#207401', '#056201', '#004c00', '#011301'],
};
Map.addLayer(ET, ETVis, 'Evapotranspiration');

image

But exporting locally using xee results in something like the following:

image

cug-xyx avatar Jan 02 '24 01:01 cug-xyx

Ah, you mean the weird yellow area over Americas and Antarctica. I agree this is wrong.

simonff avatar Jan 02 '24 03:01 simonff

Indeed. But xee is so good that I just can't live without it, so I'm looking for a solution here

cug-xyx avatar Jan 02 '24 03:01 cug-xyx

Let's see what the actual developers say - I'm just another xee user

simonff avatar Jan 02 '24 03:01 simonff

Have you tried this with different times or different bands and does it yield the same result? I am also having a problem with bringing MODIS data across via xee, though a bit different to what you are showing.

scheip avatar Jan 05 '24 14:01 scheip

Have you tried this with different times or different bands and does it yield the same result? I am also having a problem with bringing MODIS data across via xee, though a bit different to what you are showing.

@scheip, I've tried different periods and it's the same problem :(

cug-xyx avatar Jan 06 '24 05:01 cug-xyx

What I notice about this dataset is that each band has a different scale, which is the same case as #122. There is a chunk of code in get_info where xee infers a number of collection-wide attributes like the primary coordinate. Just spitballing, but maybe that has something to do with it? Like that data differs between bands with different scales?

noahgolmant avatar Jan 09 '24 20:01 noahgolmant

I'm attempting to create a reproducible example of this issue, but I am encountering an error when converting to NetCDF

https://colab.research.google.com/gist/tylere/3faef2df6558a6458b896c1dd58024b1/xee_issue_119.ipynb

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-9-5c431fe9edba> in <cell line: 1>()
----> 1 ds.to_netcdf('test.nc')

8 frames
/usr/local/lib/python3.10/dist-packages/scipy/io/_netcdf.py in _write_var_metadata(self, name)
    483         self._pack_int(len(var.dimensions))
    484         for dimname in var.dimensions:
--> 485             dimid = self._dims.index(dimname)
    486             self._pack_int(dimid)
    487 

ValueError: 86400 is not in list

@cug-xyx are you still able to reproduce the error you originally reported? If so, could you fully describe your environment, including the versions of Python, Xee, and any installed packages?

tylere avatar Nov 18 '24 19:11 tylere

Hi @tylere,

I don't know what happened, but I think the bug has been fixed, here is the same example i reproduced.

https://colab.research.google.com/drive/1QL8-_NL_Y4vupzhdAvfpvlWD0IYf7OZX?usp=sharing

cug-xyx avatar Nov 19 '24 01:11 cug-xyx

Hi @cug-xyx,

I'm not able to access the Colab link you shared. Could you either:

  1. share your Colab notebook on Drive publicly (Share -> Anyone with the link), or
  2. share the Colab notebook as a GitHub Gist (File -> Save a copy as a GitHub Gist)

tylere avatar Dec 11 '24 21:12 tylere

Hi @tylere

I changed the permissions and now you should be able to access the link!

cug-xyx avatar Dec 12 '24 05:12 cug-xyx

Thanks for updating the permissions. I was able to reproduce your successful run, but only after I installed the netcdf4 package into Colab. !pip install --quiet netCDF4

Script: https://colab.research.google.com/gist/tylere/f9ff7c75d5c9611dfa4192f003b02c33/xee-issue-119.ipynb#scrollTo=SrNyCSEKxnLy

Given that the original issue seems to have been resolved, I am closing the issue.

tylere avatar Jan 02 '25 20:01 tylere