wrf-model / WPS

The official repository for the WRF Preprocessing System (WPS)
201 stars 157 forks source link

Landmask offset in V4.0 compared to V3.8 #98

Open RobWatersMet opened 5 years ago

RobWatersMet commented 5 years ago

Any help on the following topic would be greatly appreciated.

Running two "identical" model (differ with some defaults), one using v3.8 and one using v4.0.

Issue I am running into is that the default land mask in v4.0 appears offset compared to the identical model from v3.8. As far as i can tell both are using using the default geog resolution of 30s however the new v4.0 uses an improved 20-class MODIS product.

The following scatter plot shows the center points of each grid cell for Mauritius for v3.8. Land grid cells are white/not visible and water grid cells are blue.

screenshot from 2019-01-03 14-46-43

The next shows the same but using v4.0...

screenshot from 2019-01-03 14-48-10

and finally a zoomed in version of the islands to the north...

screenshot from 2019-01-03 14-49-09

RobWatersMet commented 5 years ago

Let me know if there is any more useful information I can provide.

davegill commented 5 years ago

Rob, Please take a look at the wrf-model/WRF PR 746 Fix mismatch isltyp and landmask. wrf-model/WRF#746 If your plots are made with data from the real program or from WRF, this might be what you are seeing.

RobWatersMet commented 5 years ago

Hi Dave,

Thanks for the quick response, much appreciated.

The plots are made from WRF output files and surface_input_source = 1.

I'm not 100% if the above is the issue as the offset appears to be not a result of resolution (both using 30 arc seconds) but I may be wrong.

Is there any way to plot the binary MODIS land use data?

Thanks again, Rob

weiwangncar commented 5 years ago

Rob, Can you provide us your namelist.wps so that we can look into the issue here? Thanks, Wei

On Thu, Jan 3, 2019 at 8:28 AM RobWatersIEA notifications@github.com wrote:

Hi Dave,

Thanks for the quick response, much appreciated.

The plots are made from WRF output files and surface_input_source = 1.

I'm not 100% if the above is the issue as the offset appears to be not a result of resolution (both using 30 arc seconds) but I may be wrong.

Is there any way to plot the binary MODIS land use data?

Thanks again, Rob

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/wrf-model/WPS/issues/98#issuecomment-451177047, or mute the thread https://github.com/notifications/unsubscribe-auth/AMHfkDZo2bltTfL2nVoMGldGxGw_GvQFks5u_iGugaJpZM4ZoNkk .

mgduda commented 5 years ago

There does appear to be a positional shift between the MODIS 21-class dataset and the MODIS 20-class dataset with lakes (i.e., between the default in WPS v3.8 and in WPS v4.0). Something like the script, below, shows these differences around Mauritius.

import numpy as np
import matplotlib.pyplot as plt

tilex = 1200
tiley = 1200

#
# Read WPS v4.0 default: MODIS 20-class with lakes
#
arr = np.fromfile('modis_landuse_20class_30s_with_lakes/27601-28800.07201-08400', dtype='i1')
tile_v4_0 = np.reshape(arr, (tiley, tilex))

#
# Read WPS v3.8 default: MODIS 21-class
#
arr = np.fromfile('modis_landuse_21class_30s/27601-28800.07201-08400', dtype='i1')
tile_v3_8 = np.reshape(arr, (tiley, tilex))

plt.imshow(tile_v3_8[1099:1199,849:949], cmap='spectral', interpolation='nearest', origin='lower')
plt.colorbar()
plt.title('MODIS 21-class')
filename = 'v3_8.png'
plt.savefig(filename,dpi=150)
plt.clf()

plt.imshow(tile_v4_0[1099:1199,849:949], cmap='spectral', interpolation='nearest', origin='lower')
plt.colorbar()
plt.title('MODIS 20-class with lakes')
filename = 'v4_0.png'
plt.savefig(filename,dpi=150)
plt.clf()

#
# Derive landmask from both datasets and compute difference
#
tile_v4_0[np.where(tile_v4_0[:] == 17)] = 0 # Ocean
tile_v4_0[np.where(tile_v4_0[:] == 21)] = 0 # Lake
tile_v4_0[np.where(tile_v4_0[:] != 0)] = 1

tile_v3_8[np.where(tile_v3_8[:] == 17)] = 0 # Ocean
tile_v3_8[np.where(tile_v3_8[:] == 21)] = 0 # Lake
tile_v3_8[np.where(tile_v3_8[:] != 0)] = 1

tile_diff = tile_v4_0 - tile_v3_8

plt.imshow(tile_diff[1099:1199,849:949], cmap='spectral', interpolation='nearest', origin='lower')
plt.colorbar()
plt.title('Landmask: MODIS 20-class with lakes - MODIS 21-class')
filename = 'landmask_diff.png'
plt.savefig(filename,dpi=150)
plt.clf()
barlage commented 5 years ago

