@@ -52,6 +52,10 @@ def __init__(self):
5252 self .timestamps = []
5353 self .center = 0.0
5454
55+ self .atmos_proj = None
56+ self .cont_proj = None
57+ self .grid_proj = None
58+
5559 self .extents = [- 180.0 , 180.0 , - 90.0 , 90.0 ]
5660 self .moveextents = [- 180.0 , 180.0 , - 90.0 , 90.0 ]
5761
@@ -101,9 +105,9 @@ def UpdateProjection(self, proj):
101105 if not self .valid :
102106 return
103107
104- atmos_proj = FindSource ("AtmosProj" )
105- cont_proj = FindSource ("ContProj" )
106- grid_proj = FindSource ("GridProj" )
108+ atmos_proj = self . atmos_proj or FindSource ("AtmosProj" )
109+ cont_proj = self . cont_proj or FindSource ("ContProj" )
110+ grid_proj = self . grid_proj or FindSource ("GridProj" )
107111 if self .projection != proj :
108112 self .projection = proj
109113 atmos_proj .Projection = proj
@@ -118,12 +122,12 @@ def UpdatePipeline(self, time=0.0):
118122 if not self .valid :
119123 return
120124
121- atmos_proj = FindSource ("AtmosProj" )
125+ atmos_proj = self . atmos_proj or FindSource ("AtmosProj" )
122126 if atmos_proj :
123127 atmos_proj .UpdatePipeline (time )
124128 self .moveextents = atmos_proj .GetDataInformation ().GetBounds ()
125129
126- cont_proj = FindSource ("ContProj" )
130+ cont_proj = self . cont_proj or FindSource ("ContProj" )
127131 if cont_proj :
128132 cont_proj .UpdatePipeline (time )
129133
@@ -134,7 +138,7 @@ def UpdatePipeline(self, time=0.0):
134138 if grid_gen :
135139 grid_gen .LongitudeRange = [bounds [0 ], bounds [1 ]]
136140 grid_gen .LatitudeRange = [bounds [2 ], bounds [3 ]]
137- grid_proj = FindSource ("GridProj" )
141+ grid_proj = self . grid_proj or FindSource ("GridProj" )
138142 if grid_proj :
139143 grid_proj .UpdatePipeline (time )
140144
@@ -278,13 +282,13 @@ def Update(self, ctrl_file, test_file, conn_file, variables=[], force_reload=Fal
278282 self .extents = atmos_extract .GetDataInformation ().GetBounds ()
279283
280284 # Step 2: Apply map projection to atmospheric data
281- atmos_proj = EAMProject ( # noqa: F821
285+ self . atmos_proj = EAMProject ( # noqa: F821
282286 registrationName = "AtmosProj" , Input = OutputPort (atmos_extract , 0 )
283287 )
284- atmos_proj .Projection = self .projection
285- atmos_proj .Translate = 0
286- atmos_proj .UpdatePipeline ()
287- self .moveextents = atmos_proj .GetDataInformation ().GetBounds ()
288+ self . atmos_proj .Projection = self .projection
289+ self . atmos_proj .Translate = 0
290+ self . atmos_proj .UpdatePipeline ()
291+ self .moveextents = self . atmos_proj .GetDataInformation ().GetBounds ()
288292
289293 # Step 3: Load and process continent outlines
290294 if self .globe is None :
@@ -310,29 +314,29 @@ def Update(self, ctrl_file, test_file, conn_file, variables=[], force_reload=Fal
310314 cont_extract .LatitudeRange = [- 90.0 , 90.0 ]
311315
312316 # Step 5: Apply map projection to continents
313- cont_proj = EAMProject ( # noqa: F821
317+ self . cont_proj = EAMProject ( # noqa: F821
314318 registrationName = "ContProj" , Input = OutputPort (cont_extract , 0 )
315319 )
316- cont_proj .Projection = self .projection
317- cont_proj .Translate = 0
318- cont_proj .UpdatePipeline ()
320+ self . cont_proj .Projection = self .projection
321+ self . cont_proj .Translate = 0
322+ self . cont_proj .UpdatePipeline ()
319323
320324 # Step 6: Generate lat/lon grid lines
321325 grid_gen = EAMGridLines (registrationName = "GridGen" ) # noqa: F821
322326 grid_gen .UpdatePipeline ()
323327
324328 # Step 7: Apply map projection to grid lines
325- grid_proj = EAMProject ( # noqa: F821
329+ self . grid_proj = EAMProject ( # noqa: F821
326330 registrationName = "GridProj" , Input = OutputPort (grid_gen , 0 )
327331 )
328- grid_proj .Projection = self .projection
329- grid_proj .Translate = 0
330- grid_proj .UpdatePipeline ()
332+ self . grid_proj .Projection = self .projection
333+ self . grid_proj .Translate = 0
334+ self . grid_proj .UpdatePipeline ()
331335
332336 # Step 8: Cache all projected views for rendering
333- self .views ["atmosphere_data" ] = OutputPort (atmos_proj , 0 )
334- self .views ["continents" ] = OutputPort (cont_proj , 0 )
335- self .views ["grid_lines" ] = OutputPort (grid_proj , 0 )
337+ self .views ["atmosphere_data" ] = OutputPort (self . atmos_proj , 0 )
338+ self .views ["continents" ] = OutputPort (self . cont_proj , 0 )
339+ self .views ["grid_lines" ] = OutputPort (self . grid_proj , 0 )
336340
337341 self .valid = True
338342 self .observer .clear ()
0 commit comments