@@ -2828,7 +2828,23 @@ def __getattribute__(self, item):
28282828 # by calling the method on the base class `object`
28292829 updating = object .__getattribute__ (self , "_updating" )
28302830 if updating is False and item != "update_from_mesh" :
2831- object .__getattribute__ (self , "update_from_mesh" )()
2831+ # Don't update the points/bounds if you're only getting metadata
2832+ if item not in (
2833+ "_metadata_manager_temp" ,
2834+ "_metadata_manager" ,
2835+ "standard_name" ,
2836+ "long_name" ,
2837+ "var_name" ,
2838+ "units" ,
2839+ "attributes" ,
2840+ "climatological" ,
2841+ "coord_system" ,
2842+ "attributes" ,
2843+ "haz_lazy_data" ,
2844+ ):
2845+ object .__getattribute__ (self , "update_from_mesh" )(True )
2846+ else :
2847+ object .__getattribute__ (self , "update_from_mesh" )(False )
28322848 return super ().__getattribute__ (item )
28332849
28342850 # Define accessors for MeshCoord-specific properties mesh/location/axis.
@@ -2973,9 +2989,8 @@ def bounds(self, value):
29732989
29742990 @property
29752991 def _metadata_manager (self ):
2976- # sets the metadata
2992+ # update metadata
29772993 use_metadict = self ._load_metadata ()
2978-
29792994 self ._metadata_manager_temp .standard_name = use_metadict ["standard_name" ]
29802995 self ._metadata_manager_temp .long_name = use_metadict ["long_name" ]
29812996 self ._metadata_manager_temp .var_name = use_metadict ["var_name" ]
@@ -2998,15 +3013,17 @@ def __getitem__(self, keys):
29983013 # Translate "self[:,]" as "self.copy()".
29993014 return self .copy ()
30003015
3001- def update_from_mesh (self ):
3016+ def update_from_mesh (self , points_and_bounds = True ):
30023017 try :
30033018 object .__setattr__ (self , "_updating" , True )
30043019 if (self ._last_modified is None ) or (
30053020 self ._last_modified < self .mesh ._last_modified
30063021 ):
3007- points , bounds = self ._load_points_and_bounds ()
3008- super (MeshCoord , self .__class__ ).points .fset (self , points )
3009- super (MeshCoord , self .__class__ ).bounds .fset (self , bounds )
3022+ if points_and_bounds :
3023+ # update points and bounds
3024+ points , bounds = self ._load_points_and_bounds ()
3025+ super (MeshCoord , self .__class__ ).points .fset (self , points )
3026+ super (MeshCoord , self .__class__ ).bounds .fset (self , bounds )
30103027 object .__setattr__ (self , "_last_modified" , self .mesh ._last_modified )
30113028 # Ensure errors aren't bypassed
30123029 except Exception as e :
0 commit comments