Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing bug in IDL DLM RadarYMDHMSGetSite #561

Merged
merged 1 commit into from Jul 18, 2023
Merged

Conversation

egthomas
Copy link
Member

This pull request fixes a bug in the IDL DLM implementation of RadarYMDHMSGetSite which prevents the correct status value being returned from the hdw file.

Currently, the status field returned by RadarYMDHMSGetSite will always be zero, whereas on this branch the correct value will be returned (ie 1 for active or -1 for inactive). As far as I can tell this bug has been present since the new hdw file format was introduced in RST 4.7. Oops.

@ecbland ecbland self-requested a review July 6, 2023 13:52
@ksterne ksterne added this to the RST 5.1 milestone Jul 6, 2023
@ecbland
Copy link

ecbland commented Jul 10, 2023

@egthomas This works if the radar was active on the requested date (i.e. I get status=1 on this branch, status=0 on develop).

But if the input date is outside the range that the radar was operating, site=RadarYMDHMSGetSite(___) returns zero (not a structure). So I can never get site.status=-1 from that function. Is that the intended behaviour here?

@egthomas
Copy link
Member Author

@ecbland thanks for testing this! Do you mind giving a specific example of the date and radar combinations you tried?

I think you are encountering the expected behavior - my understanding is that a status = -1 means the radar was previously operating but is now decommissioned / offline. If a date is supplied before the first valid line in the hdw.dat file, then the radar did not exist yet and there is no hardware information / status flag to return, hence the zero and not a structure. However, if the code is never returning a structure with status = -1 then that may be a problem (and possibly due to some combination of the end dates in the hdw.dat and radar.dat files).

@ecbland
Copy link

ecbland commented Jul 17, 2023

Sorry @egthomas for the slow response...for some reason I'm not getting email notifications even though I was getting them a few weeks ago.

Below is my IDL code for reading the hardware information for Adak East. I get site.status=1 for example 2 when the radar
was operating. The other two examples (before and after the radar was operating) return an integer rather than a structure. So I can't ever get site.status=-1.

I think this is the correct behaviour; it's just not how I interpreted your original description of this PR:

...on this branch the correct value will be returned (ie 1 for active or -1 for inactive)


;read in radar network information
fname=getenv('SD_RADAR')
openr,unit,fname,/get_lun,/STDIO
network=RadarLoad(unit)
free_lun,unit

;import hardware information for Adak East (stid=209)
stid=209
hdwpath=getenv('SD_HDWPATH')
s=RadarLoadHardware(network,path=hdwpath)
r=RadarGetRadar(network,stid)

; (1) before radar began operating
site=RadarYMDHMSGetSite(r,2011,1,1,0,0,0)
print,size(site)

; (2) during radar operation
site=RadarYMDHMSGetSite(r,2016,1,1,0,0,0)
print,size(site)
print,'status: ',site.status

; (3) after radar ceased operating
site=RadarYMDHMSGetSite(r,2023,1,1,0,0,0)
print,size(site)

@egthomas
Copy link
Member Author

@ecbland thanks for the example - I see what you mean. If you try a radar that has alternated between status flags of +1 and -1 (e.g., Halley / stid=4) then you can see a site.status equal to -1.

I think the original problem I was trying to fix was that the site.status value being returned did not match the values in the hdw.dat files. I worry that changing the behavior any further (ie returning an integer of 0 rather than a site structure if the date is before or after the start/end dates in the radar.dat file) may have unintended consequences for other RST code.

@pasha-ponomarenko
Copy link
Contributor

@egthomas, I agree that changing the output from a structure to a single number might break some code downstream.
It will definitely break my current IDL code for reading site information. 🤔

@ecbland
Copy link

ecbland commented Jul 18, 2023

Thanks @egthomas, now I understand. I indeed get site.status=-1 for Halley for the relevant dates. I'll merge this now...

@ecbland ecbland merged commit f441d45 into develop Jul 18, 2023
@ecbland ecbland deleted the fix_rposdlm_bug branch July 18, 2023 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants