Some questions about Polar2Grid

davidh
Posts: 116
Joined: Tue Jun 04, 2013 11:19 am

Re: Some questions about Polar2Grid

Post by davidh »

Hi Dmitry,

Using a command line text editor like "vi" or "emacs" you need to edit the following file:

polar2grid_v_2_0/ShellB3/lib/python2.7/site-packages/polar2grid.crefl-2.0.0-py2.7.egg/polar2grid/crefl/crefl2swath.py

You'll make changes to two lines of code. First, on line 599 you'll see this:

ft = FT_GMTCO if self.use_terrain_corrected else FT_GIMGO

you'll need to change this to say:

ft = FT_GMTCO if self.use_terrain_corrected else FT_GMODO

Note that it is just changing "FT_GIMGO" to "FT_GMODO". Second, on line 607 you'll see this:

f = viirs_module.Frontend(search_paths=geo_files)

and you should change it to say:

f = viirs_module.Frontend(search_paths=geo_files, use_terrain_corrected=self.use_terrain_corrected)

After that, your command should work. Good luck.

Dave
Dmitry
Posts: 34
Joined: Mon Feb 29, 2016 3:56 am

Re: Some questions about Polar2Grid

Post by Dmitry »

Dear Dave,

Thanks a lot for the provided information.

Please, I hace a couple of questions:

1. While using viirs2hdf5.sh in the polar2grid scenario do I get in the output file the corrected values (crefl) for m-bands 1-7? In case I do not get these values, how do I get the H5 file for all VIIRS m-bands after performing the correction for 1-7 bands?

2. I did not get any answer whether I could generate in polar2grid a multispectral image (for more than 3 bands, for example, for 10 bands) in gtiff format.

Dmitry
davidh
Posts: 116
Joined: Tue Jun 04, 2013 11:19 am

Re: Some questions about Polar2Grid

Post by davidh »

Hi Dmitry,

1. No these are not corrected reflectances in the HDF5 file. There is not a nice wrapper script for this, but what you could try is running the following two commands:

source polar2grid_v_2_0/bin/polar2grid_env.sh
polar2grid_v_2_0/ShellB3/bin/python -m polar2grid.glue crefl hdf5 ...

That should give you output that you expect, but I've never run this before so I'm not sure what will happen.

2. Sorry I kept forgetting to answer this question. No it is not possible. I'm not used to seeing geotiff being used for more than a simple image format (RGB, RGBA, and grayscale images).

Dave
Dmitry
Posts: 34
Joined: Mon Feb 29, 2016 3:56 am

Re: Some questions about Polar2Grid

Post by Dmitry »

Dear Dave,

I have tried, but I can't get the expected output even running those two commands.
May be is possible to create a more simple scenario? Or may be to have it into account for further p2g updates?

Dmitry
davidh
Posts: 116
Joined: Tue Jun 04, 2013 11:19 am

Re: Some questions about Polar2Grid

Post by davidh »

Hi Dmitry,

Yes it should be easier to do in the future. When you say you aren't getting the expected results what do you mean?

Dave
Dmitry
Posts: 34
Joined: Mon Feb 29, 2016 3:56 am

Re: Some questions about Polar2Grid

Post by Dmitry »

Dear Dave,

Please find what I mean:
____________________________

When executing the previously mentioned commands I get the the following information:

~/Downloads/polar2grid_v_2_0/bin$ ./polar2grid_env.sh
bash: ./polar2grid_env.sh: Permission denied

and if using administrator rights, then I get:
polar2grid_env.sh: command not found

When omiting this procedure, the I get:
ERROR : Couldn't find 'h5SDS_transfer_rename' command in PATH
ERROR : Could not create VIIRS CREFL files
Traceback (most recent call last):
File "/home/IPOPP/Downloads/polar2grid_v_2_0/ShellB3/lib/python2.7/site-packages/polar2grid.crefl-2.0.0-py2.7.egg/polar2grid/crefl/crefl_wrapper.py", line 158, in run_cviirs
run_hdf5_rename(geo_file, svm_temp_file, "Latitude")
File "/home/IPOPP/Downloads/polar2grid_v_2_0/ShellB3/lib/python2.7/site-packages/polar2grid.crefl-2.0.0-py2.7.egg/polar2grid/crefl/crefl_wrapper.py", line 80, in run_hdf5_rename
raise
ValueError("h5SDS_transfer_rename was not found your PATH")
ValueError: h5SDS_transfer_rename was not found your PATH
ERROR : Could not create VIIRS CREFL files
ERROR : Could not create crefl files from SDRs
ERROR : crefl frontend failed to load and sort data files (see log for details)

What I am doing wrong?
davidh
Posts: 116
Joined: Tue Jun 04, 2013 11:19 am

Re: Some questions about Polar2Grid

Post by davidh »

Hi Dmitry,

You need to use the word "source" before the first command like I did. This will load environment variables from the script in to your current bash environment and should allow the second command to work.

I also suggest never running any of Polar2Grid as root (with administrator privileges).

Dave
Dmitry
Posts: 34
Joined: Mon Feb 29, 2016 3:56 am

Re: Some questions about Polar2Grid

Post by Dmitry »

Dear Dave,

Thank you for your help.

I have taken into consideration all your suggestions and performed the processing, however, I got an HDF5 file with 3 corrected bands (m01, m03, m04). My goal is to get a 16-band HDF5 file with 7 corrected bands, and the rest of bands just аs brightness temperature values.

Is it possible??

Dmitry
davidh
Posts: 116
Joined: Tue Jun 04, 2013 11:19 am

Re: Some questions about Polar2Grid

Post by davidh »

Try this:

source polar2grid_v_2_0/bin/polar2grid_env.sh
polar2grid_v_2_0/ShellB3/bin/python -m polar2grid.glue crefl hdf5 ... -p viirs_crefl01 viirs_crefl02 viirs_crefl03 viirs_crefl04 viirs_crefl05 viirs_crefl06 viirs_crefl07
polar2grid_v_2_0/ShellB3/bin/python -m polar2grid.glue viirs hdf5 ... -p m08 m09 m10 m11 m12 m13 m14 m15 m16

Where "..." are the flags you normally use. However, note that the crefl algorithm (limitation of the software we use, not of polar2grid) only supports the first 7 M-bands right now. So your M08 through M11 in your output HDF5 file would be regular (uncorrected) reflectances. If you would rather not have these in the HDF5 file then simply do not specify them with the "-p" flag.

Dave
Dmitry
Posts: 34
Joined: Mon Feb 29, 2016 3:56 am

Re: Some questions about Polar2Grid

Post by Dmitry »

Dear Dave,

Thanks a lot for all your efforts and your support, I have got the required results. I will be awaiting further software developments and more supported bands, but any way I am very pleased with your assistance, which has gave me all the possible results according to current software capabilities.

Please , Dave, could I perform the same actions for the MODIS sensor?

Dmitry
Post Reply