Airspace-Encounter-Models / em-core

Software and data used by multiple repositories in the Aerospace Encounter Models organization.
BSD 2-Clause "Simplified" License
2 stars 8 forks source link

[ENHANCEMENT] #15

Open AnkithThodupunoori opened 2 years ago

AnkithThodupunoori commented 2 years ago

Instructions

Read the instructions and fill out your responses at the bottom.

Relation

Is your feature request related to a problem? Please describe. Please provide a clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Description

A clear and concise description of what you want to happen.

Alternatives

A clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context or screenshots about the feature request here.

FILL ME OUT

Relation

.hdr files which are located in DEM_GLOBE folder are unable to be read by code. when ever i execute RUN_Airspace_1, it throws an error saying "e10g" file format unable to read. i have tried to with automatic generated file format by running setup script and with manual downloaded file. both doesnt work.

Description

the error thrown by matlab looks like shown bellow. can i know how to get rid of this issue and execute the code further.

Error using georasterinfo (line 70) Unable to read 'e10g'. Format may not be supported, file may be corrupt, or a supporting file may have been specified.

Error in msl2agl (line 189) info = georasterinfo(inFile);

Error in readAirspace (line 108) parfor i=1:1:numel(LAT_deg)

Error in RUN_Airspace_1 (line 30) airspaceUS = readAirspace('inFile',inFile,...

Alternatives

Additional

aweinert-MIT commented 2 years ago

What version of MATLAB are you using? Can you please confirm you successfully ran the startup scripts?

AnkithThodupunoori commented 2 years ago

my matlab version is R2021b, i executed the setup file, but i am not sure it executed completely, i attached a picture what it is showing at the end when i run setup file.

Em_Core issues

aweinert-MIT commented 2 years ago

Unable to establish SSL connection, so it looks like the files were not downloaded. You can confirm this by inspecting if the files are in the `em-core/data/DEM-GLOBE directory.

A common culprit is not setting a web proxy if you're working on a managed network.

AnkithThodupunoori commented 2 years ago

files are already in dem_gobe folder dem_globe files

aweinert-MIT commented 2 years ago

That's good. The files are there, so we can assume the system environment variable was set correctly. Is em-core added to your MATLAB path?

AnkithThodupunoori commented 2 years ago

yes it is added to the path

aweinert-MIT commented 2 years ago

georasterinfo is part of the MATLAB mapping toolbox. Can you please confirm you have access to the mapping toolbox?

AnkithThodupunoori commented 2 years ago

yes, mapping tool box is installed in my matlab. image

AnkithThodupunoori commented 2 years ago

in gerasterinfo , at line 37, the command is not able to execute, thats the one throwing error image

AnkithThodupunoori commented 2 years ago

is it a file format issue or the matlab file "georasterinfo" ?

aweinert-MIT commented 2 years ago

On Line 108, replace parfor with for, so it reads fori=1:1:numel(LAT_deg)

aweinert-MIT commented 2 years ago

On Line 108, replace parfor with for, so it reads fori=1:1:numel(LAT_deg)

@AnkithThodupunoori Where you able to test this proposed change? Do you have access to the parallel toolbox. If no, replace 'parfor' may address the bug. Also replacing it should produce a different error message, which hopefully should be more insightful.

AnkithThodupunoori commented 2 years ago

i have the parfor tool box. anyway i made the changes as you asked to replace the parfor to for loop, this is the error i am getting after executing the code. image

aweinert-MIT commented 2 years ago

what is inFile on line 189? That error reads like it can find the e10g file, but you're previously shown it is downloaded:

files are already in dem_gobe folder dem_globe files

AnkithThodupunoori commented 2 years ago

infile represents the "e10" file, matlab is able to find the file but it just cant read the file. image

aweinert-MIT commented 2 years ago

If you change directory to DEM-GLOBE, can you load the file via command line?

AnkithThodupunoori commented 2 years ago

it gives the same error, saying unable to read the file format or file may be corrupted, as shown below. image

AnkithThodupunoori commented 2 years ago

if i use the fileread function, it reads the data in characters but cannot be displayed as the legth of the character is too large. image

but when i use the same function which is used in georasterinfo, it throws the error as usual. image

aweinert-MIT commented 1 year ago

Have you tried redownloading e10g manually and confirm it isn't corrupted?

AnkithThodupunoori commented 1 year ago

Yes, Just now downloaded manually and tried to execute the code, it shows same error.

aweinert-MIT commented 1 year ago

The output should look something like this (I slightly censored the Filename property):

>> inFile = [getenv('AEM_DIR_CORE') filesep 'data' filesep 'DEM-GLOBE' filesep 'e10g'];
>> info = georasterinfo(inFile)
Warning: Projection information missing from 'e10g'. Assuming the RasterReference property is a map raster reference object. 
> In georasterinfo>constructRasterReference (line 163)
In georasterinfo (line 52) 
info = 
  RasterInfo with properties:

                     Filename: ["\em-core\data\DEM-GLOBE\e10g"    "\em-core\data\DEM-GLOBE\e10g.hdr"]
             FileModifiedDate: [2004-05-07 13:31:30    2004-05-07 13:48:38]
                     FileSize: [129600000 340]
                   FileFormat: "Esri GridFloat"
                   RasterSize: [6000 10800]
                     NumBands: 1
                 NativeFormat: "int16"
         MissingDataIndicator: -500
                   Categories: []
                    ColorType: "unknown"
                     Colormap: []
              RasterReference: [1×1 map.rasterref.MapCellsReference]
    CoordinateReferenceSystem: []
                     Metadata: []
>> 
aweinert-MIT commented 1 year ago

Is both e10g and e10g.hdr in your directory?

AnkithThodupunoori commented 1 year ago

NO, I have only one file "e10g" in my directory.

AnkithThodupunoori commented 1 year ago

i tried to generate the output of the file using the code you posted above, this is how it showing. image

aweinert-MIT commented 1 year ago

The bug looks to be with using georasterinfo and not the MATLAB code in em-core. Only the e10g file is required and extracted from the zip downloaded using the setup.sh script. The file size of e10g is the same as what you reported and what I redownloaded this afternoon. I successfully tested georasterinfo using MATLAB R2020b and R2022a.

Brainstorming here, can you confirm exist() returns 2 and which returns something the mapping toolbox directory?

>>  inFile = [getenv('AEM_DIR_CORE') filesep 'data' filesep 'DEM-GLOBE' filesep 'e10g'];
>> exist(inFile)
ans =
     2
>> which inFile
AnkithThodupunoori commented 1 year ago

This is what it return when used the suggested commands image

aweinert-MIT commented 1 year ago

What about which georasterinfo?

AnkithThodupunoori commented 1 year ago

image

aweinert-MIT commented 1 year ago

All those returns are what is expected

AnkithThodupunoori commented 1 year ago

So do you what exactly the problem here? is it the matlab version i am using?

aweinert-MIT commented 1 year ago

I don't think it is the MATLAB version because I tested a version older and newer than what you're using. MATLAB recognizes the file exists and which indicates the correct georasterinfo is on the path.

I'm a bit stumped on the bug. For sanity, can you try loading the file using readgeoraster? It should fail like when using georasterinfo

AnkithThodupunoori commented 1 year ago

yes, looks like it failed same like before image

aweinert-MIT commented 1 year ago

I'm still musing about what the bug could be here because its with a built-in MATLAB function.