I believe these two products (MODIS 20-class and MODIS 21-class) were contributed by different groups so likely did the reprojection differently from the native sinusoidal MODIS grid (probably inconsistent datum). The WRF-Hydro group (and I believe the HRRR group as well) have found better landmask (less of this translation) with the MODIS 15s data than the MODIS 20-class.

RobWatersMet commented 5 years ago

Hi All,

Thanks for all your comments, very helpful.

Below is the namelist.wps @weiwangncar

namelist.zip

I shall investigate the 15s data now.

Thanks again,

Rob

RobWatersMet commented 5 years ago

modis15s

MODIS 15s works perfectly, thanks for the advice.

dmey commented 5 years ago

@RobWatersIEA with regards to your last question, if you are looking to check WPS binary files directly (e.g. plot the binary MODIS land use data) you can use QGIS and the GIS4WRF plugin. You can find the paper "Open source QGIS toolkit for the Advanced Research WRF modelling system" here, or use the following link until the end of February for free access https://authors.elsevier.com/a/1YFYV4sKhEHMOB -- incidentally the topic of misalignment is briefly mentioned in the paper!

image

With regards to this specific issue, and as already mentioned by @barlage, it looks like this data shift is due to a different datum used when the data were converted to WPS binary.

RobWatersMet commented 5 years ago

@dmey just got the plugin working, thanks a lot. This tool looks perfect for looking at the static data (and everything else). It clearly shows the offset for Mauritius.

My own personal solution is just to use the 15s MODIS data but I assume the longer term solution will be to reproduce the WPS binary data, correct?

mgduda commented 5 years ago

It seems possible that we may switch the default land cover dataset to MODIS 15s in the WPS v4.1 release, which would hopefully address this issue for everyone.

@barlage @weiwangncar @dudhia Do you have any opinions on making MODIS 15s the default in v4.1?

weiwangncar commented 5 years ago

Michael, Can you remind me that if this is the dataset we didn’t know where it came from?

On Feb 18, 2019, at 2:58 PM, Michael Duda notifications@github.com wrote:

It seems possible that we may switch the default land cover dataset to MODIS 15s in the WPS v4.1 release, which would hopefully address this issue for everyone.

@barlage https://github.com/barlage @weiwangncar https://github.com/weiwangncar @dudhia https://github.com/dudhia Do you have any opinions on making MODIS 15s the default in v4.1?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/wrf-model/WPS/issues/98#issuecomment-464895569, or mute the thread https://github.com/notifications/unsubscribe-auth/AMHfkDifq9oNW8irCR4ejEPj5aQQlHkjks5vOyIPgaJpZM4ZoNkk .

barlage commented 5 years ago

This is the dataset that actually has a reference paper.

weiwangncar commented 5 years ago

What about the 15 sec one?

On Feb 18, 2019, at 3:26 PM, Michael Barlage notifications@github.com wrote:

This is the dataset that actually has a reference paper.

On Mon, Feb 18, 2019 at 3:22 PM weiwangncar notifications@github.com wrote:

Michael, Can you remind me that if this is the dataset we didn’t know where it came from?

On Feb 18, 2019, at 2:58 PM, Michael Duda notifications@github.com wrote:

It seems possible that we may switch the default land cover dataset to MODIS 15s in the WPS v4.1 release, which would hopefully address this issue for everyone.

@barlage https://github.com/barlage @weiwangncar https://github.com/weiwangncar @dudhia https://github.com/dudhia Do you have any opinions on making MODIS 15s the default in v4.1?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/wrf-model/WPS/issues/98#issuecomment-464895569, or mute the thread <

https://github.com/notifications/unsubscribe-auth/AMHfkDifq9oNW8irCR4ejEPj5aQQlHkjks5vOyIPgaJpZM4ZoNkk

.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/wrf-model/WPS/issues/98#issuecomment-464903271, or mute the thread < https://github.com/notifications/unsubscribe-auth/AMoMuYt1QufzbMwh15Tqitcb-nXlu59Vks5vOyeegaJpZM4ZoNkk

.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/wrf-model/WPS/issues/98#issuecomment-464904456, or mute the thread https://github.com/notifications/unsubscribe-auth/AMHfkLamQUYLLd5bdlV6KPdVzm-BLSOjks5vOyiBgaJpZM4ZoNkk .

barlage commented 5 years ago

@mgduda Now that you've created a "lakes" version of this dataset, I think this is a good idea. We may want to do a quick check of the Arctic. I remember suggesting some adjustments in high latitudes with the original dataset.

dudhia commented 5 years ago

Are we saying that the MODIS 20-class 30" data has an offset that is likely wrong and that 21-class 30" and 15" are correct? Why do the 20-class and 21-class 30" MODIS data have different origins? I thought the 21-class lakes data was generated from the 20-class.

mgduda commented 5 years ago

@barlage I have created a "lakes" version of the MODIS 15s dataset, and I'd be glad to work with you on adjustments before this version is made available to everyone.