It seems that showler's new suggestion is a good one as it solves the problem right at the source. I am not familiar with spells to say whether it can be done or not.
In case that does not work for some reason, I've found that GetCurrentSoulLevel in the soulgem script does return the correct soul level, even while the soulgem is in inventory, therefore "If GetCurrentSoulLevel == 1" (without a reference) will work OK.
Problem is getting the info out of the soulgem script.
When there are more than one item from the same Base Object, RemoveMe does not necessarily remove the soulgem where the script is running. Most likely it will remove a different one, which messes things up. Same goes for DropMe.
Here goes another complex, crazy idea: the soulgems are scripted to:
1) Get a unique 'ID' from a quest script. The ID is an integer that starts with 0 and the soulgem script picks it as its ID and adds 1 to the value, so the next one will get the next ID.
2) When a certain quest variable is set to 1, the soulgem script uses a GetCurrentSoulLevel and saves the soul level info on a quest map array, using its ID as key and the soul level as value. Pretty much saying "Hey, I am soulgem #284 and my current soul level is 3"
When you want to replace the soulgems, you clear the map array, set that quest variable to 1, wait a couple of frames for the soulgems to update their state, return the quest variable to 0, totalize the number of current soul levels, remove all soulgems and add the calculated number of the proper soulgems.
(I am unig this ID trick to identify generic items for my bloat test and it works fine)
OTOH, from your example, I wonder if you actually need to know the current soul level.
If your objective is refill the soulgems in inventory to their max capacity, you could do that with the info from the base object.
If this is the case, you could walk the soulgems in inventory, use GetSoulGemCapacity (on the base record ref) to determine the number and type of each soulgem, remove them with RemoveItem and replace them with AddItem
.