save multiple files opened using mfdataset as a single one #7839
-
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
For the time-problem, you would need to add import xarray as xr
import numpy as np
da = xr.DataArray(np.arange(10), name="time", dims=["time",])
ds = da.to_dataset()
print(ds.time)
ds.time.attrs["units"] = "days since 2012-01-01"
ds.time.attrs["calendar"] = "proleptic_gregorian"
ds = xr.decode_cf(ds)
print(ds) <xarray.DataArray 'time' (time: 10)>
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
Dimensions without coordinates: time
<xarray.Dataset>
Dimensions: (time: 10)
Coordinates:
* time (time) datetime64[ns] 2012-01-01 2012-01-02 ... 2012-01-10
Data variables:
*empty* Update: Please also refer to the documentation on Creating datetime64 data. |
Beta Was this translation helpful? Give feedback.
-
For the projection problem we would need more information on the projection. It might be some If you need the lat/lon just for plotting, this should work if you use the needed parameters for your projection (if it is polar stereographic): import cartopy.crs as ccrs
map_proj = ccrs.Stereographic(
true_scale_latitude=60.0, central_latitude=90.0, central_longitude=10.0
)
ds.z.isel(time=0).plot(subplot_kws=dict(projection=map_proj)) If you need lat/lon as coordinates (then 2D!) there are several packages out there for coordinate transformation (GDAL, tba.). |
Beta Was this translation helpful? Give feedback.
-
Yeah, I changed to south pole, I noticed it is for north.
That's really quick and extremely helpful. :)
*Girija Kalyani BuradaDoctoral StudentSchool of Geography, Environment and
Earth SciencesVictoria University of WellingtonNew Zealand*
…On Fri, May 12, 2023 at 7:48 PM Kai Mühlbauer ***@***.***> wrote:
Glad it worked. But make sure you use the correct parameters (
true_scale_latitude, central_latitude, central_longitude). The example
values are for a specific projection used by the German Weather Service.
—
Reply to this email directly, view it on GitHub
<#7839 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABWDHEEXW3GLKBKR7CAAWZ3XFXTONANCNFSM6AAAAAAX6677RI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Oh yeah, fine :)
This is sufficient .
Thanks a lot again :)
*Girija Kalyani BuradaDoctoral StudentSchool of Geography, Environment and
Earth SciencesVictoria University of WellingtonNew Zealand*
…On Fri, May 12, 2023 at 7:50 PM Kai Mühlbauer ***@***.***> wrote:
Just curious why the plot is displayed with a warning:
Local\Temp\ipykernel_6472\3827695759.py:3: UserWarning:
"true_scale_latitude" parameter is only used for polar stereographic
projections. Consider the use of "scale_factor" instead. map_proj =
ccrs.Stereographic(.
That's maybe due to using some of my aged examples. Probably cartopy
evolved and we have to use/adapt the projection. I'll leave this for you to
explore.
—
Reply to this email directly, view it on GitHub
<#7839 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABWDHEC6NZ56RMG4NFF3WLDXFXTUHANCNFSM6AAAAAAX6677RI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
For the time-problem, you would need to add
units
(andcalendar
) attribute. I've tried to prepare the DataArray/Dataset to look like yours.Update: Please also ref…