Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

g.cimis check for bad images before adding to solar. #66

Open
qjhart opened this issue May 15, 2019 · 3 comments
Open

g.cimis check for bad images before adding to solar. #66

qjhart opened this issue May 15, 2019 · 3 comments

Comments

@qjhart
Copy link
Collaborator

qjhart commented May 15, 2019

The g.cimis program could check for image badness in the goes17 dataset, before deciding whether to project that into the solar location. The way to do that is to project the state boundary into the goes17 mapset, expand it a bit ~10 pixels, and then use that as a mask to do stats on the image. If the stats are bad, then throw an error message, and don't project to solar.

@qjhart qjhart self-assigned this May 15, 2019
@qjhart
Copy link
Collaborator Author

qjhart commented Jun 30, 2019

So, we can create a state boundary in the GOES-17 projection with:

r.proj location=cimis mapset=500m input=state output=state
 r.buffer input=state output=state_plus distance=2000

This leads to this region of interest,
image

Now, we want use this this, but only if it's needed, first look at the min value of the stats, and only after look at the state boundary

b2=1331PST-B2@20190523
 if [[ $((  $(eval $(r.info -r $b2); echo $min ) >  1000 || 
           $(r.mask --quiet --overwrite  state_plus; 
              r.stats --quiet -c  1331PST-B2@20190523 | head -1 | cut -d' ' -f  1; 
              r.mask --quiet -d ) > 1000)) == 1 ]]; 
then 
 echo YES; 
else 
  echo NO; 
fi;
YES

@qjhart
Copy link
Collaborator Author

qjhart commented Jun 30, 2019

And this is the change to the goes.mk file, (see branch check-solar)

# We try and validate the data here, so that we do not propogate bad imagery
$(call f_solar_rast,$1):$(call f_goes_rast,$1)
        @$(call g.mapset,${goes.loc},$(call f_mapset,$1));\
        if [[ $$((  $$(eval $$(r.info -r $(call f_rastname,$1) ); echo $$min ) >  100 ||\
          $$(r.mask --quiet --overwrite  state_plus@500m;\
            r.stats --quiet -c  $(call f_rastname,$1) | head -1 | cut -d' ' -f  1;\
            r.mask --quiet -d ) > 100 )) == 1 ]];  \
        then \
          $(call g.mapset-c,${solar.loc},$(call f_mapset,$1));\
          g.region --quiet ${solar.region};\
          r.proj --quiet location=${goes.loc} mapset=$(call f_mapset,$1) \
            input=$(call f_rastname,$1) method=${solar.proj.method};\
          echo ${solar.loc}/$(call f_mapset,$1)/$(call f_rastname,$1);\
        else \
          echo $(call f_mapset,$1)/$(call f_rastname,$1) BAD DATA;\
        fi;

@qjhart
Copy link
Collaborator Author

qjhart commented Jun 30, 2019

@gjscheer-ucd This is ready to test. What was the day with bad data?

@gjscheer-ucd gjscheer-ucd mentioned this issue Nov 5, 2019
14 tasks
@qjhart qjhart removed their assignment Dec 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants